]> git.eshelyaron.com Git - emacs.git/commitdiff
Make `C-h f' look up key bindings in the current buffer again
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 5 Jun 2022 19:48:21 +0000 (21:48 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 5 Jun 2022 19:48:21 +0000 (21:48 +0200)
* lisp/help-fns.el (describe-function): Pass in the correct buffer
to look up key bindings in.
(describe-function-1): Use it.

lisp/help-fns.el

index f200077faec8c06804a1a98470faf7f5eeafa290..8b4905aed15c24569df79185b98414d51d2b0ea5 100644 (file)
@@ -259,6 +259,7 @@ handling of autoloaded functions."
   (let ((describe-function-orig-buffer
          (or describe-function-orig-buffer
              (current-buffer)))
+        (key-buffer (current-buffer))
         (help-buffer-under-preparation t))
 
     (help-setup-xref
@@ -277,7 +278,7 @@ handling of autoloaded functions."
         ;; Use " is " instead of a colon so that
         ;; it is easier to get out the function name using forward-sexp.
         (princ " is ")
-        (describe-function-1 function)
+        (describe-function-1 function key-buffer)
         (with-current-buffer standard-output
           ;; Return the text we displayed.
           (buffer-string))))))
@@ -1025,7 +1026,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
   (unless (eq ?\n (char-before (1- (point)))) (insert "\n")))
 
 ;;;###autoload
-(defun describe-function-1 (function)
+(defun describe-function-1 (function &optional key-bindings-buffer)
   (let ((pt1 (with-current-buffer standard-output (point))))
     (help-fns-function-description-header function)
     (with-current-buffer standard-output
@@ -1047,7 +1048,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
                             (documentation function t)
                           ;; E.g. an alias for a not yet defined function.
                           ((invalid-function void-function) nil)))
-               (key-bindings-buffer (current-buffer)))
+               (key-bindings-buffer (or key-bindings-buffer (current-buffer))))
 
     ;; If the function is autoloaded, and its docstring has
     ;; key substitution constructs, load the library.