unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* customize-mark-as-set for M-x foo-mode
@ 2002-08-19 20:55 Stefan Monnier
  2002-08-21  0:12 ` Richard Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2002-08-19 20:55 UTC (permalink / raw)



I see that all the minor-mode-like things in the menu-bar
do (customize-mark-as-set 'foo).  I also saw Per's comment
that this should only be done when the command is executed
interactively.

Is there any reason why it's only executed when run from the
menu-bar rather than from M-x ?

I.e. any objection to doing it for all global minor-modes whenever they are
called interactively ?


	Stefan


--- easy-mmode.el.~1.40.~	Wed Aug 14 21:04:45 2002
+++ easy-mmode.el	Mon Aug 19 16:50:45 2002
@@ -190,11 +185,13 @@
 	 ,@body
 	 ;; The on/off hooks are here for backward compatibility only.
 	 (run-hooks ',hook (if ,mode ',hook-on ',hook-off))
-	 ;; Return the new setting.
 	 (if (interactive-p)
+	     (progn
+	       ,(if globalp `(customize-mark-as-set ',mode))
 	     (message ,(format "%s %%sabled" pretty-name)
-		      (if ,mode "en" "dis")))
+			(if ,mode "en" "dis"))))
 	 (force-mode-line-update)
+	 ;; Return the new setting.
 	 ,mode)
 
        ;; Autoloading an easy-mmode-define-minor-mode autoloads

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-19 20:55 customize-mark-as-set for M-x foo-mode Stefan Monnier
@ 2002-08-21  0:12 ` Richard Stallman
  2002-08-21 15:29   ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2002-08-21  0:12 UTC (permalink / raw)
  Cc: emacs-devel

    I see that all the minor-mode-like things in the menu-bar
    do (customize-mark-as-set 'foo).  I also saw Per's comment
    that this should only be done when the command is executed
    interactively.

    Is there any reason why it's only executed when run from the
    menu-bar rather than from M-x ?

It might be the right thing to do, and I was thinking about it,
but it calls for a lot of thought.

For one thing, there are only a few modes you can control with the
menu bar, but there are dozens, maybe hundreds, you can control
with commands.  Should all of them update your .emacs file?
Maybe they should, but that is a lot of change.

Users have written plenty of such minor mode commands.
Should they all update .emacs too?  I hesitate to think so.

Maybe it would be better if none of these commands updated .emacs
itself, and instead there were another command in the Options menu to
save the options that you can (or that you have) set with the Options
menu.

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-21  0:12 ` Richard Stallman
@ 2002-08-21 15:29   ` Stefan Monnier
  2002-08-22  1:57     ` Richard Stallman
  2002-08-26 12:22     ` Per Abrahamsen
  0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2002-08-21 15:29 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

>     I see that all the minor-mode-like things in the menu-bar
>     do (customize-mark-as-set 'foo).  I also saw Per's comment
>     that this should only be done when the command is executed
>     interactively.
> 
>     Is there any reason why it's only executed when run from the
>     menu-bar rather than from M-x ?
> 
> It might be the right thing to do, and I was thinking about it,
> but it calls for a lot of thought.
> 
> For one thing, there are only a few modes you can control with the
> menu bar, but there are dozens, maybe hundreds, you can control
> with commands.  Should all of them update your .emacs file?
> Maybe they should, but that is a lot of change.

AFAIK customize-mark-as-set does not itself update the .emacs file.
It just marks the variable as "changed by customize" rather
than "changed by some external thingy".  It might indeed cause the
variable to be saved later on if you custom-save-all.  I don't know
how important that is.

> Users have written plenty of such minor mode commands.

Actually very few of them use `define-minor-mode' and even fewer
of them use `:global t'.  But the point of the change is indeed
to make it apply to many more places, so I don't want to minimize
its impact.

> Maybe it would be better if none of these commands updated .emacs
> itself, and instead there were another command in the Options menu to
> save the options that you can (or that you have) set with the Options
> menu.

I don't understand.  It's already the current behavior AFAIU.


	Stefan

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-21 15:29   ` Stefan Monnier
@ 2002-08-22  1:57     ` Richard Stallman
  2002-08-22 15:23       ` Stefan Monnier
  2002-08-26 12:22     ` Per Abrahamsen
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2002-08-22  1:57 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

    > For one thing, there are only a few modes you can control with the
    > menu bar, but there are dozens, maybe hundreds, you can control
    > with commands.  Should all of them update your .emacs file?
    > Maybe they should, but that is a lot of change.

    AFAIK customize-mark-as-set does not itself update the .emacs file.
    It just marks the variable as "changed by customize" rather
    than "changed by some external thingy".  It might indeed cause the
    variable to be saved later on if you custom-save-all.  I don't know
    how important that is.

Please excuse my inadequate memory.  I see no possible harm in marking
the variable as changed.  So the question is simply whether we should try
to change as many minor modes as possible, or only some of them, or none.

If we succeed in changing most minor modes this way, but a few
(perhaps user-implemented) remain unchanged, will the inconsistency be
confusing, or will that be better than nothing?

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-22  1:57     ` Richard Stallman
@ 2002-08-22 15:23       ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2002-08-22 15:23 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

>     > For one thing, there are only a few modes you can control with the
>     > menu bar, but there are dozens, maybe hundreds, you can control
>     > with commands.  Should all of them update your .emacs file?
>     > Maybe they should, but that is a lot of change.
> 
>     AFAIK customize-mark-as-set does not itself update the .emacs file.
>     It just marks the variable as "changed by customize" rather
>     than "changed by some external thingy".  It might indeed cause the
>     variable to be saved later on if you custom-save-all.  I don't know
>     how important that is.
> 
> Please excuse my inadequate memory.  I see no possible harm in marking
> the variable as changed.  So the question is simply whether we should try
> to change as many minor modes as possible, or only some of them, or none.

Indeed.  I obviously think that "as many as possible" is the right answer.

> If we succeed in changing most minor modes this way, but a few
> (perhaps user-implemented) remain unchanged, will the inconsistency be
> confusing, or will that be better than nothing?

There are already many inconsistencies in the various hand-crafted
minor-modes: lack of minor-mode hook, omission of (force-mode-line-update),
"wrong" return value, lack of minibuffer message, lack of optional argument,
unnecessary requirement that there be an argument, ...

Also why should `Options => Show => Tool Bar' change my customize
settings but not M-x tool-bar-mode ?  That doesn't seem consistent
since the two do just the same (it seems).

Obviously, I also agree that we should try to switch as many minor
modes over to the wonders of `define-minor-mode'.



	Stefan

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-21 15:29   ` Stefan Monnier
  2002-08-22  1:57     ` Richard Stallman
@ 2002-08-26 12:22     ` Per Abrahamsen
  2002-08-27 19:05       ` Richard Stallman
  1 sibling, 1 reply; 9+ messages in thread
From: Per Abrahamsen @ 2002-08-26 12:22 UTC (permalink / raw)
  Cc: Richard Stallman, emacs-devel

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:

>>     Is there any reason why it's only executed when run from the
>>     menu-bar rather than from M-x ?

I think it would be a significant improvement to make M-x mark them as
customized rather than rogue.

The only purpose by distinguishing betten "set by customize" and "set
outside customize" is to warn the user that saving the variable from
customize may have no effect, because "something else" (like an
explicit setq in .emacs) will be overwriting the saved value next time
he start Emacs.

If "something else" is an explicit, interactive command by the user,
there is no reason to warn him.

> AFAIK customize-mark-as-set does not itself update the .emacs file.

True.

> It might indeed cause the variable to be saved later on if you
> custom-save-all.

Nope.  Only those marked for saving will be saved.

However, it will make the variable appear in the list generated by
customize-customized, which I would consider an extra bonus.

>> Maybe it would be better if none of these commands updated .emacs
>> itself, and instead there were another command in the Options menu to
>> save the options that you can (or that you have) set with the Options
>> menu.
>
> I don't understand.  It's already the current behavior AFAIU.

Yes, that is the current behavior.  "Options -> Save Options" saves
all options that you _can_ set from the options menu with their
current value, no matter how you have actually set them.

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-26 12:22     ` Per Abrahamsen
@ 2002-08-27 19:05       ` Richard Stallman
  2002-08-28  0:03         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2002-08-27 19:05 UTC (permalink / raw)
  Cc: monnier+gnu/emacs, emacs-devel

I am convinced now that we may as well arrange for these minor mode
commands to mark the minor mode variables as customized, as much as
possible.

Would someone like to start doing that?

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-27 19:05       ` Richard Stallman
@ 2002-08-28  0:03         ` Stefan Monnier
  2002-08-28 23:32           ` Richard Stallman
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2002-08-28  0:03 UTC (permalink / raw)
  Cc: abraham, monnier+gnu/emacs, emacs-devel

> I am convinced now that we may as well arrange for these minor mode
> commands to mark the minor mode variables as customized, as much as
> possible.
> 
> Would someone like to start doing that?

Done for all the commands that use `define-minor-mode'.
I think the others should be fixed by using `define-minor-mode'
whenever possible.


	Stefan

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

* Re: customize-mark-as-set for M-x foo-mode
  2002-08-28  0:03         ` Stefan Monnier
@ 2002-08-28 23:32           ` Richard Stallman
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2002-08-28 23:32 UTC (permalink / raw)
  Cc: abraham, monnier+gnu/emacs, emacs-devel

    I think the others should be fixed by using `define-minor-mode'
    whenever possible.

Do you know approximately how many such commands there are?

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

end of thread, other threads:[~2002-08-28 23:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-19 20:55 customize-mark-as-set for M-x foo-mode Stefan Monnier
2002-08-21  0:12 ` Richard Stallman
2002-08-21 15:29   ` Stefan Monnier
2002-08-22  1:57     ` Richard Stallman
2002-08-22 15:23       ` Stefan Monnier
2002-08-26 12:22     ` Per Abrahamsen
2002-08-27 19:05       ` Richard Stallman
2002-08-28  0:03         ` Stefan Monnier
2002-08-28 23:32           ` 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).