From d951e9e650aed1fbe9a587282a8614a4a3b9d35b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 17 Apr 2022 12:11:36 +0200 Subject: [PATCH] Clarify emacs-news--heading-p logic * lisp/textmodes/emacs-news-mode.el (emacs-news--heading-p): Clarify the logic. --- lisp/textmodes/emacs-news-mode.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index e31a7105b80..d9c5b15bf42 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -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." -- 2.39.2