From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 27 16:53:24 2020 Received: (at submit) by debbugs.gnu.org; 27 Oct 2020 20:53:24 +0000 Received: from localhost ([127.0.0.1]:46114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXVy7-0007aX-En for submit@debbugs.gnu.org; Tue, 27 Oct 2020 16:53:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:53324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXVy5-0007aO-58 for submit@debbugs.gnu.org; Tue, 27 Oct 2020 16:53:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXVy4-0003zu-S5 for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 16:53:20 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:34555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXVy0-0008Gu-18 for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 16:53:20 -0400 X-Originating-IP: 91.129.102.160 Received: from mail.gandi.net (m91-129-102-160.cust.tele2.ee [91.129.102.160]) (Authenticated sender: juri@linkov.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id DFF121C0007 for ; Tue, 27 Oct 2020 20:53:12 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Transient input methods Organization: LINKOV.NET Date: Tue, 27 Oct 2020 22:43:33 +0200 Message-ID: <87o8knao7u.fsf_-_@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.183.197; envelope-from=juri@linkov.net; helo=relay5-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/27 16:53:13 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Tags: patch [Creating a separate feature request from bug#43866] >> How about making a new input method for those? It seems to me that >> C-x 8 is already too "fat". > > That may be useful, but it has a drawback compared with C-x 8. > > It is inconvenient to change input methods just for one character and > then change back. The following patch addresses such issues of the current input method implementation by providing a new feature of transient input methods. A transient input method is enabled temporarily for entering a key sequence, and is disabled automatically afterwards. The command that temporarily activates an one-off transient input method is bound to the mnemonic key 'C-x \'. A prefix key is used to select the default transient input method, e.g.: C-u C-x \ compose RET - selects the 'compose' input method as the default transient input method; C-x \ E = - activates the default transient input method, inserts the EURO SIGN character, and disables the transient input method; C-x \ ^ 3 - inserts the character SUPERSCRIPT THREE. The same with the help of the 'TeX' input method: C-u C-x \ TeX RET C-x \ \ e u r o - inserts the character EURO SIGN Also it's possible to create a new input method from the existing 'C-x 8' keymap, and set it as the default method, e.g.: C-u C-x \ iso-transl RET C-x \ * E - inserts the character EURO SIGN --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=transient-input-method.patch diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index e3155dfc52..c5a0145163 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -55,6 +55,7 @@ mule-keymap ;; Keep "C-x C-m ..." for mule specific commands. (define-key ctl-x-map "\C-m" mule-keymap) +(define-key ctl-x-map "\\" 'transient-input-method) (defvar describe-language-environment-map (let ((map (make-sparse-keymap "Describe Language Environment"))) @@ -1344,6 +1345,16 @@ default-input-method mule-input-method-string) :set-after '(current-language-environment)) +(defcustom transient-input-method nil + "Default transient input method. +This is the input method activated automatically by the command +`transient-input-method' (\\[transient-input-method])." + :link '(custom-manual "(emacs)Input Methods") + :group 'mule + :type '(choice (const nil) + mule-input-method-string) + :set-after '(current-language-environment)) + (put 'input-method-function 'permanent-local t) (defvar input-method-history nil @@ -1519,6 +1530,35 @@ set-input-method (defvar toggle-input-method-active nil "Non-nil inside `toggle-input-method'.") +(defun transient-input-method (&optional arg interactive) + "Enable transient input method for the current buffer." + (interactive "P\np") + (when (or arg (not transient-input-method)) + (let* ((default (or (car input-method-history) default-input-method)) + (input-method + (read-input-method-name + (if default "Transient input method (default %s): " "Transient input method: ") + default t))) + (setq transient-input-method input-method) + (when interactive + (customize-mark-as-set 'transient-input-method)))) + (let* ((previous-input-method current-input-method) + (history input-method-history) + (clearfun (make-symbol "clear-transient-input-method")) + (exitfun + (lambda () + (deactivate-input-method) + (when previous-input-method + (activate-input-method previous-input-method)) + (setq input-method-history history) + (remove-hook 'input-method-after-insert-chunk-hook clearfun)))) + (fset clearfun (lambda () (funcall exitfun))) + (add-hook 'input-method-after-insert-chunk-hook clearfun) + (when previous-input-method + (deactivate-input-method)) + (activate-input-method transient-input-method) + exitfun)) + (defun toggle-input-method (&optional arg interactive) "Enable or disable multilingual text input method for the current buffer. Only one input method can be enabled at any time in a given buffer. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 28 07:40:33 2020 Received: (at 44266) by debbugs.gnu.org; 28 Oct 2020 11:40:33 +0000 Received: from localhost ([127.0.0.1]:47504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXjoe-0002hT-Rh for submit@debbugs.gnu.org; Wed, 28 Oct 2020 07:40:33 -0400 Received: from quimby.gnus.org ([95.216.78.240]:41038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXjod-0002hC-B1 for 44266@debbugs.gnu.org; Wed, 28 Oct 2020 07:40:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gqH7hzmD6KtF6pdU7H6CVwK67PLjsL33mQGjFm1hqhY=; b=gsc3kYlWfI9mY+I9WEHAuuiLKc mwkCNhub5GFBX1dd7NgnTbe6XWMcEWnu+LoGA8RmS2h43XCCdynpmUvx2M4fn1As5rtdVAnPJ/9z8 uvTel4LAwkju4lZ0UHqvjfD8b7ViHsnH6nZrjxKHBIhwvDRCxFufy7UPiJmmhCrKDDuI=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXjoV-0001bK-2w; Wed, 28 Oct 2020 12:40:25 +0100 From: Lars Ingebrigtsen To: Juri Linkov Subject: Re: bug#44266: Transient input methods References: <87o8knao7u.fsf_-_@mail.linkov.net> X-Now-Playing: That Dog's _Totally Crushed Out_: "Side Part" Date: Wed, 28 Oct 2020 12:40:21 +0100 In-Reply-To: <87o8knao7u.fsf_-_@mail.linkov.net> (Juri Linkov's message of "Tue, 27 Oct 2020 22:43:33 +0200") Message-ID: <87zh46shne.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Heh, never mind -- +(define-key ctl-x-map "\\" 'transient-input-method) is in the next bug report. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44266 Cc: 44266@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Heh, never mind -- +(define-key ctl-x-map "\\" 'transient-input-method) is in the next bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 29 00:48:52 2020 Received: (at 44266) by debbugs.gnu.org; 29 Oct 2020 04:48:52 +0000 Received: from localhost ([127.0.0.1]:51512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXzro-0007wX-Gc for submit@debbugs.gnu.org; Thu, 29 Oct 2020 00:48:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXzrn-0007wK-5c for 44266@debbugs.gnu.org; Thu, 29 Oct 2020 00:48:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33938) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXzrg-0004kI-PW; Thu, 29 Oct 2020 00:48:44 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1kXzrd-0004TE-BT; Thu, 29 Oct 2020 00:48:42 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Juri Linkov In-Reply-To: <87o8knao7u.fsf_-_@mail.linkov.net> (message from Juri Linkov on Tue, 27 Oct 2020 22:43:33 +0200) Subject: Re: bug#44266: Transient input methods References: <87o8knao7u.fsf_-_@mail.linkov.net> Message-Id: Date: Thu, 29 Oct 2020 00:48:41 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44266 Cc: 44266@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] This idea looks good to me. -- Dr Richard Stallman Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 01 09:37:15 2020 Received: (at 44266) by debbugs.gnu.org; 1 Nov 2020 14:37:15 +0000 Received: from localhost ([127.0.0.1]:36110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZETr-0008QW-AX for submit@debbugs.gnu.org; Sun, 01 Nov 2020 09:37:15 -0500 Received: from quimby.gnus.org ([95.216.78.240]:35120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZETp-0008QJ-IW for 44266@debbugs.gnu.org; Sun, 01 Nov 2020 09:37:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JcPzHvg2jxPcqsfXCT2xISUNWXWYqQdzKZoVF2DSycg=; b=lmSRNQQOA8JIWNjwOGVT526Tyz 2XJZA2cQZBYY1pZxDZeiMJRPsNcKTKMVQUw8okpp8HItf9a3iD5sC++x3ay/olzD8ZIJPi8ZGlk4D gVIXw81DJnYOzTqjxbUFWufdDCwodCRM+W6wkuLDxz7KdPYN5wvOM4b/g3zP9kP6hCnY=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZETd-00013Y-J9; Sun, 01 Nov 2020 15:37:07 +0100 From: Lars Ingebrigtsen To: Juri Linkov Subject: Re: bug#44266: Transient input methods References: <87o8knao7u.fsf_-_@mail.linkov.net> X-Now-Playing: Blaine Reiniger's _Songs From The Rain Palace_: "Grapelli Hook" Date: Sun, 01 Nov 2020 15:37:00 +0100 In-Reply-To: <87o8knao7u.fsf_-_@mail.linkov.net> (Juri Linkov's message of "Tue, 27 Oct 2020 22:43:33 +0200") Message-ID: <87r1pd9m9f.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Juri Linkov writes: > The following patch addresses such issues of the current input method > implementation by providing a new feature of transient input methods. > A transient input method is enabled temporarily for entering a key sequence, > and is disabled automatically afterwards. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44266 Cc: 44266@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: > The following patch addresses such issues of the current input method > implementation by providing a new feature of transient input methods. > A transient input method is enabled temporarily for entering a key sequence, > and is disabled automatically afterwards. I like the idea, I think. But just thinking out loud without having read the code closely -- would it perhaps be even more useful to have the transient method in place until you `C-x \' again? Then you could `C-x \ ... type a couple of words in that method C-x \' I'm not at all sure, but I think that perhaps people would more often type in a couple of words than just a single key sequence? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 01 13:40:44 2020 Received: (at 44266) by debbugs.gnu.org; 1 Nov 2020 18:40:44 +0000 Received: from localhost ([127.0.0.1]:38469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZIHU-0000ND-3e for submit@debbugs.gnu.org; Sun, 01 Nov 2020 13:40:44 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:38359) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZIHS-0000Mt-K4 for 44266@debbugs.gnu.org; Sun, 01 Nov 2020 13:40:43 -0500 X-Originating-IP: 91.129.102.160 Received: from mail.gandi.net (m91-129-102-160.cust.tele2.ee [91.129.102.160]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id F0432E0004; Sun, 1 Nov 2020 18:40:34 +0000 (UTC) From: Juri Linkov To: Lars Ingebrigtsen Subject: Re: bug#44266: Transient input methods Organization: LINKOV.NET References: <87o8knao7u.fsf_-_@mail.linkov.net> <87r1pd9m9f.fsf@gnus.org> Date: Sun, 01 Nov 2020 20:24:10 +0200 In-Reply-To: <87r1pd9m9f.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 01 Nov 2020 15:37:00 +0100") Message-ID: <87blgh6jj9.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 44266 Cc: 44266@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> The following patch addresses such issues of the current input method >> implementation by providing a new feature of transient input methods. > >> A transient input method is enabled temporarily for entering a key sequence, >> and is disabled automatically afterwards. > > I like the idea, I think. But just thinking out loud without having > read the code closely -- would it perhaps be even more useful to have > the transient method in place until you `C-x \' again? > > Then you could > > `C-x \ ... type a couple of words in that method C-x \' This is achievable already by shorter key sequence: `C-\ ... type a couple of words in that method C-\' > I'm not at all sure, but I think that perhaps people would more often > type in a couple of words than just a single key sequence? This feature is intended as an equivalent of the X Compose Multi_key that inserts a single character, whereas X layouts switcher that activates a layout to insert a couple of words corresponds to Emacs non-transient input methods switched by C-\. From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 01 16:36:52 2020 Received: (at 44266) by debbugs.gnu.org; 1 Nov 2020 21:36:52 +0000 Received: from localhost ([127.0.0.1]:38792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZL1w-0004rZ-EW for submit@debbugs.gnu.org; Sun, 01 Nov 2020 16:36:52 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:34427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZL1v-0004rN-15 for 44266@debbugs.gnu.org; Sun, 01 Nov 2020 16:36:51 -0500 X-Originating-IP: 91.129.102.160 Received: from mail.gandi.net (m91-129-102-160.cust.tele2.ee [91.129.102.160]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E07FEE0009; Sun, 1 Nov 2020 21:36:43 +0000 (UTC) From: Juri Linkov To: Richard Stallman Subject: Re: bug#44266: Transient input methods Organization: LINKOV.NET References: <87o8knao7u.fsf_-_@mail.linkov.net> Date: Sun, 01 Nov 2020 23:36:06 +0200 In-Reply-To: (Richard Stallman's message of "Thu, 29 Oct 2020 00:48:41 -0400") Message-ID: <87pn4wvjy1.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 44266 Cc: 44266@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > This idea looks good to me. Now installed. From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 02 00:41:13 2020 Received: (at 44266) by debbugs.gnu.org; 2 Nov 2020 05:41:13 +0000 Received: from localhost ([127.0.0.1]:39322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZSaf-0004CI-CW for submit@debbugs.gnu.org; Mon, 02 Nov 2020 00:41:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZSad-0004C6-Fa for 44266@debbugs.gnu.org; Mon, 02 Nov 2020 00:41:12 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39809) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZSaX-0000JZ-IJ; Mon, 02 Nov 2020 00:41:05 -0500 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1kZSaW-0007nl-OW; Mon, 02 Nov 2020 00:41:04 -0500 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Lars Ingebrigtsen In-Reply-To: <87r1pd9m9f.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 01 Nov 2020 15:37:00 +0100) Subject: Re: bug#44266: Transient input methods References: <87o8knao7u.fsf_-_@mail.linkov.net> <87r1pd9m9f.fsf@gnus.org> Message-Id: Date: Mon, 02 Nov 2020 00:41:04 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 44266 Cc: 44266@debbugs.gnu.org, juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > `C-x \ ... type a couple of words in that method C-x \' > I'm not at all sure, but I think that perhaps people would more often > type in a couple of words than just a single key sequence? In my usage, I would type the occasional character, not whole words. How about if C-X \ selects the temporary input method for one character and C-x \ \ selects it for a longer period? Maybe until the next space. -- Dr Richard Stallman Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 05 15:23:09 2020 Received: (at 44266) by debbugs.gnu.org; 5 Nov 2020 20:23:10 +0000 Received: from localhost ([127.0.0.1]:54251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kalmn-0005Mf-CB for submit@debbugs.gnu.org; Thu, 05 Nov 2020 15:23:09 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:57155) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kalml-0005Ly-FZ for 44266@debbugs.gnu.org; Thu, 05 Nov 2020 15:23:08 -0500 X-Originating-IP: 91.129.97.46 Received: from mail.gandi.net (m91-129-97-46.cust.tele2.ee [91.129.97.46]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 850D8240008 for <44266@debbugs.gnu.org>; Thu, 5 Nov 2020 20:23:00 +0000 (UTC) From: Juri Linkov To: 44266@debbugs.gnu.org Subject: Re: bug#44266: Transient input methods Organization: LINKOV.NET References: <87o8knao7u.fsf_-_@mail.linkov.net> <87pn4wvjy1.fsf@mail.linkov.net> Date: Thu, 05 Nov 2020 22:14:24 +0200 In-Reply-To: <87pn4wvjy1.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 01 Nov 2020 23:36:06 +0200") Message-ID: <87k0uzy31b.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 44266 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Here is a patch that implements support for transient input methods in Isearch mode. While 'C-x 8' simply adds own keys to the default isearch-mode-map, input methods have to rely on isearch-process-search-multibyte-characters in lisp/international/isearch-x.el. Since it uses 'read-string' to read a character, currently the activated transient input method is deactivated in the minibuffer of 'read-string' that is a wrong place, so needed to introduce a new separate function deactivate-transient-input-method, thus renamed the previous function to activate-transient-input-method, and had to add more global variables. But in result everything works fine: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=isearch-transient-input-method.patch diff --git a/lisp/isearch.el b/lisp/isearch.el index 245bf452b1..4fba4370d9 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -565,6 +565,10 @@ isearch-menu-bar-map :help "Highlight all matches for current search string")) (define-key map [isearch-search-replace-separator] '(menu-item "--")) + (define-key map [isearch-transient-input-method] + '(menu-item "Turn on transient input method" + isearch-transient-input-method + :help "Turn on transient input method for search")) (define-key map [isearch-toggle-specified-input-method] '(menu-item "Turn on specific input method" isearch-toggle-specified-input-method @@ -747,6 +751,7 @@ isearch-mode-map ;; For searching multilingual text. (define-key map "\C-\\" 'isearch-toggle-input-method) (define-key map "\C-^" 'isearch-toggle-specified-input-method) + (define-key map "\C-x\\" 'isearch-transient-input-method) ;; People expect to be able to paste with the mouse. (define-key map [mouse-2] #'isearch-mouse-2) @@ -1078,6 +1083,8 @@ isearch-forward \\[isearch-toggle-specified-input-method], and specify an input method you want to use. +To activate a transient input method, type \\[isearch-transient-input-method]. + The above keys, bound in `isearch-mode-map', are often controlled by options; do \\[apropos] on search-.* to find them. Other control and meta characters terminate the search diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el index d77234ec77..b22d0e968d 100644 --- a/lisp/international/isearch-x.el +++ b/lisp/international/isearch-x.el @@ -51,6 +51,18 @@ isearch-toggle-input-method (setq input-method-function nil) (isearch-update)) +;;;###autoload +(defun isearch-transient-input-method () + "Activate transient input method in interactive search." + (interactive) + (when default-transient-input-method + (let ((overriding-terminal-local-map nil)) + (activate-transient-input-method)) + (setq isearch-input-method-function input-method-function + isearch-input-method-local-p t) + (setq input-method-function nil) + (isearch-update))) + (defvar isearch-minibuffer-local-map (let ((map (copy-keymap minibuffer-local-map))) (define-key map [with-keyboard-coding] 'isearch-with-keyboard-coding) @@ -117,6 +129,7 @@ isearch-process-search-multibyte-characters (cons last-char unread-command-events)) ;; Inherit current-input-method in a minibuffer. str (read-string prompt isearch-message 'junk-hist nil t)) + (deactivate-transient-input-method) (if (or (not str) (< (length str) (length isearch-message))) ;; All inputs were deleted while the input method ;; was working. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index dc435d9b17..7eab01d804 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -55,7 +55,7 @@ mule-keymap ;; Keep "C-x C-m ..." for mule specific commands. (define-key ctl-x-map "\C-m" mule-keymap) -(define-key ctl-x-map "\\" 'transient-input-method) +(define-key ctl-x-map "\\" 'activate-transient-input-method) (defvar describe-language-environment-map (let ((map (make-sparse-keymap "Describe Language Environment"))) @@ -1345,10 +1345,10 @@ default-input-method mule-input-method-string) :set-after '(current-language-environment)) -(defcustom transient-input-method nil +(defcustom default-transient-input-method nil "Default transient input method. This is the input method activated by the command -`transient-input-method' (\\[transient-input-method])." +`activate-transient-input-method' (\\[activate-transient-input-method])." :link '(custom-manual "(emacs)Input Methods") :group 'mule :type '(choice (const nil) @@ -1356,6 +1356,18 @@ transient-input-method :set-after '(current-language-environment) :version "28.1") +(defvar current-transient-input-method nil + "The current input method temporarily enabled by `activate-transient-input-method'. +If nil, that means no transient input method is activated now.") +(make-variable-buffer-local 'current-transient-input-method) +(put 'current-transient-input-method 'permanent-local t) + +(defvar previous-transient-input-method nil + "The input method that was active before enabling the transient input method. +If nil, that means no previous input method was active.") +(make-variable-buffer-local 'previous-transient-input-method) +(put 'previous-transient-input-method 'permanent-local t) + (put 'input-method-function 'permanent-local t) (defvar input-method-history nil @@ -1531,36 +1543,43 @@ set-input-method (defvar toggle-input-method-active nil "Non-nil inside `toggle-input-method'.") -(defun transient-input-method (&optional arg interactive) +(defun activate-transient-input-method (&optional arg interactive) "Enable a transient input method for the current buffer. -If `transient-input-method' was not yet defined, prompt for it." +If `default-transient-input-method' was not yet defined, prompt for it." (interactive "P\np") - (when (or arg (not transient-input-method)) + (when (or arg (not default-transient-input-method)) (let* ((default (or (car input-method-history) default-input-method)) (input-method (read-input-method-name (if default "Transient input method (default %s): " "Transient input method: ") default t))) - (setq transient-input-method input-method) + (setq default-transient-input-method input-method) (when interactive - (customize-mark-as-set 'transient-input-method)))) - (let* ((previous-input-method current-input-method) - (history input-method-history) - (clearfun (make-symbol "clear-transient-input-method")) + (customize-mark-as-set 'default-transient-input-method)))) + (let* ((clearfun (make-symbol "clear-transient-input-method")) (exitfun (lambda () - (deactivate-input-method) - (when previous-input-method - (activate-input-method previous-input-method)) - (setq input-method-history history) + (deactivate-transient-input-method) (remove-hook 'input-method-after-insert-chunk-hook clearfun)))) (fset clearfun (lambda () (funcall exitfun))) (add-hook 'input-method-after-insert-chunk-hook clearfun) - (when previous-input-method - (deactivate-input-method)) - (activate-input-method transient-input-method) + (let ((input-method-history input-method-history)) + (setq previous-transient-input-method current-input-method) + (when previous-transient-input-method + (deactivate-input-method)) + (activate-input-method default-transient-input-method) + (setq current-transient-input-method default-transient-input-method)) exitfun)) +(defun deactivate-transient-input-method () + (when current-transient-input-method + (let ((input-method-history input-method-history)) + (deactivate-input-method) + (when previous-transient-input-method + (activate-input-method previous-transient-input-method) + (setq previous-transient-input-method nil)) + (setq current-transient-input-method nil)))) + (defun toggle-input-method (&optional arg interactive) "Enable or disable multilingual text input method for the current buffer. Only one input method can be enabled at any time in a given buffer. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 06 03:44:54 2020 Received: (at 44266) by debbugs.gnu.org; 6 Nov 2020 08:44:54 +0000 Received: from localhost ([127.0.0.1]:55022 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaxMb-00070M-PL for submit@debbugs.gnu.org; Fri, 06 Nov 2020 03:44:53 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:60913) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaxMZ-000706-PT for 44266@debbugs.gnu.org; Fri, 06 Nov 2020 03:44:52 -0500 X-Originating-IP: 91.129.97.46 Received: from mail.gandi.net (m91-129-97-46.cust.tele2.ee [91.129.97.46]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id AE5131BF20D for <44266@debbugs.gnu.org>; Fri, 6 Nov 2020 08:44:43 +0000 (UTC) From: Juri Linkov To: 44266@debbugs.gnu.org Subject: Re: bug#44266: Transient input methods Organization: LINKOV.NET References: <87o8knao7u.fsf_-_@mail.linkov.net> <87pn4wvjy1.fsf@mail.linkov.net> <87k0uzy31b.fsf@mail.linkov.net> Date: Fri, 06 Nov 2020 10:33:30 +0200 In-Reply-To: <87k0uzy31b.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 05 Nov 2020 22:14:24 +0200") Message-ID: <87d00qlw9x.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 44266 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Here is a patch that implements support for transient input methods > in Isearch mode. Pushed to master. From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 06 04:23:35 2020 Received: (at control) by debbugs.gnu.org; 6 Nov 2020 09:23:35 +0000 Received: from localhost ([127.0.0.1]:55095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaxy3-00083H-Gf for submit@debbugs.gnu.org; Fri, 06 Nov 2020 04:23:35 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:53075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kaxy1-000832-SL for control@debbugs.gnu.org; Fri, 06 Nov 2020 04:23:34 -0500 X-Originating-IP: 91.129.97.46 Received: from mail.gandi.net (m91-129-97-46.cust.tele2.ee [91.129.97.46]) (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 7210040028 for ; Fri, 6 Nov 2020 09:23:25 +0000 (UTC) From: Juri Linkov To: control@debbugs.gnu.org Subject: Re: bug#44266: Transient input methods Organization: LINKOV.NET References: <87o8knao7u.fsf_-_@mail.linkov.net> <87pn4wvjy1.fsf@mail.linkov.net> <87k0uzy31b.fsf@mail.linkov.net> <87d00qlw9x.fsf@mail.linkov.net> Date: Fri, 06 Nov 2020 10:51:59 +0200 In-Reply-To: <87d00qlw9x.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 06 Nov 2020 10:33:30 +0200") Message-ID: <87v9eirgaw.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 44266 fixed close 44266 28.0.50 quit From unknown Sat Sep 06 13:45:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 04 Dec 2020 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator