unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Feature request: show property 'permanent-local t in describe-variable
@ 2007-12-03 20:48 Lennart Borgman (gmail)
  2007-12-03 22:04 ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-03 20:48 UTC (permalink / raw)
  To: Emacs Devel

This property is quite important and I think it aught to be visible in 
describe-variable (and perhaps in the future in describe-function).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature request: show property 'permanent-local t in describe-variable
  2007-12-03 20:48 Feature request: show property 'permanent-local t in describe-variable Lennart Borgman (gmail)
@ 2007-12-03 22:04 ` martin rudalics
  2007-12-03 22:49   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2007-12-03 22:04 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

> This property is quite important and I think it aught to be visible in 
> describe-variable (and perhaps in the future in describe-function).

Can you tell me a permanent-local variable where this description
is missing when you do describe-variable?

BTW, shouldn't we get rid of the frame argument in describe-variable?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature request: show property 'permanent-local t in describe-variable
  2007-12-03 22:04 ` martin rudalics
@ 2007-12-03 22:49   ` Lennart Borgman (gmail)
  2007-12-03 22:54     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-03 22:49 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

martin rudalics wrote:
>> This property is quite important and I think it aught to be visible in 
>> describe-variable (and perhaps in the future in describe-function).
> 
> Can you tell me a permanent-local variable where this description
> is missing when you do describe-variable?

Ah, the description tells about it -- but only after it has been set. I 
think it should tell about it always.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature request: show property 'permanent-local t in describe-variable
  2007-12-03 22:49   ` Lennart Borgman (gmail)
@ 2007-12-03 22:54     ` Lennart Borgman (gmail)
  2007-12-04  7:39       ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-03 22:54 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

Lennart Borgman (gmail) wrote:
> martin rudalics wrote:
>>> This property is quite important and I think it aught to be visible 
>>> in describe-variable (and perhaps in the future in describe-function).
>>
>> Can you tell me a permanent-local variable where this description
>> is missing when you do describe-variable?
> 
> Ah, the description tells about it -- but only after it has been set. I 
> think it should tell about it always.


Eh, anyone has a syntax/semantic checker for mail messages? Or maybe 
that is not needed when the message is intended for people used to read 
somewhat cryptic code?

I meant:

Ah, the description tells about it -- but only after the variable has 
been set. I think the description should tell about 'permanent-local t 
always.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature request: show property 'permanent-local t in describe-variable
  2007-12-03 22:54     ` Lennart Borgman (gmail)
@ 2007-12-04  7:39       ` martin rudalics
  2007-12-04  8:15         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2007-12-04  7:39 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

> Ah, the description tells about it -- but only after the variable has 
> been set. I think the description should tell about 'permanent-local t 
> always.

Then it would have to tell about `buffer-local' always.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature request: show property 'permanent-local t in describe-variable
  2007-12-04  7:39       ` martin rudalics
@ 2007-12-04  8:15         ` Lennart Borgman (gmail)
  2007-12-04 10:10           ` martin rudalics
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-04  8:15 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs Devel

martin rudalics wrote:
>> Ah, the description tells about it -- but only after the variable has 
>> been set. I think the description should tell about 'permanent-local t 
>> always.
> 
> Then it would have to tell about `buffer-local' always.

Yes?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature request: show property 'permanent-local t in describe-variable
  2007-12-04  8:15         ` Lennart Borgman (gmail)
@ 2007-12-04 10:10           ` martin rudalics
  2007-12-04 15:30             ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2007-12-04 10:10 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

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?

[-- Attachment #2: describe-variable.patch --]
[-- Type: text/plain, Size: 10145 bytes --]

*** 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 ----

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Feature request: show property 'permanent-local t in describe-variable
  2007-12-04 10:10           ` martin rudalics
@ 2007-12-04 15:30             ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2007-12-04 15:30 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lennart Borgman (gmail), Emacs Devel

> 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?

Since we still support frame-local variables (tho we declared it
obsolete), as well as keyboard-local variables, I think we should keep
variable-binding-locus.


        Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-12-04 15:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03 20:48 Feature request: show property 'permanent-local t in describe-variable Lennart Borgman (gmail)
2007-12-03 22:04 ` martin rudalics
2007-12-03 22:49   ` Lennart Borgman (gmail)
2007-12-03 22:54     ` Lennart Borgman (gmail)
2007-12-04  7:39       ` martin rudalics
2007-12-04  8:15         ` Lennart Borgman (gmail)
2007-12-04 10:10           ` martin rudalics
2007-12-04 15:30             ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).