From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hrvoje Niksic Newsgroups: gmane.emacs.devel Subject: Feature suggestion: thin cursor at end of line Date: Mon, 31 Oct 2005 17:13:19 +0100 Message-ID: <877jbtbr6o.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 1130775367 28188 80.91.229.2 (31 Oct 2005 16:16:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 31 Oct 2005 16:16:07 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 31 17:16:06 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EWcIe-0006w1-99 for ged-emacs-devel@m.gmane.org; Mon, 31 Oct 2005 17:14:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWcIb-0004M6-Tf for ged-emacs-devel@m.gmane.org; Mon, 31 Oct 2005 11:14:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EWcHo-00041o-4z for emacs-devel@gnu.org; Mon, 31 Oct 2005 11:13:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EWcHk-0003yy-Nx for emacs-devel@gnu.org; Mon, 31 Oct 2005 11:13:27 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWcHk-0003ya-1e for emacs-devel@gnu.org; Mon, 31 Oct 2005 11:13:24 -0500 Original-Received: from [195.29.150.97] (helo=ls405.htnet.hr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EWcHj-0003Eg-Da for emacs-devel@gnu.org; Mon, 31 Oct 2005 11:13:23 -0500 Original-Received: from ls422.t-com.hr (ls422.t-com.hr [195.29.150.237]) by ls405.htnet.hr (0.0.0/8.12.10) with ESMTP id j9VGDLWj022118 for ; Mon, 31 Oct 2005 17:13:21 +0100 Original-Received: from ls422.t-com.hr (localhost.localdomain [127.0.0.1]) by ls422.t-com.hr (Qmlai) with ESMTP id 5BC68988043 for ; Mon, 31 Oct 2005 17:13:21 +0100 (CET) X-Envelope-Sender: hniksic@xemacs.org Original-Received: from ls422.t-com.hr (localhost.localdomain [127.0.0.1]) by ls422.t-com.hr (Qmlai) with ESMTP id 5988F988042 for ; Mon, 31 Oct 2005 17:13:21 +0100 (CET) Original-Received: from localhost.localdomain (83-131-64-105.adsl.net.t-com.hr [83.131.64.105]) by ls422.t-com.hr (Qmlai) with ESMTP id B8EA58B807C for ; Mon, 31 Oct 2005 17:13:20 +0100 (CET) Original-Received: by localhost.localdomain (Postfix, from userid 1000) id B249A380028; Mon, 31 Oct 2005 17:13:19 +0100 (CET) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45181 Archived-At: XEmacs has a neat feature that it draws a slightly thinner cursor when point is at the end of line or buffer. This subtle visual cue allows easy detection of whether the point is really at end of line or there is more whitespace (or otherwise invisible text) after it. This Lisp code implements a mostly equivalent Lisp-only substitute, but I'd prefer to see this supported within Emacs itself, so that one doesn't clutter post-command-hook and so that it works correctly while, for example, dragging the point with the mouse and in other situations where post-command-hook is not run. (defun set-cursor-adaptive () "Make the cursor five pixels wide if it is at end of line or buffer." (let ((type (let ((c (char-after (point)))) (if (or (eq c ?\n) (null c)) '(bar . 5) t)))) (or (equal cursor-type type) (progn (setq cursor-type type) (sit-for 0))))) (add-hook 'post-command-hook 'set-cursor-adaptive)