diff options
author | Po Lu <luangruo@yahoo.com> | 2022-05-24 20:58:52 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-05-24 21:01:24 +0800 |
commit | d63d633a68a0ce1dd3bb8650346b27148ac67329 (patch) | |
tree | 8b87064eb8ed08b795ba6bae5430c0270013bd21 /lisp/help-fns.el | |
parent | a49ecdd0ff2b2526fcc519bb23ce1f5113c8fb1d (diff) | |
download | emacs-d63d633a68a0ce1dd3bb8650346b27148ac67329.tar.gz |
Handle invalid NEWS files during describe-function
* src/help-fns.el (help-fns--first-release): Don't error if
searching for a heading fails.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r-- | lisp/help-fns.el | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 45308e6e9c8..f200077faec 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)))) |