unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* set-variable and defcustom
@ 2011-03-04  4:21 Jay Belanger
  2011-03-04  5:07 ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Jay Belanger @ 2011-03-04  4:21 UTC (permalink / raw)
  To: emacs-devel; +Cc: jay.p.belanger


If a variable defined with defcustom has its value changed with 
`M-x set-variable', then set-variable will check to make sure that the
new value has the type specified by defcustom.  In this case would it
make sense to use the value of the :set keyword, if there is one?



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

* Re: set-variable and defcustom
  2011-03-04  4:21 set-variable and defcustom Jay Belanger
@ 2011-03-04  5:07 ` Glenn Morris
  2011-03-04 14:30   ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2011-03-04  5:07 UTC (permalink / raw)
  To: jay.p.belanger; +Cc: emacs-devel

Jay Belanger wrote:

> If a variable defined with defcustom has its value changed with 
> `M-x set-variable', then set-variable will check to make sure that the
> new value has the type specified by defcustom.  In this case would it
> make sense to use the value of the :set keyword, if there is one?

Nobody implemented it yet:

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=109



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

* RE: set-variable and defcustom
  2011-03-04  5:07 ` Glenn Morris
@ 2011-03-04 14:30   ` Drew Adams
  2011-03-04 15:04     ` Jay Belanger
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2011-03-04 14:30 UTC (permalink / raw)
  To: 'Glenn Morris', jay.p.belanger; +Cc: emacs-devel

> > If a variable defined with defcustom has its value changed with 
> > `M-x set-variable', then set-variable will check to make 
> > sure that the new value has the type specified by defcustom.
> > In this case would it make sense to use the value of the :set
> > keyword, if there is one?
> 
> Nobody implemented it yet:
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=109

And the recent thread about it:
http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00813.html




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

* Re: set-variable and defcustom
  2011-03-04 14:30   ` Drew Adams
@ 2011-03-04 15:04     ` Jay Belanger
  2011-03-05  4:35       ` Jay Belanger
  0 siblings, 1 reply; 7+ messages in thread
From: Jay Belanger @ 2011-03-04 15:04 UTC (permalink / raw)
  To: emacs-devel; +Cc: jay.p.belanger


>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=109
>
> And the recent thread about it:
> http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00813.html

Sorry, how careless of me to miss all that.



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

* Re: set-variable and defcustom
  2011-03-04 15:04     ` Jay Belanger
@ 2011-03-05  4:35       ` Jay Belanger
  2011-03-05 19:12         ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: Jay Belanger @ 2011-03-05  4:35 UTC (permalink / raw)
  To: emacs-devel; +Cc: jay.p.belanger


>>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=109
>>
>> And the recent thread about it:
>> http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00813.html

Interesting discussion, some of which even touched on Emacs.
While reading it (and the mention of merging `set-variable' and
`customize-set-variable'), I noticed that `customize-set-variable' will
use defcustom's :set value, but not the :get value.  Since
`customize-set-variable' and friends get the value of the variable from
`custom-prompt-variable', I was wondering if it would be appropriate to have
`custom-prompt-variable' use defcustom's :get value when it finds the  
current value of the variable, similarly to how `customize-set-variable'
uses defcustom's :set value, namely:

*** cus-edit.el.orig	2011-03-04 22:25:24.000000000 -0600
--- cus-edit.el	2011-03-04 22:16:01.000000000 -0600
*************** it as the third element in the list."
*** 941,947 ****
  		   (widget-prompt-value type
  					prompt
  					(if (boundp var)
! 					    (symbol-value var))
  					(not (boundp var))))
  		  (t
  		   (eval-minibuffer prompt))))))
--- 941,949 ----
  		   (widget-prompt-value type
  					prompt
  					(if (boundp var)
!                                             (funcall 
!                                              (or (get var 'custom-get) 'symbol-value) 
!                                              var))
  					(not (boundp var))))
  		  (t
  		   (eval-minibuffer prompt))))))







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

* Re: set-variable and defcustom
  2011-03-05  4:35       ` Jay Belanger
@ 2011-03-05 19:12         ` Chong Yidong
  2011-03-06  2:06           ` Jay Belanger
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2011-03-05 19:12 UTC (permalink / raw)
  To: jay.p.belanger; +Cc: emacs-devel

Jay Belanger <jay.p.belanger@gmail.com> writes:

> Interesting discussion, some of which even touched on Emacs.
> While reading it (and the mention of merging `set-variable' and
> `customize-set-variable'), I noticed that `customize-set-variable' will
> use defcustom's :set value, but not the :get value.  Since
> `customize-set-variable' and friends get the value of the variable from
> `custom-prompt-variable', I was wondering if it would be appropriate to have
> `custom-prompt-variable' use defcustom's :get value when it finds the
> current value of the variable, similarly to how `customize-set-variable'
> uses defcustom's :set value, namely:

Yes, this looks right.  The docstring should be fixed, too.



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

* Re: set-variable and defcustom
  2011-03-05 19:12         ` Chong Yidong
@ 2011-03-06  2:06           ` Jay Belanger
  0 siblings, 0 replies; 7+ messages in thread
From: Jay Belanger @ 2011-03-06  2:06 UTC (permalink / raw)
  To: Chong Yidong; +Cc: jay.p.belanger, emacs-devel


Chong Yidong <cyd@stupidchicken.com> writes:
...
>> I was wondering if it would be appropriate to have
>> `custom-prompt-variable' use defcustom's :get value when it finds the
>> current value of the variable, similarly to how
>> `customize-set-variable' uses defcustom's :set value, namely:
>
> Yes, this looks right.  The docstring should be fixed, too.

I made the following change to the docstring:

  If the variable has a `custom-type' property, it must be a widget and the
  `:prompt-value' property of that widget will be used for reading the value.
+ If the variable also has a `custom-get' property, that is used for finding 
+ the current value of the variable, otherwise `symbol-value' is used.
  
  If optional COMMENT argument is non-nil, also prompt for a comment and return
  it as the third element in the list."



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

end of thread, other threads:[~2011-03-06  2:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-04  4:21 set-variable and defcustom Jay Belanger
2011-03-04  5:07 ` Glenn Morris
2011-03-04 14:30   ` Drew Adams
2011-03-04 15:04     ` Jay Belanger
2011-03-05  4:35       ` Jay Belanger
2011-03-05 19:12         ` Chong Yidong
2011-03-06  2:06           ` Jay Belanger

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).