emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b6b2554: Fix fix for describe-function keybinding c


From: Paul Eggert
Subject: [Emacs-diffs] master b6b2554: Fix fix for describe-function keybinding confusion
Date: Sat, 05 Sep 2015 18:23:08 +0000

branch: master
commit b6b2554f8b9fefe9242b5dbd34211b3ff44a5a65
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 lisp/emacs-lisp/pcase.el |    4 ++--
 lisp/help-fns.el         |   28 ++++++++++++++++------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 5fe36bb..c7f0784 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 f5c7eb3..b247c5b 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)



reply via email to

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