From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel 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 Message-ID: References: <86lk19mmua.fsf@lifelogs.com> <485298A4.30000@gnu.org> <867ict8awn.fsf@lifelogs.com> <87tzfvj16y.fsf@uwakimon.sk.tsukuba.ac.jp> <86lk12zee7.fsf@lifelogs.com> <86r6acqbif.fsf@lifelogs.com> <864p76lp60.fsf_-_@lifelogs.com> <87ej66ubkv.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1215408332 25637 80.91.229.12 (7 Jul 2008 05:25:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Jul 2008 05:25:32 +0000 (UTC) Cc: juri@jurta.org, tzz@lifelogs.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 07 07:26:17 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KFjEt-000543-TH for ged-emacs-devel@m.gmane.org; Mon, 07 Jul 2008 07:26:16 +0200 Original-Received: from localhost ([127.0.0.1]:36327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KFjE2-0002Zb-GC for ged-emacs-devel@m.gmane.org; Mon, 07 Jul 2008 01:25:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KFjDv-0002Z8-1F for emacs-devel@gnu.org; Mon, 07 Jul 2008 01:25:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KFjDt-0002Xy-C4 for emacs-devel@gnu.org; Mon, 07 Jul 2008 01:25:14 -0400 Original-Received: from [199.232.76.173] (port=34365 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KFjDt-0002Xi-0J for emacs-devel@gnu.org; Mon, 07 Jul 2008 01:25:13 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]:63646) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KFjDs-0001rb-9E for emacs-devel@gnu.org; Mon, 07 Jul 2008 01:25:12 -0400 Original-Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id m675P7qj012429; Mon, 7 Jul 2008 14:25:07 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp2.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id m675P7Eu016050; Mon, 7 Jul 2008 14:25:07 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp2.aist.go.jp with ESMTP id m675P25Y023688; Mon, 7 Jul 2008 14:25:03 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken.m17n.org with local (Exim 4.69) (envelope-from ) id 1KFjDi-0002gM-Td; Mon, 07 Jul 2008 14:25:02 +0900 In-reply-to: (message from Stefan Monnier on Mon, 07 Jul 2008 00:39:34 -0400) 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) X-detected-kernel: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:100409 Archived-At: In article , Stefan Monnier 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 handa@ni.aist.go.jp ------------------------------------------------------------ From: Kenichi Handa To: rms@gnu.org In-reply-to: (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: blais@furius.ca, emacs-devel@gnu.org Subject: Re: smartquotes.el -- Insertion of unicode quotes in text documents In article , Richard Stallman 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 handa@m17n.org (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)))))