]> git.eshelyaron.com Git - emacs.git/commitdiff
Clarify emacs-news--heading-p logic
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 17 Apr 2022 10:11:36 +0000 (12:11 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 17 Apr 2022 10:11:36 +0000 (12:11 +0200)
* lisp/textmodes/emacs-news-mode.el (emacs-news--heading-p):
Clarify the logic.

lisp/textmodes/emacs-news-mode.el

index e31a7105b8063bd4b55a96a46de9b8fa37412764..d9c5b15bf42363bc485c498f311be5a2b30e3948 100644 (file)
@@ -131,11 +131,14 @@ untagged NEWS entry."
 (defun emacs-news--heading-p ()
   (save-excursion
     (beginning-of-line)
+    ;; A heading starts with * characters, and then a blank line, and
+    ;; then paragraphs with more * characters than in the heading.
     (and (looking-at "\\(\\*+\\) ")
          (let ((level (length (match-string 1))))
-           (goto-char (match-end 0))
-           (when (re-search-forward "^\\(\\*+\\) " nil t)
-             (> (length (match-string 1)) level))))))
+           (forward-line 1)
+           (and (looking-at "$")
+                (re-search-forward "^\\(\\*+\\) " nil t)
+                (> (length (match-string 1)) level))))))
 
 (defun emacs-news-previous-untagged-entry ()
   "Go to the previous untagged NEWS entry."