help-gnu-emacs
[Top][All Lists]
Advanced

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

Swapping default input method: why so complicated?


From: Ilya Zakharevich
Subject: Swapping default input method: why so complicated?
Date: Wed, 08 Dec 2010 15:36:03 -0000
User-agent: slrn/0.9.8.1pl1 (Linux)

I'm trying to do what I consider a very typical requirement: swap two
values of default input method.  Unfortunately, I could not find any
documented solution (outside of info-manuals, just using f1 v and f1
f).  To get it working, I was forced to inspect the sources...  Is
there a simpler solution?

(defun my-cyr-switch-input-method ()
  "Switch cyrillic input method between cyrillic-yawerty and cyrillic-jcuken."
  (interactive)
  (let (n (o (or current-input-method
                 (car input-method-history)
                 default-input-method))
          (c current-input-method))
    (setq n (if (equal o "cyrillic-yawerty")
                "cyrillic-jcuken"
              "cyrillic-yawerty"))
    (set-input-method n)
    (or c (set-input-method nil))
    (message "Toggled default input method to \"%s\"; toggle on/off by Ctrl-\\" 
n)))

Thanks,
Ilya

P.S.  I suspect it is 23.1 - but I found no easy way to find the emacs
      version using the f1 help system - printing f1 f1 gives no hints...

      Hmm, no, directly inspecting the varaible it is 21.4.  This may
      explain why the situation is so ugly, I remember seeing many
      improvements in internationalization in 23 and 22.   Anyway, I
      need a solution working with older Emacsen...



reply via email to

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