help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: minor mode on/off/toggle with t/nil question


From: Stefan Monnier
Subject: Re: minor mode on/off/toggle with t/nil question
Date: Wed, 08 Dec 2010 15:19:35 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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

Here's one way:

   (foo-mode (if foo-mode -1 1))

it works with the new scheme as well as the old scheme.

> some question about elisp:  when calling a function interactively
> without any arg, how does emacs lisp engine distinguish it from with a
> nil argument?

The Emacs Lisp engine is only called after the `interactive' spec was
used to build the actual arguments.  So the interactive spec is set up
such that it doesn't pass nil but something else (e.g. `toggle').


        Stefan


reply via email to

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