New command emacs-news-mode-open-line

* lisp/textmodes/emacs-news-mode.el
(emacs-news-mode-open-line): New command.
(emacs-news-mode-map): Remap 'open-line' to above new command.
This commit is contained in:
Stefan Kangas 2022-07-05 04:57:51 +02:00
parent 83f059793a
commit 3534426b28

View file

@ -54,7 +54,8 @@
"C-c C-r" #'emacs-news-previous-untagged-entry
"C-c C-g" #'emacs-news-goto-section
"C-c C-j" #'emacs-news-find-heading
"C-c C-e" #'emacs-news-count-untagged-entries)
"C-c C-e" #'emacs-news-count-untagged-entries
"<remap> <open-line>" #'emacs-news-mode-open-line)
(defvar-keymap emacs-news-view-mode-map
:parent emacs-news-common-map)
@ -232,6 +233,16 @@ untagged NEWS entry."
(when (re-search-forward (concat "^*+ " (regexp-quote heading)) nil t)
(beginning-of-line)))
(defun emacs-news-mode-open-line (n)
"Open a new line in a NEWS file.
This is like `open-line', but skips any temporary NEWS-style
documentation marks on the previous line."
(interactive "*p" emacs-news-mode)
(when (save-excursion (forward-line -1)
(looking-at (rx bol (or "---" "+++") eol)))
(forward-line -1))
(open-line n))
(provide 'emacs-news-mode)
;;; emacs-news-mode.el ends here