[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Swapping default input method: why so complicated?
From: |
Ted Zlatanov |
Subject: |
Re: Swapping default input method: why so complicated? |
Date: |
Wed, 08 Dec 2010 15:36:07 -0000 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) |
On Mon, 15 Nov 2010 08:08:34 +0000 (UTC) Ilya Zakharevich
<nospam-abuse@ilyaz.org> wrote:
IZ> I'm trying to do what I consider a very typical requirement: swap two
IZ> values of default input method. Unfortunately, I could not find any
IZ> documented solution (outside of info-manuals, just using f1 v and f1
IZ> f). To get it working, I was forced to inspect the sources... Is
IZ> there a simpler solution?
IZ> (defun my-cyr-switch-input-method ()
IZ> "Switch cyrillic input method between cyrillic-yawerty and
cyrillic-jcuken."
IZ> (interactive)
IZ> (let (n (o (or current-input-method
IZ> (car input-method-history)
IZ> default-input-method))
IZ> (c current-input-method))
IZ> (setq n (if (equal o "cyrillic-yawerty")
IZ> "cyrillic-jcuken"
IZ> "cyrillic-yawerty"))
IZ> (set-input-method n)
IZ> (or c (set-input-method nil))
IZ> (message "Toggled default input method to \"%s\"; toggle on/off by
Ctrl-\\" n)))
I usually use `C-u M-x toggle-input-method' which queries and has a
history of past choices. But it would be nice if there was a
`cycle-input-method' that cycled among several choices (or,
alternatively, `default-input-method' could be allowed to be a list and
then `toggle-input-method' could select the first element of the list
and then rotate the list).
Ted
Re: Swapping default input method: why so complicated?, Stefan Monnier, 2010/12/08