[Top][All Lists]

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

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

From: Stefan Monnier
Subject: Re: [PATCH] Proposal to change cursor appearance to indicate region activation
Date: Fri, 23 Jan 2015 15:34:43 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>>> +      (if dynamic-cursor-mode (setq cursor-type 'bar))
>> (if (and dynamic-cursor-mode (eq cursor-type t))
>> (setq cursor-type 'bar dynamic-cursor-mode--set t))
> 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.

It's a lot simpler because the buffer-local var is internal.

> (setq-default cursor-type 'bar)
> A few days later in the same Emacs session...
> (dynamic-cursor-mode)

No, because dynamic-cursor-mode can do (setq-default cursor-type t).
That's one of the advantages of a minor mode over a plain defcustom.

>> So you don't need a buffer-local activation of dynamic-cursor-mode.
> 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.

Of course it does:

   (add-hook 'foo-mode-hook (lambda () (setq-local dynamic-cursor-mode nil)))

> Modifying the «set» family of functions to provide triggers would be the
> ideal solution, as I described in my previous message.

The difference between a boolean defcustom and a global minor-mode is
pretty much that the global minor mode offers the "set triggers".


reply via email to

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