unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: [ulrich@a0.complang.tuwien.ac.at: blink-cursor improvement suggestion]
Date: 25 Feb 2002 10:51:06 +0100	[thread overview]
Message-ID: <5xit8lga9h.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <200202250009.g1P09cn15738@aztec.santafe.edu>

Richard Stallman <rms@gnu.org> writes:

> Do people like change?
> 
> From: Ulrich Neumerkel <ulrich@a0.complang.tuwien.ac.at>
> Subject: blink-cursor improvement suggestion
> To: bug-gnu-emacs@gnu.org
> Date: Sun, 24 Feb 2002 18:21:37 +0100 (MET)
> 

Yes, I think it is an improvement that the cursor never disappears.
However, as implemented, it doesn't work, as it doesn't preserve the
current cursor color, but uses two fixed colors.

I have code which changes the color of the cursor depending on the
current state of the buffer (e.g. read-only, overwrite mode), and
the supplied code works very poorly with that.

I think the code should remember the `true' background color of the
cursor and restore that.  In addition, it should notice if the
cursor color has changed, so it can correctly restore it.

Something like this:

(defvar blink-cursor-defined-color nil)
(defvar blink-cursor-current-color nil)
(defvar blink-cursor-alt-color "gray50")
(defvar blink-cursor-logical-off   nil)

(defun blink-cursor-timer-function ()
  "Improved but flickering timer function of timer `blink-cursor-timer'."
  (let ((bg (face-background 'cursor)))
     (when (not blink-cursor-defined-color)
        (setq blink-cursor-defined-color bg)
        (setq blink-cursor-current-color bg)
        (setq blink-cursor-logical-off t))
     (when (not (equal bg blink-cursor-current-color))
        (setq blink-cursor-defined-color bg))
     (setq blink-cursor-logical-off (not blink-cursor-logical-off))
     (setq blink-cursor-current-color 
        (if blink-cursor-logical-off
             blink-cursor-alt-color
           blink-cursor-defined-color))
     (set-face-background 'cursor blink-cursor-current-color)))

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


  reply	other threads:[~2002-02-25  9:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-25  0:09 [ulrich@a0.complang.tuwien.ac.at: blink-cursor improvement suggestion] Richard Stallman
2002-02-25  9:51 ` Kim F. Storm [this message]
2002-02-25 20:55   ` Jason Rumney
2002-02-25 20:47 ` Jason Rumney
2002-02-25 21:19   ` Kim F. Storm
2002-02-26 11:02     ` Kim F. Storm
2002-02-26 11:46       ` Juanma Barranquero
2002-02-26 12:05         ` Kim F. Storm
2002-02-26 14:25           ` Juanma Barranquero
2002-02-27  5:50       ` Richard Stallman
2002-02-27 10:12         ` Kim F. Storm
2002-02-28  4:08           ` Richard Stallman
2002-03-01 23:27           ` Kim F. Storm
2002-03-03 16:06             ` Tak Ota
2002-03-03 19:43       ` Tak Ota
2002-02-26 20:15     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5xit8lga9h.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).