* Remove toggling behavior of minor modes when called from elisp
@ 2007-12-09 18:53 Reiner Steib
2008-01-05 13:40 ` Reiner Steib
0 siblings, 1 reply; 8+ messages in thread
From: Reiner Steib @ 2007-12-09 18:53 UTC (permalink / raw)
To: emacs-devel; +Cc: Stefan Monnier
Hi,
after the discussion cited below, this TODO item had been added:
** Remove the default toggling behavior of minor modes when called from elisp
rather than interactively. This a trivial one-liner in easy-mode.el.
Could this code be installed now?
,----[ <http://thread.gmane.org/gmane.emacs.devel/54509/focus=54665> ]
| From: Stefan Monnier <monnier@iro.umontreal.ca>
| Subject: Re: turn-on-*-mode
| Cc: emacs-devel@gnu.org, Miles Bader <miles@gnu.org>
| Date: Wed, 17 May 2006 17:24:49 -0400
| Message-ID: <jwvfyj8qrgq.fsf-monnier+emacs@gnu.org>
| To: rms@gnu.org
|
| > Stefan had a (what I thought was) clever suggestion to deal with this:
| > Make "...-mode" functions toggle only when used interactively (just as
| > they only print a message when used interactively), and otherwise have
| > them just enable the state unconditionally.
|
| > This is an interesting idea.
|
| > It would mean that there is no longer an argument you could use,
| > noninteractively, to toggle the mode.
|
| Actually there is: the symbol `toggle' does it.
|
| > Another drawback is simply that the interactive and noninteractive
| > behavior of these commands will be different.
|
| Not really. It just means that the argument passed to the minor mode
| function in the absence of a prefix-arg won't be nil but will be `toggle'.
| As a matter of fact, this is already the case.
|
| The current code already emits a warning when the minor mode is called with
| a nil argument and the minor mode is already enabled (i.e. when a nil
| argument is used to toggle the mode off).
`----
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Remove toggling behavior of minor modes when called from elisp
2007-12-09 18:53 Remove toggling behavior of minor modes when called from elisp Reiner Steib
@ 2008-01-05 13:40 ` Reiner Steib
2008-01-06 8:09 ` Richard Stallman
0 siblings, 1 reply; 8+ messages in thread
From: Reiner Steib @ 2008-01-05 13:40 UTC (permalink / raw)
To: emacs-devel; +Cc: Stefan Monnier
Hi,
I didn't see any reply to the suggestion below yet.
On Sun, Dec 09 2007, Reiner Steib wrote:
> after the discussion cited below, this TODO item had been added:
>
> ** Remove the default toggling behavior of minor modes when called from elisp
> rather than interactively. This a trivial one-liner in easy-mode.el.
>
> Could this code be installed now?
>
> ,----[ <http://thread.gmane.org/gmane.emacs.devel/54509/focus=54665> ]
> | From: Stefan Monnier <monnier@iro.umontreal.ca>
> | Subject: Re: turn-on-*-mode
> | Cc: emacs-devel@gnu.org, Miles Bader <miles@gnu.org>
> | Date: Wed, 17 May 2006 17:24:49 -0400
> | Message-ID: <jwvfyj8qrgq.fsf-monnier+emacs@gnu.org>
> | To: rms@gnu.org
> |
> | > Stefan had a (what I thought was) clever suggestion to deal with this:
> | > Make "...-mode" functions toggle only when used interactively (just as
> | > they only print a message when used interactively), and otherwise have
> | > them just enable the state unconditionally.
> |
> | > This is an interesting idea.
> |
> | > It would mean that there is no longer an argument you could use,
> | > noninteractively, to toggle the mode.
> |
> | Actually there is: the symbol `toggle' does it.
> |
> | > Another drawback is simply that the interactive and noninteractive
> | > behavior of these commands will be different.
> |
> | Not really. It just means that the argument passed to the minor mode
> | function in the absence of a prefix-arg won't be nil but will be `toggle'.
> | As a matter of fact, this is already the case.
> |
> | The current code already emits a warning when the minor mode is called with
> | a nil argument and the minor mode is already enabled (i.e. when a nil
> | argument is used to toggle the mode off).
> `----
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Remove toggling behavior of minor modes when called from elisp
2008-01-05 13:40 ` Reiner Steib
@ 2008-01-06 8:09 ` Richard Stallman
2008-01-06 8:53 ` Reiner Steib
0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2008-01-06 8:09 UTC (permalink / raw)
To: Reiner Steib; +Cc: monnier, emacs-devel
I don't think this is a good idea. I see why it would avoid a common
error, but it would also cause confusion to make the no-argument
action so different between interactive and noninteractive calls.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Remove toggling behavior of minor modes when called from elisp
2008-01-06 8:09 ` Richard Stallman
@ 2008-01-06 8:53 ` Reiner Steib
2008-01-06 18:09 ` Richard Stallman
0 siblings, 1 reply; 8+ messages in thread
From: Reiner Steib @ 2008-01-06 8:53 UTC (permalink / raw)
To: rms; +Cc: monnier, emacs-devel
On Sun, Jan 06 2008, Richard Stallman wrote:
> I don't think this is a good idea. I see why it would avoid a common
> error, but it would also cause confusion to make the no-argument
> action so different between interactive and noninteractive calls.
I'm surprised to hear this, since when it was discussed on the list in
2006, you agreed to it and asked to put it into etc/TODO:
,----[ http://article.gmane.org/gmane.emacs.devel/54743 ]
| From: Richard Stallman <rms@gnu.org>
| Subject: Re: turn-on-*-mode
| To: Stefan Monnier <monnier@iro.umontreal.ca>
| Cc: emacs-devel@gnu.org, miles@gnu.org
| Date: Thu, 18 May 2006 22:03:24 -0400
| Message-ID: <E1FguKq-0001O1-1Z@fencepost.gnu.org>
| Reply-To: rms@gnu.org
|
| > It would mean that there is no longer an argument you could use,
| > noninteractively, to toggle the mode.
|
| Actually there is: the symbol `toggle' does it.
|
| Ok.
|
| > Another drawback is simply that the interactive and noninteractive
| > behavior of these commands will be different.
|
| Not really. It just means that the argument passed to the minor mode
| function in the absence of a prefix-arg won't be nil but will be `toggle'.
| As a matter of fact, this is already the case.
|
| It sounds rather clean. Would you please add it to etc/TODO?
`----
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Remove toggling behavior of minor modes when called from elisp
2008-01-06 8:53 ` Reiner Steib
@ 2008-01-06 18:09 ` Richard Stallman
2008-01-06 18:21 ` Reiner Steib
2008-01-06 20:22 ` Stefan Monnier
0 siblings, 2 replies; 8+ messages in thread
From: Richard Stallman @ 2008-01-06 18:09 UTC (permalink / raw)
To: Reiner Steib; +Cc: monnier, emacs-devel
I'm surprised to hear this, since when it was discussed on the list in
2006, you agreed to it and asked to put it into etc/TODO:
I don't remember that previous discusson, so today I thought about it
afresh, and came to a different conclusion this time. Perhaps it is
because you explained more in the previous conversation.
There is something in that old message that puzzles me:
| Not really. It just means that the argument passed to the minor mode
| function in the absence of a prefix-arg won't be nil but will be `toggle'.
| As a matter of fact, this is already the case.
I am puzzled by that last sentence; what is "already the case"?
Can you explain what is already the case?
Also, if we do this, we should change all the minor modes,
not just the ones defined by define-minor-mode.
The minor modes should remain consistent.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Remove toggling behavior of minor modes when called from elisp
2008-01-06 18:09 ` Richard Stallman
@ 2008-01-06 18:21 ` Reiner Steib
2008-01-06 20:22 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Reiner Steib @ 2008-01-06 18:21 UTC (permalink / raw)
To: Richard Stallman; +Cc: Stefan Monnier, emacs-devel
On Sun, Jan 06 2008, Richard Stallman wrote:
> I don't remember that previous discusson, so today I thought about it
> afresh, and came to a different conclusion this time. Perhaps it is
> because you explained more in the previous conversation.
[...]
> I am puzzled by that last sentence; what is "already the case"?
> Can you explain what is already the case?
I can't explain it (I only would like to see the behavior), but
probably Stefan can.
But I could send the ~5 relevant messages from the previous discussion
as mbox file, if you like.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Remove toggling behavior of minor modes when called from elisp
2008-01-06 18:09 ` Richard Stallman
2008-01-06 18:21 ` Reiner Steib
@ 2008-01-06 20:22 ` Stefan Monnier
2008-01-07 11:31 ` Richard Stallman
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2008-01-06 20:22 UTC (permalink / raw)
To: rms; +Cc: Reiner Steib, emacs-devel
> I'm surprised to hear this, since when it was discussed on the list in
> 2006, you agreed to it and asked to put it into etc/TODO:
> I don't remember that previous discusson, so today I thought about it
> afresh, and came to a different conclusion this time. Perhaps it is
> because you explained more in the previous conversation.
> There is something in that old message that puzzles me:
> | Not really. It just means that the argument passed to the
> | minor mode function in the absence of a prefix-arg won't be
> | nil but will be `toggle'. As a matter of fact, this is
> | already the case.
> I am puzzled by that last sentence; what is "already the case"?
It is already the case that the "no argument" interactive case actually
passes an explicit `toggle' argument rather than not pass any argument.
> Also, if we do this, we should change all the minor modes,
> not just the ones defined by define-minor-mode.
> The minor modes should remain consistent.
Of course. I think it's the main part of the TODO item. For most minor
modes, the right thing to do is to make it use define-minor-mode.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Remove toggling behavior of minor modes when called from elisp
2008-01-06 20:22 ` Stefan Monnier
@ 2008-01-07 11:31 ` Richard Stallman
0 siblings, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2008-01-07 11:31 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Reiner.Steib, emacs-devel
Of course. I think it's the main part of the TODO item. For most minor
modes, the right thing to do is to make it use define-minor-mode.
For any minor modes, it is very desirable for the variable's value
to control the entire functionality.
For the old minor modes, that was always the case.
define-minor-mode offers the option to provide forms to be executed
when you turn the mode on or off. If that feature is used, the minor
mode can no longer be controlled by binding the variable.
Converting an existing minor mode to use define-minor-mode offers the
opportunity to take this step backward. We need to remember to avoid
that.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-01-07 11:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-09 18:53 Remove toggling behavior of minor modes when called from elisp Reiner Steib
2008-01-05 13:40 ` Reiner Steib
2008-01-06 8:09 ` Richard Stallman
2008-01-06 8:53 ` Reiner Steib
2008-01-06 18:09 ` Richard Stallman
2008-01-06 18:21 ` Reiner Steib
2008-01-06 20:22 ` Stefan Monnier
2008-01-07 11:31 ` 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).