]> git.eshelyaron.com Git - emacs.git/commitdiff
Make xref symbol marking work again after describe-keymap changes
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 1 Nov 2021 02:57:31 +0000 (03:57 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 1 Nov 2021 02:57:37 +0000 (03:57 +0100)
* lisp/help-mode.el (help-make-xrefs): Adjust xref symbol finding
after changes to how keymaps are output.

lisp/help-mode.el
lisp/help.el

index b76c7dadaf86a55b3919cf285e52b25da749bb0c..0f80c2657332314a2401fec29c10b07b193091b1 100644 (file)
@@ -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))
index fcb23fa04596c412491dc736974c615f0e8d8906..d12f388c45f0489ea3ec126bde22205a35d1b4b7 100644 (file)
@@ -1255,10 +1255,7 @@ maps to look through.
 
 If MENTION_SHADOW is non-nil, then when something is shadowed by
 SHADOW, don't omit it; instead, mention it but say it is
-shadowed.
-
-Any inserted text ends in two newlines (used by
-`help-make-xrefs')."
+shadowed."
   (let* ((amaps (accessible-keymaps startmap prefix))
          (orig-maps (if no-menu
                         (progn