]> git.eshelyaron.com Git - emacs.git/commitdiff
New command emacs-news-mode-open-line
authorStefan Kangas <stefan@marxist.se>
Tue, 5 Jul 2022 02:57:51 +0000 (04:57 +0200)
committerStefan Kangas <stefan@marxist.se>
Tue, 5 Jul 2022 02:57:51 +0000 (04:57 +0200)
* 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

index c5d7b6ea5096e9060c7877b6c2acc7ad4150fa0a..4ca6ea86d86929175e3dc7bc954895c66bd4eac9 100644 (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