diff options
Diffstat (limited to 'lisp/help-fns.el')
| -rw-r--r-- | lisp/help-fns.el | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index fa16fa0bb67..742c66919af 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -115,13 +115,15 @@ When called from lisp, FUNCTION may also be a function object." | |||
| 115 | (if fn | 115 | (if fn |
| 116 | (format "Describe function (default %s): " fn) | 116 | (format "Describe function (default %s): " fn) |
| 117 | "Describe function: ") | 117 | "Describe function: ") |
| 118 | #'help--symbol-completion-table #'fboundp t nil nil | 118 | #'help--symbol-completion-table |
| 119 | (lambda (f) (or (fboundp f) (get f 'function-documentation))) | ||
| 120 | t nil nil | ||
| 119 | (and fn (symbol-name fn))))) | 121 | (and fn (symbol-name fn))))) |
| 120 | (unless (equal val "") | 122 | (unless (equal val "") |
| 121 | (setq fn (intern val))) | 123 | (setq fn (intern val))) |
| 122 | (unless (and fn (symbolp fn)) | 124 | (unless (and fn (symbolp fn)) |
| 123 | (user-error "You didn't specify a function symbol")) | 125 | (user-error "You didn't specify a function symbol")) |
| 124 | (unless (fboundp fn) | 126 | (unless (or (fboundp fn) (get fn 'function-documentation)) |
| 125 | (user-error "Symbol's function definition is void: %s" fn)) | 127 | (user-error "Symbol's function definition is void: %s" fn)) |
| 126 | (list fn))) | 128 | (list fn))) |
| 127 | 129 | ||
| @@ -144,7 +146,9 @@ When called from lisp, FUNCTION may also be a function object." | |||
| 144 | 146 | ||
| 145 | (save-excursion | 147 | (save-excursion |
| 146 | (with-help-window (help-buffer) | 148 | (with-help-window (help-buffer) |
| 147 | (prin1 function) | 149 | (if (get function 'reader-construct) |
| 150 | (princ function) | ||
| 151 | (prin1 function)) | ||
| 148 | ;; Use " is " instead of a colon so that | 152 | ;; Use " is " instead of a colon so that |
| 149 | ;; it is easier to get out the function name using forward-sexp. | 153 | ;; it is easier to get out the function name using forward-sexp. |
| 150 | (princ " is ") | 154 | (princ " is ") |
| @@ -469,7 +473,8 @@ suitable file is found, return nil." | |||
| 469 | (let ((fill-begin (point)) | 473 | (let ((fill-begin (point)) |
| 470 | (high-usage (car high)) | 474 | (high-usage (car high)) |
| 471 | (high-doc (cdr high))) | 475 | (high-doc (cdr high))) |
| 472 | (insert high-usage "\n") | 476 | (unless (get function 'reader-construct) |
| 477 | (insert high-usage "\n")) | ||
| 473 | (fill-region fill-begin (point)) | 478 | (fill-region fill-begin (point)) |
| 474 | high-doc))))) | 479 | high-doc))))) |
| 475 | 480 | ||
| @@ -565,18 +570,21 @@ FILE is the file where FUNCTION was probably defined." | |||
| 565 | (or (and advised | 570 | (or (and advised |
| 566 | (advice--cd*r (advice--symbol-function function))) | 571 | (advice--cd*r (advice--symbol-function function))) |
| 567 | function)) | 572 | function)) |
| 568 | ;; Get the real definition. | 573 | ;; Get the real definition, if any. |
| 569 | (def (if (symbolp real-function) | 574 | (def (if (symbolp real-function) |
| 570 | (or (symbol-function real-function) | 575 | (cond ((symbol-function real-function)) |
| 571 | (signal 'void-function (list real-function))) | 576 | ((get real-function 'function-documentation) |
| 577 | nil) | ||
| 578 | (t (signal 'void-function (list real-function)))) | ||
| 572 | real-function)) | 579 | real-function)) |
| 573 | (aliased (or (symbolp def) | 580 | (aliased (and def |
| 574 | ;; Advised & aliased function. | 581 | (or (symbolp def) |
| 575 | (and advised (symbolp real-function) | 582 | ;; Advised & aliased function. |
| 576 | (not (eq 'autoload (car-safe def)))) | 583 | (and advised (symbolp real-function) |
| 577 | (and (subrp def) | 584 | (not (eq 'autoload (car-safe def)))) |
| 578 | (not (string= (subr-name def) | 585 | (and (subrp def) |
| 579 | (symbol-name function)))))) | 586 | (not (string= (subr-name def) |
| 587 | (symbol-name function))))))) | ||
| 580 | (real-def (cond | 588 | (real-def (cond |
| 581 | ((and aliased (not (subrp def))) | 589 | ((and aliased (not (subrp def))) |
| 582 | (let ((f real-function)) | 590 | (let ((f real-function)) |
| @@ -605,6 +613,8 @@ FILE is the file where FUNCTION was probably defined." | |||
| 605 | ;; Print what kind of function-like object FUNCTION is. | 613 | ;; Print what kind of function-like object FUNCTION is. |
| 606 | (princ (cond ((or (stringp def) (vectorp def)) | 614 | (princ (cond ((or (stringp def) (vectorp def)) |
| 607 | "a keyboard macro") | 615 | "a keyboard macro") |
| 616 | ((get function 'reader-construct) | ||
| 617 | "a reader construct") | ||
| 608 | ;; Aliases are Lisp functions, so we need to check | 618 | ;; Aliases are Lisp functions, so we need to check |
| 609 | ;; aliases before functions. | 619 | ;; aliases before functions. |
| 610 | (aliased | 620 | (aliased |
| @@ -842,7 +852,7 @@ it is displayed along with the global value." | |||
| 842 | (terpri) | 852 | (terpri) |
| 843 | (pp val) | 853 | (pp val) |
| 844 | ;; Remove trailing newline. | 854 | ;; Remove trailing newline. |
| 845 | (delete-char -1)) | 855 | (and (= (char-before) ?\n) (delete-char -1))) |
| 846 | (let* ((sv (get variable 'standard-value)) | 856 | (let* ((sv (get variable 'standard-value)) |
| 847 | (origval (and (consp sv) | 857 | (origval (and (consp sv) |
| 848 | (condition-case nil | 858 | (condition-case nil |