From 3f388d7929346f39c99b7d801e8f62a9b71c4b73 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 5 Jun 2022 21:48:21 +0200 Subject: [PATCH] Make `C-h f' look up key bindings in the current buffer again * 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index f200077faec..8b4905aed15 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -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. -- 2.39.2