diff options
Diffstat (limited to 'lisp/help-fns.el')
| -rw-r--r-- | lisp/help-fns.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index c0d63935035..61e8d54acb3 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -930,6 +930,37 @@ file-local variable.\n") | |||
| 930 | 930 | ||
| 931 | 931 | ||
| 932 | ;;;###autoload | 932 | ;;;###autoload |
| 933 | (defun describe-function-or-variable (symbol &optional buffer frame) | ||
| 934 | "Display the full documentation of the function or variable SYMBOL. | ||
| 935 | If SYMBOL is a variable and has a buffer-local value in BUFFER or FRAME | ||
| 936 | \(default to the current buffer and current frame), it is displayed along | ||
| 937 | with the global value." | ||
| 938 | (interactive | ||
| 939 | (let* ((v-or-f (variable-at-point)) | ||
| 940 | (found (symbolp v-or-f)) | ||
| 941 | (v-or-f (if found v-or-f (function-called-at-point))) | ||
| 942 | (found (or found v-or-f)) | ||
| 943 | (enable-recursive-minibuffers t) | ||
| 944 | val) | ||
| 945 | (setq val (completing-read (if found | ||
| 946 | (format | ||
| 947 | "Describe function or variable (default %s): " v-or-f) | ||
| 948 | "Describe function or variable: ") | ||
| 949 | obarray | ||
| 950 | (lambda (vv) | ||
| 951 | (or (fboundp vv) | ||
| 952 | (get vv 'variable-documentation) | ||
| 953 | (and (boundp vv) (not (keywordp vv))))) | ||
| 954 | t nil nil | ||
| 955 | (if found (symbol-name v-or-f)))) | ||
| 956 | (list (if (equal val "") | ||
| 957 | v-or-f (intern val))))) | ||
| 958 | (if (not (symbolp symbol)) (message "You didn't specify a function or variable") | ||
| 959 | (unless (buffer-live-p buffer) (setq buffer (current-buffer))) | ||
| 960 | (unless (frame-live-p frame) (setq frame (selected-frame))) | ||
| 961 | (help-xref-interned symbol buffer frame))) | ||
| 962 | |||
| 963 | ;;;###autoload | ||
| 933 | (defun describe-syntax (&optional buffer) | 964 | (defun describe-syntax (&optional buffer) |
| 934 | "Describe the syntax specifications in the syntax table of BUFFER. | 965 | "Describe the syntax specifications in the syntax table of BUFFER. |
| 935 | The descriptions are inserted in a help buffer, which is then displayed. | 966 | The descriptions are inserted in a help buffer, which is then displayed. |