From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.bugs Subject: bug#45005: 28.0.50; input method does not switch back Date: Tue, 8 Dec 2020 13:10:15 +0300 Message-ID: References: <87v9dc6557.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26685"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) Cc: 45005@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 08 11:14:17 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 1kma0f-0006oi-4S for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 11:14:17 +0100 Original-Received: from localhost ([::1]:42856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kma0e-00031b-06 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 05:14:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kma0Q-00031O-Pf for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 05:14:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kma0Q-00019o-IT for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 05:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kma0Q-0000U9-Ep for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 05:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jean Louis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2020 10:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45005 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45005-submit@debbugs.gnu.org id=B45005.16074223971804 (code B ref 45005); Tue, 08 Dec 2020 10:14:02 +0000 Original-Received: (at 45005) by debbugs.gnu.org; 8 Dec 2020 10:13:17 +0000 Original-Received: from localhost ([127.0.0.1]:56611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmZzh-0000T0-9c for submit@debbugs.gnu.org; Tue, 08 Dec 2020 05:13:17 -0500 Original-Received: from static.rcdrun.com ([95.85.24.50]:43217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmZzc-0000Sj-Iu for 45005@debbugs.gnu.org; Tue, 08 Dec 2020 05:13:15 -0500 Original-Received: from localhost ([::ffff:197.157.0.57]) (AUTH: PLAIN admin, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by static.rcdrun.com with ESMTPSA id 00000000002C1AF5.000000005FCF51B1.00001531; Tue, 08 Dec 2020 10:13:05 +0000 Content-Disposition: inline In-Reply-To: <87v9dc6557.fsf@mail.linkov.net> 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:195319 Archived-At: * Juri Linkov [2020-12-08 12:10]: > tags 45005 + patch That is great if it is solved not to happen again. I cannot see through. Are you sure you found the right culprit? > > 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: > > 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)) >