From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45005: 28.0.50; input method does not switch back Date: Tue, 08 Dec 2020 10:43:48 +0200 Organization: LINKOV.NET Message-ID: <87v9dc6557.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28207"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 45005@debbugs.gnu.org To: Jean Louis Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 08 10:11:51 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmZ2E-0007F3-Jh for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 10:11:50 +0100 Original-Received: from localhost ([::1]:43548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmZ2D-0004tR-Fo for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 04:11:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmZ1V-0004sp-N5 for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 04:11:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmZ1S-0003iT-UK for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 04:11:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kmZ1S-0005Kz-PX for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 04:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2020 09:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45005 X-GNU-PR-Package: emacs Original-Received: via spool by 45005-submit@debbugs.gnu.org id=B45005.160741863520471 (code B ref 45005); Tue, 08 Dec 2020 09:11:02 +0000 Original-Received: (at 45005) by debbugs.gnu.org; 8 Dec 2020 09:10:35 +0000 Original-Received: from localhost ([127.0.0.1]:56551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmZ11-0005K6-20 for submit@debbugs.gnu.org; Tue, 08 Dec 2020 04:10:35 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:44623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmZ0x-0005JN-1t; Tue, 08 Dec 2020 04:10:31 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 59CA2C0006; Tue, 8 Dec 2020 09:10:24 +0000 (UTC) In-Reply-To: (Jean Louis's message of "Wed, 02 Dec 2020 13:49:50 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:195316 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit tags 45005 + patch quit > This is report for which I do not think that it is reproducible as I > tried to invoke it with emacs -Q and I would need to perform some work > from which I could not find out what invokes the bug. > > My other input method is by default set to german-postfix. > > My Emacs uptime now is about 1 day, 15 hours. About 15 hours ago, I > could observe that I cannot turn off the input method with C-\ but > that it remains engaged. > > Mode line may show DE can write ü ö ä and some words in other languages collide. I am using > other few input methods for other languages, then it becomes difficult > writing English as some combinations of letters get converted in other > letters, then I have to delete, etc. If I make new session it will of > course be alright. For my last 5 years I have not encountered this > situation that input-method kind of remains turned on even if I turn > it off. This problem can happen only when the default global value of input-method-function is changed, so it still translates keys while the input method is disabled. When an input method is activated, 'quail-activate' uses (setq-local input-method-function #'quail-input-method) to set the buffer-local value, and when an input method is deactivated, removes the buffer-local value: (kill-local-variable 'input-method-function) So it doesn't change its default global value. The only place on the whole Emacs tree that can change the default global value of input-method-function is 'isearch-done': (if isearch-input-method-local-p (setq input-method-function isearch-input-method-function) (kill-local-variable 'input-method-function)) Many functions in international/isearch-x.el set isearch-input-method-local-p to 't', but never set it to 'nil'. So when after using an input method in Isearch (enabling and disabling it) on exiting Isearch, this code always changes the default global value of input-method-function. Instead of this, this code should use the same logic as used by 'quail-activate': when a previous input method should be re-activated, then set its buffer-local value, otherwise use kill-local-variable. This logic will obsolete the variable isearch-input-method-local-p: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=isearch-input-method-local-p.patch diff --git a/lisp/isearch.el b/lisp/isearch.el index a0aa250c4b..69c553deda 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -965,10 +965,6 @@ isearch-hidden ;; The value of input-method-function when isearch is invoked. (defvar isearch-input-method-function nil) -;; A flag to tell if input-method-function is locally bound when -;; isearch is invoked. -(defvar isearch-input-method-local-p nil) - (defvar isearch--saved-overriding-local-map nil) ;; Minor-mode-alist changes - kind of redundant with the @@ -1238,7 +1234,6 @@ isearch-mode search-ring-yank-pointer nil isearch-opened-overlays nil isearch-input-method-function input-method-function - isearch-input-method-local-p (local-variable-p 'input-method-function) regexp-search-ring-yank-pointer nil isearch-pre-scroll-point nil @@ -1259,8 +1254,6 @@ isearch-mode ;; We must bypass input method while reading key. When a user type ;; printable character, appropriate input method is turned on in ;; minibuffer to read multibyte characters. - (or isearch-input-method-local-p - (make-local-variable 'input-method-function)) (setq input-method-function nil) (looking-at "") @@ -1418,8 +1411,8 @@ isearch-done (set-window-group-start (selected-window) found-start t)))) (setq isearch-mode nil) - (if isearch-input-method-local-p - (setq input-method-function isearch-input-method-function) + (if isearch-input-method-function + (setq-local input-method-function isearch-input-method-function) (kill-local-variable 'input-method-function)) (if isearch-tool-bar-old-map diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el index f50f86a035..94716721b5 100644 --- a/lisp/international/isearch-x.el +++ b/lisp/international/isearch-x.el @@ -35,8 +35,7 @@ isearch-toggle-specified-input-method (interactive) (let ((overriding-terminal-local-map nil)) (toggle-input-method t)) - (setq isearch-input-method-function input-method-function - isearch-input-method-local-p t) + (setq isearch-input-method-function input-method-function) (setq input-method-function nil) (isearch-update)) @@ -46,8 +45,7 @@ isearch-toggle-input-method (interactive) (let ((overriding-terminal-local-map nil)) (toggle-input-method)) - (setq isearch-input-method-function input-method-function - isearch-input-method-local-p t) + (setq isearch-input-method-function input-method-function) (setq input-method-function nil) (isearch-update)) @@ -57,8 +55,7 @@ isearch-transient-input-method (interactive) (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 isearch-input-method-function input-method-function) (setq input-method-function nil) (isearch-update)) diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el index 3821785da7..13cd6a015d 100644 --- a/lisp/language/korea-util.el +++ b/lisp/language/korea-util.el @@ -70,8 +70,7 @@ isearch-toggle-korean-input-method (interactive) (let ((overriding-terminal-local-map nil)) (toggle-korean-input-method)) - (setq isearch-input-method-function input-method-function - isearch-input-method-local-p t) + (setq isearch-input-method-function input-method-function) (setq input-method-function nil) (isearch-update)) @@ -79,8 +78,7 @@ isearch-hangul-switch-symbol-ksc (interactive) (let ((overriding-terminal-local-map nil)) (quail-hangul-switch-symbol-ksc)) - (setq isearch-input-method-function input-method-function - isearch-input-method-local-p t) + (setq isearch-input-method-function input-method-function) (setq input-method-function nil) (isearch-update)) @@ -88,8 +86,7 @@ isearch-hangul-switch-hanja (interactive) (let ((overriding-terminal-local-map nil)) (quail-hangul-switch-hanja)) - (setq isearch-input-method-function input-method-function - isearch-input-method-local-p t) + (setq isearch-input-method-function input-method-function) (setq input-method-function nil) (isearch-update)) --=-=-=--