unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Feature suggestion: thin cursor at end of line
@ 2005-10-31 16:13 Hrvoje Niksic
  2005-10-31 20:27 ` Eli Zaretskii
  2005-11-07 15:34 ` Richard M. Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: Hrvoje Niksic @ 2005-10-31 16:13 UTC (permalink / raw)


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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-07 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-31 16:13 Feature suggestion: thin cursor at end of line Hrvoje Niksic
2005-10-31 20:27 ` Eli Zaretskii
2005-11-07 15:34 ` Richard M. Stallman

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