unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Hrvoje Niksic <hniksic@xemacs.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: Setting cursor-type does not trigger redisplay of cursor
Date: Tue, 01 Nov 2005 14:51:01 +0100	[thread overview]
Message-ID: <87ll08a33u.fsf@xemacs.org> (raw)
In-Reply-To: <874q6wn313.fsf@jurta.org> (Juri Linkov's message of "Tue, 01 Nov 2005 11:18:16 +0200")

Juri Linkov <juri@jurta.org> writes:

>> (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.  Also, if you modify frame parameters off post-command-hook
with your code, that might trigger redisplay in its own right.

> 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.

> + (defun set-cursor-type (cursor-type)
> +   "Set the text cursor type of the selected frame to CURSOR-TYPE.
> + When called interactively, prompt for the name of the type to use.
> + To get the frame's current cursor type, use `frame-parameters'."
> +   (interactive (list (intern (completing-read
> + 			      "Cursor type: "
> + 			      '("box" "hollow" "bar" "hbar" nil)))))
> +   (modify-frame-parameters (selected-frame)
> + 			   (list (cons 'cursor-type cursor-type))))
> + 

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

  reply	other threads:[~2005-11-01 13:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-31 15:49 Setting cursor-type does not trigger redisplay of cursor Hrvoje Niksic
2005-11-01  9:18 ` Juri Linkov
2005-11-01 13:51   ` Hrvoje Niksic [this message]
2005-11-01 20:03     ` Juri Linkov
2005-11-01 21:07       ` Hrvoje Niksic
2005-11-01 22:08         ` Juri Linkov
2005-11-02 10:27   ` Richard M. Stallman
2005-11-02 14:18     ` Hrvoje Niksic
2005-11-03  7:54       ` Juri Linkov
2005-11-03 13:50       ` Richard M. Stallman
2005-11-03 18:04         ` Hrvoje Niksic
2005-11-03  7:54     ` Juri Linkov
2005-11-03 21:41       ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ll08a33u.fsf@xemacs.org \
    --to=hniksic@xemacs.org \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).