bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Setting cursor-type does not trigger redisplay of cursor


From: Juri Linkov
Subject: Re: Setting cursor-type does not trigger redisplay of cursor
Date: Tue, 01 Nov 2005 22:03:56 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>>> (defun set-cursor-adaptive ()
>>>   (setq cursor-type (if (eq (char-after (point)) ?\n) '(bar . 5) t)))
>>> (add-hook 'post-command-hook 'set-cursor-adaptive)
>>>
>>> However, it turns out that this doesn't work as well as it should --
>>> apparently changing `cursor-type' does not affect the shape of the
>>> cursor until after it is redrawn, either by changing the position of
>>> point, or by redrawing the frame.
>>
>> As I see, this works correctly in the CVS version.
>
> Are you sure?  It sometimes requires a bit more testing for the bug to
> appear.

Have you tested it in Emacs CVS?  I tried your recipe in Emacs 21.4
where I can reproduce this bug.  But in Emacs CVS the same recipe
works correctly.

>> There is no function `set-cursor-type' in CVS.  I use the patch
>> below.  Note that it changes frame parameters instead of the
>> buffer-local variable `cursor-type'.  I think this causes less
>> trouble.
>
> Why?  If anything, cursor type should be *window*-local.  Then, if you
> change the cursor based on buffer contents (as my hook does), it is
> wrong to modify it for the entire frame.  After all, frames can and do
> have more than one window.

Maybe, window-local is a better scope, but currently cursor type can
be either buffer-local or frame-local.

> Setting the cursor type interactively does not appear useful.
> This command would IMHO needlessly clutter the command namespace.

It is not very useful, but there is already a similar interactive
command `set-cursor-color', and I see no reason to have
`set-cursor-color', and not to have `set-cursor-type'.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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