From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: `define-globalized-minor-mode': why the need for a separate TURN-ON function?
Date: Thu, 5 Apr 2012 08:44:42 -0700 [thread overview]
Message-ID: <792A96A59B454A7596A0A1676765A152@us.oracle.com> (raw)
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.
next reply other threads:[~2012-04-05 15:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-05 15:44 Drew Adams [this message]
2012-04-07 3:56 ` `define-globalized-minor-mode': why the need for a separate TURN-ON function? Stefan Monnier
2012-04-07 14:45 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=792A96A59B454A7596A0A1676765A152@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.