[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19693: Further information
From: |
Stefan Monnier |
Subject: |
bug#19693: Further information |
Date: |
Mon, 26 Jan 2015 18:14:42 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> I'm sorry if it's not really a bug. After some testing I understood that
> functions (something-mode ARG) when called from Lisp, enable
> corresponding mode if ARG is omitted, if it's NIL, and even if it's not
> NIL (some people use (something-mode t) to enable the such a
> actually). So, it's quite strange: almost any argument or its absence
> enables the mode, but to disable it one must use negative number. It
> would be more logical if T would enable the mode and NIL would disable
> it.
This is the same for all minor-modes. The reason is partly historical
and partly pragmatic. The situation is basically:
- there are 3 different cases: enable, disable, toggle (so just using
nil and t doesn't cut it).
- when called from Elisp the most common case (by far) is `enable' and
in many cases it's very handy to be able to skip the argument
(typically (add-hook 'foo-mode-hook #'bar-mode) instead of (add-hook
'foo-mode-hook (lambda () (bar-mode <something>)))).
This means that (optional) nil has to mean "enable". The rest doesn't
matter much. I chose `toggle' for the toggling case, and the
"negative/positive" was chosen before I got involved in Emacs.
Stefan