From: Karoly Lorentey Date: Mon, 25 Apr 2005 18:59:54 +0000 (+0000) Subject: Fix describe-variable with frame-local variables. X-Git-Tag: emacs-pretest-23.0.90~11236^2~141^2~267 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=88a76a1f41d335c918ea75c460c5c7a5d131496a;p=emacs.git 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 --- diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 4bf0a4775a0..5e8fae01976 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -498,10 +498,11 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be bound." 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 @@ it is displayed along with the global value." (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 @@ it is displayed along with the global value." (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)))