From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Feature request: show property 'permanent-local t in describe-variable Date: Tue, 04 Dec 2007 11:10:20 +0100 Message-ID: <4755278C.2080704@gmx.at> References: <47546B89.5010205@gmail.com> <47547D83.1040800@gmx.at> <475487F6.9020102@gmail.com> <4754892B.30400@gmail.com> <4755044F.5000603@gmx.at> <47550C8B.6090904@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020308080608040500030004" X-Trace: ger.gmane.org 1196763365 9495 80.91.229.12 (4 Dec 2007 10:16:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Dec 2007 10:16:05 +0000 (UTC) Cc: Emacs Devel To: "Lennart Borgman (gmail)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 04 11:16:12 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IzUox-0000B5-G1 for ged-emacs-devel@m.gmane.org; Tue, 04 Dec 2007 11:16:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IzUof-0003bQ-MG for ged-emacs-devel@m.gmane.org; Tue, 04 Dec 2007 05:15:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IzUkk-0001lC-5M for emacs-devel@gnu.org; Tue, 04 Dec 2007 05:11:46 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IzUkh-0001jo-Ax for emacs-devel@gnu.org; Tue, 04 Dec 2007 05:11:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IzUkg-0001jJ-CB for emacs-devel@gnu.org; Tue, 04 Dec 2007 05:11:42 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IzUkf-0005Az-Fl for emacs-devel@gnu.org; Tue, 04 Dec 2007 05:11:41 -0500 Original-Received: (qmail invoked by alias); 04 Dec 2007 10:11:40 -0000 Original-Received: from N755P020.adsl.highway.telekom.at (EHLO [62.47.38.84]) [62.47.38.84] by mail.gmx.net (mp051) with SMTP; 04 Dec 2007 11:11:40 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/q7fMYa+bqFdlJYWiEu5BTKroBfkXpydZX9elSg9 C8dYhiFG9sVeBB User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <47550C8B.6090904@gmail.com> X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:84644 Archived-At: This is a multi-part message in MIME format. --------------020308080608040500030004 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I'd propose to do the following: (1) Do away with `variable-binding-locus'. (2) Modify `describe-variable' and the affected functions in edebug.el accordingly. Any objections against the attached patch? --------------020308080608040500030004 Content-Type: text/plain; name="describe-variable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="describe-variable.patch" *** help-fns.el.~1.109.~ Sat Nov 10 10:30:54 2007 --- help-fns.el Tue Dec 4 10:43:34 2007 *************** *** 478,489 **** output)) ;;;###autoload ! (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 or FRAME ! \(default to the current buffer and current frame), ! it is displayed along with the global value." (interactive (let ((v (variable-at-point)) (enable-recursive-minibuffers t) --- 478,488 ---- output)) ;;;###autoload ! (defun describe-variable (variable &optional buffer) "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 is current buffer), it is ! displayed along with the global value." (interactive (let ((v (variable-at-point)) (enable-recursive-minibuffers t) *************** *** 501,519 **** (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)))) ! val val-start-pos 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-help-window (help-buffer) --- 500,516 ---- (list (if (equal val "") v (intern val))))) (unless (buffer-live-p buffer) (setq buffer (current-buffer))) (if (not (symbolp variable)) (message "You did not specify a variable") (save-excursion (let ((valvoid (not (with-current-buffer buffer (boundp variable)))) ! val val-start-pos is-local) ;; Extract the value before setting up the output buffer, ;; in case `buffer' *is* the output buffer. (unless valvoid ! (with-current-buffer buffer ! (setq val (symbol-value variable)) ! (setq is-local (local-variable-p variable buffer)))) (help-setup-xref (list #'describe-variable variable buffer) (interactive-p)) (with-help-window (help-buffer) *************** *** 575,587 **** (delete-region (1- from) from))))) (terpri) ! (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))) --- 572,582 ---- (delete-region (1- from) from))))) (terpri) ! (when is-local ! (princ (format "%socal in buffer %s; " ! (if (get variable 'permanent-local) ! "Permanently l" "L") ! (buffer-name))) (if (not (default-boundp variable)) (princ "globally void") (let ((val (default-value variable))) *************** *** 598,604 **** ;; (help-xref-on-pp from (point)) (if (< (point) (+ from 20)) (delete-region (1- from) from)))))) ! (terpri)) ;; If the value is large, move it to the end. (with-current-buffer standard-output --- 593,599 ---- ;; (help-xref-on-pp from (point)) (if (< (point) (+ from 20)) (delete-region (1- from) from)))))) ! (terpri)) ;; If the value is large, move it to the end. (with-current-buffer standard-output *************** *** 626,645 **** (terpri) (let* ((alias (condition-case nil ! (indirect-variable variable) ! (error variable))) (obsolete (get variable 'byte-obsolete-variable)) (safe-var (get variable 'safe-local-variable)) (doc (or (documentation-property variable 'variable-documentation) (documentation-property alias 'variable-documentation))) (extra-line nil)) ;; Add a note for variables that have been make-var-buffer-local. ! (when (and (local-variable-if-set-p variable) (or (not (local-variable-p variable)) (with-temp-buffer (local-variable-if-set-p variable)))) (setq extra-line t) ! (princ " Automatically becomes buffer-local when set in any fashion.\n")) ;; Mention if it's an alias (unless (eq alias variable) --- 621,643 ---- (terpri) (let* ((alias (condition-case nil ! (indirect-variable variable) ! (error variable))) (obsolete (get variable 'byte-obsolete-variable)) (safe-var (get variable 'safe-local-variable)) (doc (or (documentation-property variable 'variable-documentation) (documentation-property alias 'variable-documentation))) (extra-line nil)) ;; Add a note for variables that have been make-var-buffer-local. ! (when (and (not is-local) ! (local-variable-if-set-p variable) (or (not (local-variable-p variable)) (with-temp-buffer (local-variable-if-set-p variable)))) (setq extra-line t) ! (princ (format " Automatically becomes %sbuffer-local when set in any fashion.\n" ! (if (get variable 'permanent-local) ! "permanently " "")))) ;; Mention if it's an alias (unless (eq alias variable) *** emacs-lisp/edebug.el.~3.102.~ Mon Oct 15 08:58:22 2007 --- emacs-lisp/edebug.el Tue Dec 4 10:31:42 2007 *************** *** 2333,2358 **** "Return a cons cell describing the status of VAR's current binding. The purpose of this function is so you can properly undo subsequent changes to the same binding, by passing the status ! cons cell to `edebug-restore-status'. The status cons cell ! has the form (LOCUS . VALUE), where LOCUS can be a buffer ! \(for a buffer-local binding), a frame (for a frame-local binding), ! or nil (if the default binding is current)." ! (cons (variable-binding-locus var) (symbol-value var))) (defun edebug-restore-status (var status) "Reset VAR based on STATUS. STATUS should be a list you got from `edebug-var-status'." ! (let ((locus (car status)) (value (cdr status))) ! (cond ((bufferp locus) ! (if (buffer-live-p locus) ! (with-current-buffer locus ! (set var value)))) ! ((framep locus) ! (modify-frame-parameters locus (list (cons var value)))) ! (t ! (set var value))))) (defun edebug-enter-trace (edebug-body) (let ((edebug-stack-depth (1+ edebug-stack-depth)) --- 2333,2354 ---- "Return a cons cell describing the status of VAR's current binding. The purpose of this function is so you can properly undo subsequent changes to the same binding, by passing the status ! cons cell to `edebug-restore-status'. The status cons cell has ! the form (BUFFER . VALUE), where BUFFER must specify a buffer ! \(for a buffer-local binding), or nil (if the default binding is ! current)." ! (cons (when (local-variable-p var) (current-buffer)) (symbol-value var))) (defun edebug-restore-status (var status) "Reset VAR based on STATUS. STATUS should be a list you got from `edebug-var-status'." ! (let ((buffer (car status)) (value (cdr status))) ! (if (buffer-live-p buffer) ! (with-current-buffer buffer ! (set var value)) ! (set var value)))) (defun edebug-enter-trace (edebug-body) (let ((edebug-stack-depth (1+ edebug-stack-depth)) *** data.c.~1.281.~ Fri Oct 26 23:52:22 2007 --- data.c Tue Dec 4 10:25:48 2007 *************** *** 1849,1888 **** return Qnil; } - DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locus, - 1, 1, 0, - doc: /* Return a value indicating where VARIABLE's current binding comes from. - If the current binding is buffer-local, the value is the current buffer. - If the current binding is frame-local, the value is the selected frame. - If the current binding is global (the default), the value is nil. */) - (variable) - register Lisp_Object variable; - { - Lisp_Object valcontents; - - CHECK_SYMBOL (variable); - variable = indirect_variable (variable); - - /* Make sure the current binding is actually swapped in. */ - find_symbol_value (variable); - - valcontents = XSYMBOL (variable)->value; - - if (BUFFER_LOCAL_VALUEP (valcontents) - || BUFFER_OBJFWDP (valcontents)) - { - /* For a local variable, record both the symbol and which - buffer's or frame's value we are saving. */ - if (!NILP (Flocal_variable_p (variable, Qnil))) - return Fcurrent_buffer (); - else if (BUFFER_LOCAL_VALUEP (valcontents) - && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) - return XBUFFER_LOCAL_VALUE (valcontents)->frame; - } - - return Qnil; - } - /* This code is disabled now that we use the selected frame to return keyboard-local-values. */ #if 0 --- 1849,1854 ---- *************** *** 3385,3391 **** defsubr (&Smake_variable_frame_local); defsubr (&Slocal_variable_p); defsubr (&Slocal_variable_if_set_p); - defsubr (&Svariable_binding_locus); #if 0 /* XXX Remove this. --lorentey */ defsubr (&Sterminal_local_value); defsubr (&Sset_terminal_local_value); --- 3351,3356 ---- --------------020308080608040500030004 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------020308080608040500030004--