summaryrefslogtreecommitdiff
path: root/lisp/help-mode.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-01 03:57:31 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-01 03:57:37 +0100
commit7a46461950172483e45c1512d9a191203f61077b (patch)
treefb4c1881da8c7595cebe99b6bf9e6a80cb2ada46 /lisp/help-mode.el
parent6265e9349f40f74cc275b3b2f1995d220519b3bd (diff)
downloademacs-7a46461950172483e45c1512d9a191203f61077b.tar.gz
emacs-7a46461950172483e45c1512d9a191203f61077b.tar.bz2
emacs-7a46461950172483e45c1512d9a191203f61077b.zip
Make xref symbol marking work again after describe-keymap changes
* lisp/help-mode.el (help-make-xrefs): Adjust xref symbol finding after changes to how keymaps are output.
Diffstat (limited to 'lisp/help-mode.el')
-rw-r--r--lisp/help-mode.el32
1 files changed, 12 insertions, 20 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index b76c7dadaf8..0f80c265733 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -651,27 +651,19 @@ that."
(goto-char (point-min))
;; Find a header and the column at which the command
;; name will be found.
-
- ;; If the keymap substitution isn't the last thing in
- ;; the doc string, and if there is anything on the same
- ;; line after it, this code won't recognize the end of it.
- (while (re-search-forward "^key +binding\n\\(-+ +\\)-+\n\n"
+ (while (re-search-forward "^Key +Binding\n.*\n"
nil t)
- (let ((col (- (match-end 1) (match-beginning 1))))
- (while
- (and (not (eobp))
- ;; Stop at a pair of blank lines.
- (not (looking-at-p "\n\\s-*\n")))
- ;; Skip a single blank line.
- (and (eolp) (forward-line))
- (end-of-line)
- (skip-chars-backward "^ \t\n")
- (if (and (>= (current-column) col)
- (looking-at "\\(\\sw\\|\\s_\\)+$"))
- (let ((sym (intern-soft (match-string 0))))
- (if (fboundp sym)
- (help-xref-button 0 'help-function sym))))
- (forward-line))))))
+ (while (looking-at "\\([^\t\n]+\\)\\(\t+\\|\n\t+\\)\\([^\n\t ]+\\)")
+ (let ((key (match-string 1))
+ (symbol (intern-soft (match-string 3))))
+ (when (and (fboundp symbol)
+ (kbd-valid-p key))
+ (help-xref-button 3 'help-function symbol))
+ (forward-line)
+ ;; Skip empty line.
+ (while (or (eolp)
+ (looking-at-p " *(this binding"))
+ (forward-line)))))))
(set-syntax-table stab))
;; Delete extraneous newlines at the end of the docstring
(goto-char (point-max))