[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`define-globalized-minor-mode': why the need for a separate TURN-ON func
From: |
Drew Adams |
Subject: |
`define-globalized-minor-mode': why the need for a separate TURN-ON function? |
Date: |
Thu, 5 Apr 2012 08:44:42 -0700 |
I've only looked briefly at this, and am no doubt not noticing something.
Anyway, why for `define-globalized-minor-mode' must one define a separate
TURN-ON function to turn the mode on, but using the (local) minor-mode function
suffices to turn it off?
The relevant code in the definition of `define-globalized-minor-mode' seems to
be this part:
;; Go through existing buffers.
(dolist (buf (buffer-list))
(with-current-buffer buf
(if ,global-mode (,turn-on) (when ,mode (,mode -1))))))
Why not just this?
(dolist (buf (buffer-list))
(with-current-buffer buf
(if ,global-mode (,mode 1) (when ,mode (,mode -1))))))
There is another bit of code later on, but it seems similar - same question: why
not just (,mode 1) instead of (,turn-on)? The (local) minor-mode function is
already defined, and it does a fine job of turning on the mode in a single
buffer - why the need for another, no-args function to do that?
There is no doubt a reason, otherwise we wouldn't have introduced this extra
TURN-ON hoop as a mandatory arg to `define-globalized-minor-mode'. (I could
understand an optional arg, I guess, for the cases where such a turn-on function
already exists and might differ for some reason from what the minor-mode
function does with a positive arg.)
What am I missing? Thx.
- `define-globalized-minor-mode': why the need for a separate TURN-ON function?,
Drew Adams <=