emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Feature suggestion: thin cursor at end of line


From: Hrvoje Niksic
Subject: Feature suggestion: thin cursor at end of line
Date: Mon, 31 Oct 2005 17:13:19 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]