Assume match before calling help-xref-button

help-xref-button fails if not preceded by a valid match, so a
preceding unconditional search should not be allowed to fail
silently.

* lisp/emacs-lisp/ert.el (ert-describe-test):
* lisp/help-fns.el (help-fns--compiler-macro)
(help-fns-function-description-header, describe-variable)
(help-fns--customize-variable, describe-face)
(help-fns--face-attributes, describe-keymap): Let unconditional
re-search-backward before help-xref-button fail early, as that would
indicate a logic bug, and the backtrace would more accurately point
to the actual source of the mistake.
This commit is contained in:
Basil L. Contovounesios 2024-04-30 08:31:58 +02:00
parent 54dbd8b4fa
commit 65fa47e3fa
2 changed files with 10 additions and 19 deletions

View file

@ -2816,8 +2816,7 @@ To be used in the ERT results buffer."
(insert (format-message " defined in `%s'"
(file-name-nondirectory file-name)))
(save-excursion
(re-search-backward (substitute-command-keys "`\\([^`']+\\)'")
nil t)
(re-search-backward (substitute-command-keys "`\\([^`']+\\)'"))
(help-xref-button 1 'help-function-def test-name file-name)))
(insert ".")
(fill-region-as-paragraph (point-min) (point))