From 3534426b28b9118e32cabe16810f16ef915f0dbd Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 5 Jul 2022 04:57:51 +0200 Subject: [PATCH] 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. --- lisp/textmodes/emacs-news-mode.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index c5d7b6ea509..4ca6ea86d86 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -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 + " " #'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 -- 2.39.5