diff options
| author | Lars Ingebrigtsen | 2016-05-01 00:08:52 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-05-01 00:08:52 +0200 |
| commit | 032b05103136e6aa0a9640a3e3fa56fefebf7119 (patch) | |
| tree | 316102f6e6edb3328ac26bf4a435de7fc95935c8 | |
| parent | eeac7c57273cec3f9408b18392dd2bafe3be4450 (diff) | |
| download | emacs-032b05103136e6aa0a9640a3e3fa56fefebf7119.tar.gz emacs-032b05103136e6aa0a9640a3e3fa56fefebf7119.zip | |
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).
| -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." | |||
| 699 | (interactive | 699 | (interactive |
| 700 | (let ((v (variable-at-point)) | 700 | (let ((v (variable-at-point)) |
| 701 | (enable-recursive-minibuffers t) | 701 | (enable-recursive-minibuffers t) |
| 702 | (orig-buffer (current-buffer)) | ||
| 702 | val) | 703 | val) |
| 703 | (setq val (completing-read (if (symbolp v) | 704 | (setq val (completing-read |
| 704 | (format | 705 | (if (symbolp v) |
| 705 | "Describe variable (default %s): " v) | 706 | (format |
| 706 | "Describe variable: ") | 707 | "Describe variable (default %s): " v) |
| 707 | obarray | 708 | "Describe variable: ") |
| 708 | (lambda (vv) | 709 | obarray |
| 709 | (or (get vv 'variable-documentation) | 710 | (lambda (vv) |
| 710 | (and (boundp vv) (not (keywordp vv))))) | 711 | ;; In case the variable only exists in the buffer |
| 711 | t nil nil | 712 | ;; the command we switch back to that buffer before |
| 712 | (if (symbolp v) (symbol-name v)))) | 713 | ;; we examine the variable. |
| 714 | (with-current-buffer orig-buffer | ||
| 715 | (or (get vv 'variable-documentation) | ||
| 716 | (and (boundp vv) (not (keywordp vv)))))) | ||
| 717 | t nil nil | ||
| 718 | (if (symbolp v) (symbol-name v)))) | ||
| 713 | (list (if (equal val "") | 719 | (list (if (equal val "") |
| 714 | v (intern val))))) | 720 | v (intern val))))) |
| 715 | (let (file-name) | 721 | (let (file-name) |