Mercurial > emacs
changeset 83293:aa4ff0258607
Fix describe-variable with frame-local variables.
* lisp/help-fns.el (describe-variable): Describe frame-local variables correctly.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-333
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Mon, 25 Apr 2005 18:59:54 +0000 |
parents | ad07ff6e4555 |
children | a8c8fab4072c |
files | lisp/help-fns.el |
diffstat | 1 files changed, 20 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/help-fns.el Mon Apr 25 11:49:38 2005 +0000 +++ b/lisp/help-fns.el Mon Apr 25 18:59:54 2005 +0000 @@ -498,10 +498,11 @@ 0)) ;;;###autoload -(defun describe-variable (variable &optional buffer) +(defun describe-variable (variable &optional buffer frame) "Display the full documentation of VARIABLE (a symbol). Returns the documentation as a string, also. -If VARIABLE has a buffer-local value in BUFFER (default to the current buffer), +If VARIABLE has a buffer-local value in BUFFER or FRAME +\(default to the current buffer and current frame), it is displayed along with the global value." (interactive (let ((v (variable-at-point)) @@ -516,13 +517,19 @@ (list (if (equal val "") v (intern val))))) (unless (buffer-live-p buffer) (setq buffer (current-buffer))) + (unless (frame-live-p frame) (setq frame (selected-frame))) (if (not (symbolp variable)) (message "You did not specify a variable") (save-excursion - (let* ((valvoid (not (with-current-buffer buffer (boundp variable)))) - ;; Extract the value before setting up the output buffer, - ;; in case `buffer' *is* the output buffer. - (val (unless valvoid (buffer-local-value variable buffer)))) + (let ((valvoid (not (with-current-buffer buffer (boundp variable)))) + val locus) + ;; Extract the value before setting up the output buffer, + ;; in case `buffer' *is* the output buffer. + (unless valvoid + (with-selected-frame frame + (with-current-buffer buffer + (setq val (symbol-value variable) + locus (variable-binding-locus variable))))) (help-setup-xref (list #'describe-variable variable buffer) (interactive-p)) (with-output-to-temp-buffer (help-buffer) @@ -539,11 +546,13 @@ (if (< (point) (+ from 20)) (delete-region (1- from) from))))) (terpri) - (when (local-variable-p variable) - (princ (format "%socal in buffer %s; " - (if (get variable 'permanent-local) - "Permanently l" "L") - (buffer-name))) + (when locus + (if (bufferp locus) + (princ (format "%socal in buffer %s; " + (if (get variable 'permanent-local) + "Permanently l" "L") + (buffer-name))) + (princ (format "It is a frame-local variable; "))) (if (not (default-boundp variable)) (princ "globally void") (let ((val (default-value variable)))