Commit 00d3de8e authored by Richard M. Stallman's avatar Richard M. Stallman

(describe-function): If no fn specified, say so.

(variable-at-point): Return 0 if no variable there.
(describe-variable): If no variable specified, say so.
Don't use nil as the variable.
parent 6fbe22d8
......@@ -493,6 +493,7 @@ C-w print information on absence of warranty for GNU Emacs."
obarray 'fboundp t))
(list (if (equal val "")
fn (intern val)))))
(if function
(with-output-to-temp-buffer "*Help*"
(prin1 function)
(princ ": ")
......@@ -556,8 +557,10 @@ C-w print information on absence of warranty for GNU Emacs."
(set-buffer standard-output)
(help-mode)
;; Return the text we displayed.
(buffer-string))))
(buffer-string)))
(message "You didn't specify a function")))
;; We return 0 if we can't find a variable to return.
(defun variable-at-point ()
(condition-case ()
(let ((stab (syntax-table)))
......@@ -570,9 +573,10 @@ C-w print information on absence of warranty for GNU Emacs."
(forward-sexp -1))
(skip-chars-forward "'")
(let ((obj (read (current-buffer))))
(and (symbolp obj) (boundp obj) obj)))
(or (and (symbolp obj) (boundp obj) obj)
0)))
(set-syntax-table stab)))
(error nil)))
(error 0)))
(defun describe-variable (variable)
"Display the full documentation of VARIABLE (a symbol).
......@@ -581,12 +585,13 @@ Returns the documentation as a string, also."
(let ((v (variable-at-point))
(enable-recursive-minibuffers t)
val)
(setq val (completing-read (if v
(setq val (completing-read (if (symbolp v)
(format "Describe variable (default %s): " v)
"Describe variable: ")
obarray 'boundp t))
(list (if (equal val "")
v (intern val)))))
(if (symbolp variable)
(with-output-to-temp-buffer "*Help*"
(prin1 variable)
(if (not (boundp variable))
......@@ -612,7 +617,8 @@ Returns the documentation as a string, also."
(set-buffer standard-output)
(help-mode)
;; Return the text we displayed.
(buffer-string))))
(buffer-string)))
(message "You did not specify a variable")))
(defun where-is (definition)
"Print message listing key sequences that invoke specified command.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment