unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `customize-customized' and mode variable of a minor mode
@ 2007-04-06 18:10 Drew Adams
  2007-04-06 19:32 ` Lennart Borgman (gmail)
  2007-04-07 12:40 ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Drew Adams @ 2007-04-06 18:10 UTC (permalink / raw)
  To: Emacs-Devel

`define-minor-mode' defines a defcustom, not a defvar, for the mode
variable. That seems like a good thing. However, if the mode has been
toggled, then `customize-customized' recognizes this variable's value as
having changed.

This can be inconvenient. Users should be able to use `customize-customized'
to check for variables that they have changed and might want to save. I use
`customize-customized' (tweaked so it always returns t) on
`kill-emacs-query-functions', for instance, to remind me to save changes. A
mode variable change via toggling is not usually a change users want to
save.

I'm not sure what a good way to avoid this annoyance would be. Perhaps
`customize-customized' should reflect a change in a mode variable only if
the user changes the value via Customize? That would probably mean making
the toggling code tell Customize to ignore the change.

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

* Re: `customize-customized' and mode variable of a minor mode
  2007-04-06 18:10 `customize-customized' and mode variable of a minor mode Drew Adams
@ 2007-04-06 19:32 ` Lennart Borgman (gmail)
  2007-04-06 19:48   ` Drew Adams
  2007-04-07 12:40 ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-04-06 19:32 UTC (permalink / raw)
  To: Drew Adams; +Cc: Emacs-Devel

Drew Adams wrote:
> `define-minor-mode' defines a defcustom, not a defvar, for the mode
> variable. That seems like a good thing. However, if the mode has been
> toggled, then `customize-customized' recognizes this variable's value as
> having changed.
> 
> This can be inconvenient. Users should be able to use `customize-customized'
> to check for variables that they have changed and might want to save. I use
> `customize-customized' (tweaked so it always returns t) on
> `kill-emacs-query-functions', for instance, to remind me to save changes. A
> mode variable change via toggling is not usually a change users want to
> save.

I do not follow you here. I do not know if it matters, but it is only 
minor modes that are global that shows up in `customize-customized'.

For what reasons should not users want to save them?

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

* RE: `customize-customized' and mode variable of a minor mode
  2007-04-06 19:32 ` Lennart Borgman (gmail)
@ 2007-04-06 19:48   ` Drew Adams
  2007-04-06 19:59     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2007-04-06 19:48 UTC (permalink / raw)
  To: Emacs-Devel

> > `define-minor-mode' defines a defcustom, not a defvar, for the mode
> > variable. That seems like a good thing. However, if the mode has been
> > toggled, then `customize-customized' recognizes this variable's value as
> > having changed.
> >
> > This can be inconvenient. Users should be able to use
> > `customize-customized' to check for variables that they have
> > changed and might want to save. I use `customize-customized'
> > (tweaked so it always returns t) on `kill-emacs-query-functions',
> > for instance, to remind me to save changes. A mode variable
> > change via toggling is not usually a change users want to save.
>
> I do not follow you here. I do not know if it matters, but it is only
> minor modes that are global that shows up in `customize-customized'.

OK, then what I suggested applies only to global minor modes.

> For what reasons should not users want to save them?

Toggling a mode changes the value of the mode variable. Why would a user
want to save that new value? You might toggle a (global) minor mode several
times during an Emacs session. Turning the mode on and off doesn't imply
that you want to change the saved value. I don't see a use case for that.

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

* Re: `customize-customized' and mode variable of a minor mode
  2007-04-06 19:48   ` Drew Adams
@ 2007-04-06 19:59     ` Lennart Borgman (gmail)
  2007-04-06 21:14       ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-04-06 19:59 UTC (permalink / raw)
  To: Drew Adams; +Cc: Emacs-Devel

Drew Adams wrote:
> Toggling a mode changes the value of the mode variable. Why would a user
> want to save that new value? You might toggle a (global) minor mode several
> times during an Emacs session. Turning the mode on and off doesn't imply
> that you want to change the saved value. I don't see a use case for that.


If the global minor mode is at the state currently saved by Custom it 
will not show up in customize-customized.

I often put toggling of global minor modes in the menus. I seems 
conventient to me to be able to save the state of those minor modes 
through customize-customized then.

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

* RE: `customize-customized' and mode variable of a minor mode
  2007-04-06 19:59     ` Lennart Borgman (gmail)
@ 2007-04-06 21:14       ` Drew Adams
  2007-04-06 21:43         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2007-04-06 21:14 UTC (permalink / raw)
  To: Emacs-Devel

> > Toggling a mode changes the value of the mode variable. Why would a user
> > want to save that new value? You might toggle a (global) minor
> > mode several times during an Emacs session. Turning the mode on and
> > off doesn't imply that you want to change the saved value. I don't see
> > a use case for that.
>
> If the global minor mode is at the state currently saved by Custom it
> will not show up in customize-customized.

True, and if it happens to be in the opposite state, then it will show up.

> I often put toggling of global minor modes in the menus.

So do I.

> It seems conventient to me to be able to save the state of those
> minor modes through customize-customized then.

I can see the use case you describe. I guess it depends on the use pattern
and the nature of the global minor mode. At least some mode toggling is not
tentative configuring, and at least some people might not want some mode
changes to be candidates for saving.

There may be no good way to satisfy all use scenarios and user preferences
for this. Another user option perhaps?

A mode variable does two things: 1) its saved value records your preference
for mode initialization, and 2) its current value reflects the state of the
mode (on or off). We could separate these two roles, using two different
variables: one, which is not customizable, to reflect the current state, and
another, which is customizable, to record the initial value.

But then `customize-customized' would not recognize the current mode state
and ask if you want to save it, so that wouldn't satisfy the use case you
mention.

Perhaps it comes down more to how `customize-customized' is invoked. If a
user specifically asks to see all changes, with an eye to saving some to
configure Emacs, then mode variables should be included. If a user uses
`customize-customized' in `kill-emacs-query-functions', then maybe mode
variables should be excluded. In this latter use, `customize-customized' is
invoked just as a safety measure, a la modified buffers in
`save-buffers-kill-emacs'.

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

* Re: `customize-customized' and mode variable of a minor mode
  2007-04-06 21:14       ` Drew Adams
@ 2007-04-06 21:43         ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman (gmail) @ 2007-04-06 21:43 UTC (permalink / raw)
  To: Drew Adams; +Cc: Emacs-Devel

Drew Adams wrote:
>>> Toggling a mode changes the value of the mode variable. Why would a user
>>> want to save that new value? You might toggle a (global) minor
>>> mode several times during an Emacs session. Turning the mode on and
>>> off doesn't imply that you want to change the saved value. I don't see
>>> a use case for that.
>> If the global minor mode is at the state currently saved by Custom it
>> will not show up in customize-customized.
> 
> True, and if it happens to be in the opposite state, then it will show up.
> 
>> I often put toggling of global minor modes in the menus.
> 
> So do I.
> 
>> It seems conventient to me to be able to save the state of those
>> minor modes through customize-customized then.
> 
> I can see the use case you describe. I guess it depends on the use pattern
> and the nature of the global minor mode. At least some mode toggling is not
> tentative configuring, and at least some people might not want some mode
> changes to be candidates for saving.
> 
> There may be no good way to satisfy all use scenarios and user preferences
> for this. Another user option perhaps?

I think that is the way out if it is needed.

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

* Re: `customize-customized' and mode variable of a minor mode
  2007-04-06 18:10 `customize-customized' and mode variable of a minor mode Drew Adams
  2007-04-06 19:32 ` Lennart Borgman (gmail)
@ 2007-04-07 12:40 ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2007-04-07 12:40 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    `define-minor-mode' defines a defcustom, not a defvar, for the mode
    variable. That seems like a good thing. However, if the mode has been
    toggled, then `customize-customized' recognizes this variable's value as
    having changed.

That seems like correct behavior to me.

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-06 18:10 `customize-customized' and mode variable of a minor mode Drew Adams
2007-04-06 19:32 ` Lennart Borgman (gmail)
2007-04-06 19:48   ` Drew Adams
2007-04-06 19:59     ` Lennart Borgman (gmail)
2007-04-06 21:14       ` Drew Adams
2007-04-06 21:43         ` Lennart Borgman (gmail)
2007-04-07 12:40 ` Richard Stallman

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