From: Paul Eggert Date: Sat, 5 Sep 2015 18:22:29 +0000 (-0700) Subject: Fix fix for describe-function keybinding confusion X-Git-Tag: emacs-25.0.90~1225^2~23 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b6b2554f8b9fefe9242b5dbd34211b3ff44a5a65;p=emacs.git Fix fix for describe-function keybinding confusion This fixes a bug introduced by the previous patch. * lisp/help-fns.el (help-fns--signature): Last arg of help-fns--signature is now a buffer, or nil if a raw signature is wanted. All callers changed. (describe-function-1): Use this to do the right thing with signatures. --- diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 5fe36bb92d4..c7f07846618 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -164,7 +164,7 @@ Currently, the following patterns are provided this way:" expansion)))) (declare-function help-fns--signature "help-fns" - (function doc real-def real-function raw)) + (function doc real-def real-function buffer)) ;; FIXME: Obviously, this will collide with nadvice's use of ;; function-documentation if we happen to advise `pcase'. @@ -184,7 +184,7 @@ Currently, the following patterns are provided this way:" (insert "\n\n-- ") (let* ((doc (documentation me 'raw))) (setq doc (help-fns--signature symbol doc me - (indirect-function me) t)) + (indirect-function me) nil)) (insert "\n" (or doc "Not documented."))))))) (let ((combined-doc (buffer-string))) (if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc))))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index f5c7eb30c8c..b247c5bf30f 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -368,7 +368,7 @@ suitable file is found, return nil." (help-xref-button 1 'help-function-cmacro function lib))))) (insert ".\n")))) -(defun help-fns--signature (function doc real-def real-function raw) +(defun help-fns--signature (function doc real-def real-function buffer) "Insert usage at point and return docstring. With highlighting." (if (keymapp function) doc ; If definition is a keymap, skip arglist note. @@ -402,10 +402,13 @@ suitable file is found, return nil." (use1 (replace-regexp-in-string "\\`(\\\\=\\\\\\\\=` \\([^\n ]*\\))\\'" "\\\\=`\\1" use t)) - (high (if raw - (cons use1 doc) - (help-highlight-arguments (substitute-command-keys use1) - (substitute-command-keys doc))))) + (high (if buffer + (let (subst-use1 subst-doc) + (with-current-buffer buffer + (setq subst-use1 (substitute-command-keys use1)) + (setq subst-doc (substitute-command-keys doc))) + (help-highlight-arguments subst-use1 subst-doc)) + (cons use1 doc)))) (let ((fill-begin (point)) (high-usage (car high)) (high-doc (cdr high))) @@ -604,7 +607,8 @@ FILE is the file where FUNCTION was probably defined." (point))) (terpri)(terpri) - (let ((doc-raw (documentation function t))) + (let ((doc-raw (documentation function t)) + (key-bindings-buffer (current-buffer))) ;; If the function is autoloaded, and its docstring has ;; key substitution constructs, load the library. @@ -614,12 +618,12 @@ FILE is the file where FUNCTION was probably defined." (autoload-do-load real-def)) (help-fns--key-bindings function) - (let ((doc (help-fns--signature function doc-raw sig-key - real-function nil))) - (with-current-buffer standard-output - (run-hook-with-args 'help-fns-describe-function-functions function) - (insert "\n" - (or doc "Not documented.")))))))) + (with-current-buffer standard-output + (let ((doc (help-fns--signature function doc-raw sig-key + real-function key-bindings-buffer))) + (run-hook-with-args 'help-fns-describe-function-functions function) + (insert "\n" + (or doc "Not documented.")))))))) ;; Add defaults to `help-fns-describe-function-functions'. (add-hook 'help-fns-describe-function-functions #'help-fns--obsolete)