unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* changing cursor color depending on input method
@ 2004-02-15 11:58 Alexander Verbovetsky
  2004-02-19 17:07 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Verbovetsky @ 2004-02-15 11:58 UTC (permalink / raw)


Hello,

I'm using Emacs to write mathematical texts in Russian,
so I often change input method with C-\

It is very convinient if the cursor change its color
when the input mode is activated.

Currently I have the following quick and dirty code
in my .emacs:
------------------------------
(add-hook 'input-method-activate-hook
          '(lambda ()
             (if (not (eq (selected-window) (minibuffer-window)))
                 (set-cursor-color "red"))))
(add-hook 'input-method-inactivate-hook
          '(lambda ()
             (if (not (eq (selected-window) (minibuffer-window)))
                 (set-cursor-color "black"))))
------------------------------
This works in 95%, but the color isn't changed when in the minibuffer
and goes wrong after "C-x C-f" (to repear I press C-\ twice).

Does a better way to do this exist?

What would be nice, IMO, is to have red cursor if next letter is
going to be non-latin and black otherwise, in all modes and regimes.

Thanks for the help.

Alex

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

* Re: changing cursor color depending on input method
  2004-02-15 11:58 changing cursor color depending on input method Alexander Verbovetsky
@ 2004-02-19 17:07 ` Kevin Rodgers
  2004-02-19 18:38   ` Alexander Verbovetsky
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2004-02-19 17:07 UTC (permalink / raw)


Alexander Verbovetsky wrote:

> I'm using Emacs to write mathematical texts in Russian,
> so I often change input method with C-\
> 
> It is very convinient if the cursor change its color
> when the input mode is activated.
> 
> Currently I have the following quick and dirty code
> in my .emacs:
> ------------------------------
> (add-hook 'input-method-activate-hook
>           '(lambda ()
>              (if (not (eq (selected-window) (minibuffer-window)))
>                  (set-cursor-color "red"))))
> (add-hook 'input-method-inactivate-hook
>           '(lambda ()
>              (if (not (eq (selected-window) (minibuffer-window)))
>                  (set-cursor-color "black"))))
> ------------------------------
> This works in 95%, but the color isn't changed when in the minibuffer


Well, you explicitly check whether the selected window is a minibuffer window.
What happens if you leave that test out?

> and goes wrong after "C-x C-f" (to repear I press C-\ twice).
> 
> Does a better way to do this exist?
> 
> What would be nice, IMO, is to have red cursor if next letter is
> going to be non-latin and black otherwise, in all modes and regimes.


-- 
Kevin Rodgers

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

* Re: changing cursor color depending on input method
  2004-02-19 17:07 ` Kevin Rodgers
@ 2004-02-19 18:38   ` Alexander Verbovetsky
  2004-02-20 17:21     ` Alexander Verbovetsky
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Verbovetsky @ 2004-02-19 18:38 UTC (permalink / raw)


> Well, you explicitly check whether the selected window is a minibuffer
> window.  What happens if you leave that test out?

Toggling input method in minibuffer sometimes change the color of
cursor, sometimes no...

BTW, I found leim-cursor in the color-mate package at
http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/color_mate/color_mate_e.html

It basically works, but there is a proble: if I activate the input
method and do C-s, when I finish the cursor is black. It change the
color just after the first letter pressed, but not before.

Alex

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

* Re: changing cursor color depending on input method
  2004-02-19 18:38   ` Alexander Verbovetsky
@ 2004-02-20 17:21     ` Alexander Verbovetsky
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Verbovetsky @ 2004-02-20 17:21 UTC (permalink / raw)


Looks like this can be a solution (not very smart :-)

(add-hook 'post-command-hook
	  '(lambda ()
	     (set-cursor-color
	      (if current-input-method
		  "red"
		"black")))))

Alex

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

end of thread, other threads:[~2004-02-20 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-15 11:58 changing cursor color depending on input method Alexander Verbovetsky
2004-02-19 17:07 ` Kevin Rodgers
2004-02-19 18:38   ` Alexander Verbovetsky
2004-02-20 17:21     ` Alexander Verbovetsky

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