* Problem with define-minor-mode with :global t.
@ 2005-07-15 9:06 Kim F. Storm
2005-07-15 20:32 ` Stefan Monnier
2005-07-16 20:46 ` Richard M. Stallman
0 siblings, 2 replies; 3+ messages in thread
From: Kim F. Storm @ 2005-07-15 9:06 UTC (permalink / raw)
In CUA, I have this:
(define-minor-mode cua-mode
"..."
:global t
...)
Now, assume I have a buffer `xyz' which definitely don't want
cua-mode enabled.
If I do things in the following sequence, it works alright:
M-x cua-mode RET
C-x b xyz RET
M-: (set (make-local-variable 'cua-mode) nil) RET
But if I (accidentally) do it in this sequence:
C-x b xyz RET
M-: (set (make-local-variable 'cua-mode) nil) RET
M-x cua-mode RET
then I end up _enabling_ cua mode in just the xyz buffer,
while the global setting is still nil.
I think that it would make sense if specifying :global t on
define-minor-mode would enforce changing the default (global) value of
the mode variable rather than the potentially buffer-local value.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem with define-minor-mode with :global t.
2005-07-15 9:06 Problem with define-minor-mode with :global t Kim F. Storm
@ 2005-07-15 20:32 ` Stefan Monnier
2005-07-16 20:46 ` Richard M. Stallman
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2005-07-15 20:32 UTC (permalink / raw)
Cc: emacs-devel
> In CUA, I have this:
> (define-minor-mode cua-mode
> "..."
> :global t
> ...)
> Now, assume I have a buffer `xyz' which definitely don't want
> cua-mode enabled.
> If I do things in the following sequence, it works alright:
> M-x cua-mode RET
> C-x b xyz RET
> M-: (set (make-local-variable 'cua-mode) nil) RET
> But if I (accidentally) do it in this sequence:
> C-x b xyz RET
> M-: (set (make-local-variable 'cua-mode) nil) RET
> M-x cua-mode RET
> then I end up _enabling_ cua mode in just the xyz buffer,
> while the global setting is still nil.
> I think that it would make sense if specifying :global t on
> define-minor-mode would enforce changing the default (global) value of
> the mode variable rather than the potentially buffer-local value.
IIRC, the reason why I used `setq' is that most pre-existing global minor
modes used setq rather than setq-default. I assumed the reason was to make
it possible to make the mode buffer-local in a specific buffer.
Feel free to change it to setq-default if you feel it's better. I don't
have any preference.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem with define-minor-mode with :global t.
2005-07-15 9:06 Problem with define-minor-mode with :global t Kim F. Storm
2005-07-15 20:32 ` Stefan Monnier
@ 2005-07-16 20:46 ` Richard M. Stallman
1 sibling, 0 replies; 3+ messages in thread
From: Richard M. Stallman @ 2005-07-16 20:46 UTC (permalink / raw)
Cc: emacs-devel
I think Stefan is write about this:
IIRC, the reason why I used `setq' is that most pre-existing global minor
modes used setq rather than setq-default. I assumed the reason was to make
it possible to make the mode buffer-local in a specific buffer.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-07-16 20:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-15 9:06 Problem with define-minor-mode with :global t Kim F. Storm
2005-07-15 20:32 ` Stefan Monnier
2005-07-16 20:46 ` Richard M. Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).