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 11:18:16 +0200 Organization: JURTA Message-ID: <874q6wn313.fsf@jurta.org> References: <87mzkpbs9v.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 1130842444 9879 80.91.229.2 (1 Nov 2005 10:54:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 1 Nov 2005 10:54:04 +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 11:54:02 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EWtkZ-00034y-8e for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Nov 2005 11:52:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWtTM-0002dk-CU for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Nov 2005 05:34:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EWsia-0000Tt-D6 for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 04:46:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EWshx-0000Rp-Dg for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 04:45:35 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWsYs-0000Ad-Fk for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 04:36:11 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EWsYs-0002jJ-CQ for bug-gnu-emacs@gnu.org; Tue, 01 Nov 2005 04:36:10 -0500 Original-Received: from mail.neti.ee (80-235-34-45-dsl.mus.estpak.ee [80.235.34.45]) by Relayhost1.neti.ee (Postfix) with ESMTP id C433421C5; Tue, 1 Nov 2005 11:36:16 +0200 (EET) Original-To: Hrvoje Niksic In-Reply-To: <87mzkpbs9v.fsf@xemacs.org> (Hrvoje Niksic's message of "Mon, 31 Oct 2005 16:49:48 +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:13818 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. BTW, I use this code to change cursor type and color: (defun my-change-cursor () "Change cursor color and type depending on insertion mode and input method." (set-cursor-color (cond (current-input-method "OrangeRed4") (t "black"))) (set-cursor-type (cond (overwrite-mode 'box) (t 'bar)))) (add-hook 'post-command-hook 'my-change-cursor) 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. Perhaps this patch could be installed in CVS. Index: lisp/frame.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/frame.el,v retrieving revision 1.230 diff -c -r1.230 frame.el *** lisp/frame.el 21 Oct 2005 08:27:04 -0000 1.230 --- lisp/frame.el 1 Nov 2005 09:17:22 -0000 *************** *** 903,917 **** --- 903,928 ---- (modify-frame-parameters (selected-frame) (list (cons 'cursor-color color-name)))) + (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)))) + (defun set-mouse-color (color-name) "Set the color of the mouse pointer of the selected frame to COLOR-NAME. When called interactively, prompt for the name of the color to use. -- Juri Linkov http://www.jurta.org/emacs/