[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: adding consistent extra symbols to input methods (cyrillic-*, croati
From: |
Kenichi Handa |
Subject: |
Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods |
Date: |
Mon, 07 Jul 2008 14:25:02 +0900 |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
In article <address@hidden>, Stefan Monnier <address@hidden> writes:
> > I remember that activating multiple input methods was
> > discussed a while ago on this list, but don't remember the
> > conclusion.
> :-( My memory was telling me that you had implemented and installed
> it already.
Ah!!! Now I remembered that I wrote a experimental code in
a little bit tricky way. I dig out the attached mail. But,
I completely forgot about it because there was no response
at that time.
---
Kenichi Handa
address@hidden
------------------------------------------------------------
From: Kenichi Handa <address@hidden>
To: address@hidden
In-reply-to: <address@hidden> (message from Richard Stallman on Fri, 31 Aug
2007 03:35:34 -0400)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Date: Tue, 04 Sep 2007 15:48:38 +0900
Cc: address@hidden, address@hidden
Subject: Re: smartquotes.el -- Insertion of unicode quotes in text documents
In article <address@hidden>, Richard Stallman <address@hidden> writes:
> What kind of user interface should be provided for
> activating and deactivating multiple input methods?
> Here's one idea: the user enables and disables one input method,
> directly, and the others are enabled or disabled by a Lisp interface.
> That Lisp interface can be called by other commands.
> Does this solve that one problem?
Yes. I implemented it as an add-on code (with a little bit
tricky way). Once it is found that it works well, I'll
merge the code into mule-cmds.el while cleaning the code.
Please try the attached code with the latest
emacs-unicode-2. The Lisp interfaces are the functions
activate-preposition-input-method and
inactivate-preposition-input-method.
---
Kenichi Handa
address@hidden
(defvar local-input-method-list nil
"List of local preposition input methods.")
(make-variable-buffer-local 'local-input-method-list)
(defvar global-input-method-list nil
"List of global preposition input methods.")
(defvar normal-input-method nil
"Currently active normal (i.e. non-preposion) input method.")
(defun multi-input-method-function (event)
"Input method function used while some preposition input method is active."
(let ((disable-input-method-hook t)
unread-command-events)
(dolist (elt (append global-input-method-list
local-input-method-list))
(let (input-method-history default-input-method)
(activate-input-method elt)
(setq unread-command-events
(nreverse (funcall input-method-function event)))
(setq event (car unread-command-events)
unread-command-events (cdr unread-command-events))))
(let (input-method-history)
(inactivate-input-method))
(setq current-input-method nil
current-input-method-title nil)
(unwind-protect
(if normal-input-method
(progn
(activate-input-method normal-input-method)
(append (funcall input-method-function event)
unread-command-events))
(cons event unread-command-events))
(setq input-method-function 'multi-input-method-function))))
;; If non-nil, disable input-method-hook.
(defvar disable-input-method-hook nil)
;; A function for input-method-active-hook used while some preposition
;; input method is active.
(defun input-method-activate-hook ()
(unless disable-input-method-hook
(setq normal-input-method current-input-method)
(if (or local-input-method-list global-input-method-list)
(setq input-method-function 'multi-input-method-function))))
;; A function for input-method-inactivate-hook used while some
;; preposition input method is active.
(defun input-method-inactivate-hook ()
(unless disable-input-method-hook
(setq normal-input-method nil)
(if (or local-input-method-list global-input-method-list)
(setq input-method-function 'multi-input-method-function))))
(defun activate-preposition-input-method (input-method global)
"Activate a preposition INPUT-METHOD.
INPUT-METHOD is handled before a normal input method.
If the second arg GLOBAL is non-nil, activate it for all buffers.
Otherwise, activate it only for the current buffer."
(if (and input-method (symbolp input-method))
(setq input-method (symbol-name input-method)))
(or (assoc input-method input-method-alist)
(error "Unknown input method: %s" input-method))
(unless (assoc-string input-method
(if global global-input-method-list
local-input-method-list))
(or global-input-method-list
local-input-method-list
(progn
(add-hook 'input-method-activate-hook
'input-method-activate-hook)
(add-hook 'input-method-inactivate-hook
'input-method-inactivate-hook)))
(setq normal-input-method current-input-method)
(if global
(progn
(push input-method global-input-method-list)
(setq-default input-method-function 'multi-input-method-function))
(push input-method local-input-method-list))
(make-local-variable 'input-method-function)
(setq input-method-function 'multi-input-method-function)))
(defun inactivate-preposition-input-method (input-method global)
"Inactivate a proposition INPUT-METHOD.
If the second arg GLOBAL is non-nil, inactivate it for all buffers.
Otherwise, inactivate it only for the curren buffer."
(if (and input-method (symbolp input-method))
(setq input-method (symbol-name input-method)))
(if global
(setq global-input-method-list
(delete input-method global-input-method-list))
(setq local-input-method-list
(delete input-method local-input-method-list)))
(or global-input-method-list
local-input-method-list
(progn
(remove-hook 'input-method-activate-hook
'input-method-activate-hook)
(remove-hook 'input-method-inactivate-hook
'input-method-inactivate-hook)
(setq input-method-function nil)
(when normal-input-method
(inactivate-input-method)
(activate-input-method normal-input-method)))))
_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, (continued)
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Kenichi Handa, 2008/07/09
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Juri Linkov, 2008/07/09
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Kenichi Handa, 2008/07/09
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Stefan Monnier, 2008/07/09
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Juri Linkov, 2008/07/09
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Miles Bader, 2008/07/09
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Juri Linkov, 2008/07/10
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Miles Bader, 2008/07/10
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Kenichi Handa, 2008/07/06
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Stefan Monnier, 2008/07/07
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods,
Kenichi Handa <=
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Ted Zlatanov, 2008/07/07
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Juri Linkov, 2008/07/07
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Eli Zaretskii, 2008/07/13
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Miles Bader, 2008/07/13
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Juri Linkov, 2008/07/13
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Miles Bader, 2008/07/13
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Kenichi Handa, 2008/07/14
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Juri Linkov, 2008/07/14
- Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods, Kenichi Handa, 2008/07/14
- Re: multiple input methods (was: adding consistent extra symbols to input methods), Juri Linkov, 2008/07/28
- Prev by Date:
Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods
- Next by Date:
Re: gdb-ui, dedicated windows
- Previous by thread:
Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods
- Next by thread:
Re: adding consistent extra symbols to input methods (cyrillic-*, croatian-*, slov*, czech-* etc.) input methods
- Index(es):