[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d63d633a68 1/2: Handle invalid NEWS files during describe-functio
From: |
Po Lu |
Subject: |
master d63d633a68 1/2: Handle invalid NEWS files during describe-function |
Date: |
Tue, 24 May 2022 09:01:34 -0400 (EDT) |
branch: master
commit d63d633a68a0ce1dd3bb8650346b27148ac67329
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Handle invalid NEWS files during describe-function
* src/help-fns.el (help-fns--first-release): Don't error if
searching for a heading fails.
---
lisp/help-fns.el | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 45308e6e9c..f200077fae 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -799,21 +799,23 @@ the C sources, too."
(erase-buffer)
(insert-file-contents f)
(goto-char (point-min))
- (search-forward "\n*")
- (while (re-search-forward re nil t)
- (let ((pos (match-beginning 0)))
- (save-excursion
- ;; Almost all entries are of the form "* ... in Emacs NN.MM."
- ;; but there are also a few in the form "* Emacs NN.MM is a bug
- ;; fix release ...".
- (if (not (re-search-backward "^\\* .* Emacs \\([0-9.]+[0-9]\\)"
- nil t))
- (message "Ref found in non-versioned section in %S"
- (file-name-nondirectory f))
- (let ((version (match-string 1)))
- (when (or (null first) (version< version first))
- (setq place (list f pos))
- (setq first version)))))))))
+ ;; Failed git merges can leave empty files that look like NEWS
+ ;; in etc. Don't error here.
+ (when (search-forward "\n*" nil t)
+ (while (re-search-forward re nil t)
+ (let ((pos (match-beginning 0)))
+ (save-excursion
+ ;; Almost all entries are of the form "* ... in Emacs NN.MM."
+ ;; but there are also a few in the form "* Emacs NN.MM is a bug
+ ;; fix release ...".
+ (if (not (re-search-backward "^\\* .* Emacs \\([0-9.]+[0-9]\\)"
+ nil t))
+ (message "Ref found in non-versioned section in %S"
+ (file-name-nondirectory f))
+ (let ((version (match-string 1)))
+ (when (or (null first) (version< version first))
+ (setq place (list f pos))
+ (setq first version))))))))))
(when first
(make-text-button first nil 'type 'help-news 'help-args place))))