[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with define-minor-mode with :global t.
From: |
Stefan Monnier |
Subject: |
Re: Problem with define-minor-mode with :global t. |
Date: |
Fri, 15 Jul 2005 16:32:40 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> 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