emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: turn-on-bug-reference-mode, turn-on-bug-reference-prog-mode type fun


From: Davis Herring
Subject: Re: turn-on-bug-reference-mode, turn-on-bug-reference-prog-mode type functions
Date: Sat, 3 Apr 2010 11:17:38 -0700 (PDT)
User-agent: SquirrelMail/1.4.8-5.7.lanl7

> Here's an idea.  In running a normal hook, if the hook function is a
> minor mode, it could call the function with t as argument.
> That way, putting the minor mode function itself on the hook
> will do what people naively expected it to do, and there will
> be no need for the turn-on-MINOR_MODE functions.

I think it's obvious that making something fundamental like `run-hooks' 
have invisible magic behavior like that is ugly (you called your other
suggestion cleaner, after all).

> Another way to achieve this result is cleaner but a bigger change.  It
> would be to change the meaning of the expression (MINOR-MODE-FUNCTION)
> so it turns the mode on, instead of toggling.  This way, it would not
> behave specially when called from a hook.  And I think that this behavior
> will seem more natural to people writing Lisp programs.

Very much more natural, I think; the need to actually toggle a mode from
Lisp is so rare that it probably doesn't deserve to be the default.

> However, we must not change the meaning of M-x MINOR-MODE-FUNCTION RET.
> That must continue to toggle, as users expect.

Most definitely.  It would probably also be good to preserve the meaning
of integer arguments even when interactive.

> We might want to invent another argument to make the Lisp function
> toggle the minor mode.  After all, the interactive call has to convey
> that intention to the function via arguments.

No value seems very obvious as a candidate: the integers are already used,
nil is being changed to mean "on" in this proposal, and using t to mean
toggle is more alliterative than it is mnemonic.  But whatever it is, the
interactive spec can remain "P" and the function (as automated by things
like `define-minor-mode') can do something like
  (or arg (and (called-interactively-p) 'toggle))
for whatever value of 'toggle.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]