emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1d1158397b: Look up keybindings in correct buffer in describe-fun


From: Gregory Heytings
Subject: master 1d1158397b: Look up keybindings in correct buffer in describe-function.
Date: Sat, 3 Sep 2022 18:45:32 -0400 (EDT)

branch: master
commit 1d1158397bce41466078e384eed2d1e214e206de
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>

    Look up keybindings in correct buffer in describe-function.
    
    * lisp/help-fns.el (help-fns--key-bindings): New parameter.
    Use it when looking up keybindings.
    (describe-function-1): Add the buffer in which the command
    was invoked as argument to 'help-fns--key-bindings'.
    Fixes bug#57568.
---
 lisp/help-fns.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index bb5b3bb71f..3f3a5747dc 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -510,13 +510,15 @@ the C sources, too."
             (src-file (locate-library file-name t nil 'readable)))
        (and src-file (file-readable-p src-file) src-file))))))
 
-(defun help-fns--key-bindings (function)
+(defun help-fns--key-bindings (function orig-buffer)
   (when (commandp function)
     (let ((pt2 (with-current-buffer standard-output (point)))
           (remapped (command-remapping function)))
       (unless (memq remapped '(ignore undefined))
-        (let* ((all-keys (where-is-internal
-                          (or remapped function) overriding-local-map nil nil))
+        (let* ((all-keys
+                (with-current-buffer orig-buffer
+                  (where-is-internal
+                   (or remapped function) overriding-local-map nil nil)))
                (seps (seq-group-by
                       (lambda (key)
                         (and (vectorp key)
@@ -1129,7 +1131,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED 
REAL-DEF)."
          (string-match "\\([^\\]=\\|[^=]\\|\\`\\)\\\\[[{<]" doc-raw)
          (autoload-do-load real-def))
 
-    (help-fns--key-bindings function)
+    (help-fns--key-bindings function describe-function-orig-buffer)
     (with-current-buffer standard-output
       (let ((doc (condition-case nil
                      ;; FIXME: Maybe `help-fns--signature' should return `doc'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]