diff options
| author | Paul Eggert | 2015-09-05 11:22:29 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-09-05 11:23:04 -0700 |
| commit | b6b2554f8b9fefe9242b5dbd34211b3ff44a5a65 (patch) | |
| tree | 4dfaebea7904619d499c553a9c6e2e7612a5151b | |
| parent | ba521e7029ef2893a135ebec8cc472f3d45bf668 (diff) | |
| download | emacs-b6b2554f8b9fefe9242b5dbd34211b3ff44a5a65.tar.gz emacs-b6b2554f8b9fefe9242b5dbd34211b3ff44a5a65.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/pcase.el | 4 | ||||
| -rw-r--r-- | 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 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:" | |||
| 164 | expansion)))) | 164 | expansion)))) |
| 165 | 165 | ||
| 166 | (declare-function help-fns--signature "help-fns" | 166 | (declare-function help-fns--signature "help-fns" |
| 167 | (function doc real-def real-function raw)) | 167 | (function doc real-def real-function buffer)) |
| 168 | 168 | ||
| 169 | ;; FIXME: Obviously, this will collide with nadvice's use of | 169 | ;; FIXME: Obviously, this will collide with nadvice's use of |
| 170 | ;; function-documentation if we happen to advise `pcase'. | 170 | ;; function-documentation if we happen to advise `pcase'. |
| @@ -184,7 +184,7 @@ Currently, the following patterns are provided this way:" | |||
| 184 | (insert "\n\n-- ") | 184 | (insert "\n\n-- ") |
| 185 | (let* ((doc (documentation me 'raw))) | 185 | (let* ((doc (documentation me 'raw))) |
| 186 | (setq doc (help-fns--signature symbol doc me | 186 | (setq doc (help-fns--signature symbol doc me |
| 187 | (indirect-function me) t)) | 187 | (indirect-function me) nil)) |
| 188 | (insert "\n" (or doc "Not documented."))))))) | 188 | (insert "\n" (or doc "Not documented."))))))) |
| 189 | (let ((combined-doc (buffer-string))) | 189 | (let ((combined-doc (buffer-string))) |
| 190 | (if ud (help-add-fundoc-usage combined-doc (car ud)) combined-doc))))) | 190 | (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." | |||
| 368 | (help-xref-button 1 'help-function-cmacro function lib))))) | 368 | (help-xref-button 1 'help-function-cmacro function lib))))) |
| 369 | (insert ".\n")))) | 369 | (insert ".\n")))) |
| 370 | 370 | ||
| 371 | (defun help-fns--signature (function doc real-def real-function raw) | 371 | (defun help-fns--signature (function doc real-def real-function buffer) |
| 372 | "Insert usage at point and return docstring. With highlighting." | 372 | "Insert usage at point and return docstring. With highlighting." |
| 373 | (if (keymapp function) | 373 | (if (keymapp function) |
| 374 | doc ; If definition is a keymap, skip arglist note. | 374 | doc ; If definition is a keymap, skip arglist note. |
| @@ -402,10 +402,13 @@ suitable file is found, return nil." | |||
| 402 | (use1 (replace-regexp-in-string | 402 | (use1 (replace-regexp-in-string |
| 403 | "\\`(\\\\=\\\\\\\\=` \\([^\n ]*\\))\\'" | 403 | "\\`(\\\\=\\\\\\\\=` \\([^\n ]*\\))\\'" |
| 404 | "\\\\=`\\1" use t)) | 404 | "\\\\=`\\1" use t)) |
| 405 | (high (if raw | 405 | (high (if buffer |
| 406 | (cons use1 doc) | 406 | (let (subst-use1 subst-doc) |
| 407 | (help-highlight-arguments (substitute-command-keys use1) | 407 | (with-current-buffer buffer |
| 408 | (substitute-command-keys doc))))) | 408 | (setq subst-use1 (substitute-command-keys use1)) |
| 409 | (setq subst-doc (substitute-command-keys doc))) | ||
| 410 | (help-highlight-arguments subst-use1 subst-doc)) | ||
| 411 | (cons use1 doc)))) | ||
| 409 | (let ((fill-begin (point)) | 412 | (let ((fill-begin (point)) |
| 410 | (high-usage (car high)) | 413 | (high-usage (car high)) |
| 411 | (high-doc (cdr high))) | 414 | (high-doc (cdr high))) |
| @@ -604,7 +607,8 @@ FILE is the file where FUNCTION was probably defined." | |||
| 604 | (point))) | 607 | (point))) |
| 605 | (terpri)(terpri) | 608 | (terpri)(terpri) |
| 606 | 609 | ||
| 607 | (let ((doc-raw (documentation function t))) | 610 | (let ((doc-raw (documentation function t)) |
| 611 | (key-bindings-buffer (current-buffer))) | ||
| 608 | 612 | ||
| 609 | ;; If the function is autoloaded, and its docstring has | 613 | ;; If the function is autoloaded, and its docstring has |
| 610 | ;; key substitution constructs, load the library. | 614 | ;; key substitution constructs, load the library. |
| @@ -614,12 +618,12 @@ FILE is the file where FUNCTION was probably defined." | |||
| 614 | (autoload-do-load real-def)) | 618 | (autoload-do-load real-def)) |
| 615 | 619 | ||
| 616 | (help-fns--key-bindings function) | 620 | (help-fns--key-bindings function) |
| 617 | (let ((doc (help-fns--signature function doc-raw sig-key | 621 | (with-current-buffer standard-output |
| 618 | real-function nil))) | 622 | (let ((doc (help-fns--signature function doc-raw sig-key |
| 619 | (with-current-buffer standard-output | 623 | real-function key-bindings-buffer))) |
| 620 | (run-hook-with-args 'help-fns-describe-function-functions function) | 624 | (run-hook-with-args 'help-fns-describe-function-functions function) |
| 621 | (insert "\n" | 625 | (insert "\n" |
| 622 | (or doc "Not documented.")))))))) | 626 | (or doc "Not documented.")))))))) |
| 623 | 627 | ||
| 624 | ;; Add defaults to `help-fns-describe-function-functions'. | 628 | ;; Add defaults to `help-fns-describe-function-functions'. |
| 625 | (add-hook 'help-fns-describe-function-functions #'help-fns--obsolete) | 629 | (add-hook 'help-fns-describe-function-functions #'help-fns--obsolete) |