]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix fix for describe-function keybinding confusion
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 5 Sep 2015 18:22:29 +0000 (11:22 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 5 Sep 2015 18:23:04 +0000 (11:23 -0700)
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.

lisp/emacs-lisp/pcase.el
lisp/help-fns.el

index 5fe36bb92d4323ddb84484e8e50157cac3771985..c7f0784661815494aa0cadb3012104449e5590ec 100644 (file)
@@ -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)))))
index f5c7eb30c8c9f38d5d0b1f03f1356e11d388b475..b247c5bf30f9cb285241b51c38e91b6b5dc6fcc3 100644 (file)
@@ -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)