emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH] Proposal to change cursor appearance to indicate region acti


From: Drew Adams
Subject: RE: [PATCH] Proposal to change cursor appearance to indicate region activation
Date: Fri, 23 Jan 2015 09:49:52 -0800 (PST)

> > I was thinking of rather doing something like:...
> 
> That's even uglier! ;-) You still have a global minor mode (and its
> variable), and a separately-named buffer-local variable, so it's no
> simpler. And the logic is more complex.
> 
> And it appears it would fail in the example case I gave in my previous
> message: (setq-default cursor-type 'bar)
> A few days later in the same Emacs session... (dynamic-cursor-mode)
> 
> The user would reasonably think the failure is a bug in dynamic-cursor-mode;
> after all, the point of the mode is to control the cursor.
> 
> I guess you could fix that failure, but make sure it doesn't then fail if
> the user set some other cursor type (e.g. 'hbar) instead of 'bar.
> 
> I agree that there shouldn't be a buffer-local minor mode for dynamic-
> cursor; it's overkill, since all it's used for is the variable. But the
> global minor mode that you want is also overkill for the same reason. I
> suggest using a defcustom and just dropping the potentially-misleading ⌜-
> mode⌝ suffix, and maybe adding a ⌜use-⌝ or ⌜enable-⌝ prefix, analogous to
> the other variables I cited.
> 
> > So you don't need a buffer-local activation of dynamic-cursor-mode.
> 
> I still would need it. If (global) dynamic-cursor-mode is enabled, your code
> provides no way to prevent it from operating in a buffer in which cursor-
> type happens to be t.
> 
> I agree that having a pair of minor modes is gross. The cleanest way to do
> it is with a defcustom (for which I can do (setq-local dynamic-cursor nil)
> when necessary) with no ⌜-mode⌝ suffix, and since Emacs lacks triggers on
> variable writes, simply have the default be nil in order to avoid the
> ugliness that would be needed to avoid conflict with other uses of cursor-
> type. Then dynamic-cursor's control of cursor-type won't surprise or annoy
> users, because they only get it if they choose to enable it.
> 
> Modifying the «set» family of functions to provide triggers would be the
> ideal solution, as I described in my previous message. E.g. have a 'triggers
> property for each symbol, storing a list of functions to run when the symbol
> (i.e. dynamic variable) is set, analogous to a hook. Then dynamic-cursor
> could default to t, with no ugliness needed to avoid conflict.

I have not followed this in detail.  You've seen the approach I use in
`cursor-chg.el': just a global minor mode.  I'm wondering what else is
needed - what the use case is.

Are you trying to find a good way to let users opt out of automatic cursor
changing for particular buffers, i.e., disable the global nature of the
mode for some buffers?  If so, is that really an important feature?

I would think that needing to turn off the mode for a particular buffer
would be pretty rare, and could be accommodated just by toggling the
(global) mode temporarily when in such a buffer.  That toggling could be
manual (probably sufficient, I'm thinking) or automatic (e.g. on a mode
hook for the buffer or on `change-major-mode-hook').



reply via email to

[Prev in Thread] Current Thread [Next in Thread]