emacs minor mode toggle/on/off

On Jun 16, 7:33 am, Stefan Monnier wrote:
> For the same kind of reason, Emacs-24 will change the way minor-modes
> react when called with a nil argument (in Emacs-23, it toggles the mode,
> in Emacs-24 it turns it ON unconditionally).  In this case, this doesn't
> change the UI (when called interactively, the arg is never nil), but for
> some users, their .emacs will end up doing something else than what they
> intended.  This was deemed OK, because for many more users this change
> will make their .emacs DTRT (i.e. it will silently fix a lurking bug in
> their config), and it also makes it easier to add minor modes on hooks,
> without having to rely on the existence of a turn-on-foo-mode or the use
> of the more verbose (lambda () (foo-mode 1)).

May i ask how does one toggle the mode in elisp code with the new scheme?

as far as i know, currently there are some 200 functions with the word “toggle” in their name, but i think vast majority of minor modes don't have associated toggle versions.

also related, many minor modes or functions also have a globle version. (e.g.
global-hi-lock-mode, global-font-lock-mode, global-linum-mode, global-hl-line-mode, global-visual-line-mode, global-whitespace-newline-mode) How's the toggle gonna be done wiht global?

are all minor modes going to be associated with a new toggle function?

some question about elisp: when calling a function (interactively or in lisp code) without any arg, how does emacs lisp engine distinguish it from with a nil argument? or, is there a function that tells me how many argument a function received? or is this handled due to lisp macro ability that (interactive) is?

thanks a lot.


• Emacs: How to Turn a Minor Mode on/off/toggle?

No comments:

Post a Comment