From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: Re: Setting cursor-type does not trigger redisplay of cursor Date: Tue, 01 Nov 2005 22:03:56 +0200 Organization: JURTA Message-ID: <87oe54hyxn.fsf@jurta.org> References: <87mzkpbs9v.fsf@xemacs.org> <874q6wn313.fsf@jurta.org> <87ll08a33u.fsf@xemacs.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1130878820 2755 80.91.229.2 (1 Nov 2005 21:00:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 1 Nov 2005 21:00:20 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 01 22:00:19 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EX3D8-0007Ks-Um for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Nov 2005 21:58:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EX3D8-0005iH-Bh for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Nov 2005 15:58:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EX3D6-0005iA-Ou for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 15:58:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EX3D4-0005hx-Qh for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 15:58:24 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EX3D4-0005hu-Lw for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 15:58:22 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EX3D4-0003HA-T3 for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 15:58:23 -0500 Original-Received: from mail.neti.ee (80-235-38-199-dsl.mus.estpak.ee [80.235.38.199]) by Relayhost1.neti.ee (Postfix) with ESMTP id C366B16C1; Tue, 1 Nov 2005 22:58:31 +0200 (EET) Original-To: Hrvoje Niksic In-Reply-To: <87ll08a33u.fsf@xemacs.org> (Hrvoje Niksic's message of "Tue, 01 Nov 2005 14:51:01 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:13832 Archived-At: >>> (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/