diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2016-05-01 00:08:52 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2016-05-01 00:08:52 +0200 |
commit | 032b05103136e6aa0a9640a3e3fa56fefebf7119 (patch) | |
tree | 316102f6e6edb3328ac26bf4a435de7fc95935c8 /lisp/help-fns.el | |
parent | eeac7c57273cec3f9408b18392dd2bafe3be4450 (diff) | |
download | emacs-032b05103136e6aa0a9640a3e3fa56fefebf7119.tar.gz |
Make describe-variable look up the variable in the current buffer
* lisp/help-fns.el (describe-variable): Get the variable
definition in the buffer we were called from (in case it only
exists there) (bug#21252).
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r-- | lisp/help-fns.el | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index e2cb9f82a1b..e17586c28fe 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -699,17 +699,23 @@ it is displayed along with the global value." (interactive (let ((v (variable-at-point)) (enable-recursive-minibuffers t) + (orig-buffer (current-buffer)) val) - (setq val (completing-read (if (symbolp v) - (format - "Describe variable (default %s): " v) - "Describe variable: ") - obarray - (lambda (vv) - (or (get vv 'variable-documentation) - (and (boundp vv) (not (keywordp vv))))) - t nil nil - (if (symbolp v) (symbol-name v)))) + (setq val (completing-read + (if (symbolp v) + (format + "Describe variable (default %s): " v) + "Describe variable: ") + obarray + (lambda (vv) + ;; In case the variable only exists in the buffer + ;; the command we switch back to that buffer before + ;; we examine the variable. + (with-current-buffer orig-buffer + (or (get vv 'variable-documentation) + (and (boundp vv) (not (keywordp vv)))))) + t nil nil + (if (symbolp v) (symbol-name v)))) (list (if (equal val "") v (intern val))))) (let (file-name) |