From b71be20eaff7b3b13c67515e7919d36ecbd7b22b Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 9 Dec 2020 21:30:47 +0200 Subject: [PATCH] Remove isearch-input-method-local-p and always set buffer-local input-method * lisp/isearch.el (isearch-input-method-local-p): Remove defvar. (isearch-mode): Don't set isearch-input-method-local-p. Set buffer-local input-method-function to nil. (isearch-done): When isearch-input-method-function is still non-nil, set the buffer-local value of input-method-function. (Bug#45005) * lisp/international/isearch-x.el (isearch-toggle-specified-input-method) (isearch-toggle-input-method, isearch-transient-input-method): Don't set isearch-input-method-local-p to t. Set buffer-local input-method-function to nil. * lisp/language/korea-util.el (isearch-toggle-korean-input-method) (isearch-hangul-switch-symbol-ksc, isearch-hangul-switch-hanja): Don't set isearch-input-method-local-p to t. Set buffer-local input-method-function to nil. --- lisp/international/isearch-x.el | 15 ++++++--------- lisp/isearch.el | 13 +++---------- lisp/language/korea-util.el | 15 ++++++--------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el index f50f86a035f..867a3d86973 100644 --- a/lisp/international/isearch-x.el +++ b/lisp/international/isearch-x.el @@ -35,9 +35,8 @@ (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 input-method-function nil) + (setq isearch-input-method-function input-method-function) + (setq-local input-method-function nil) (isearch-update)) ;;;###autoload @@ -46,9 +45,8 @@ (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 input-method-function nil) + (setq isearch-input-method-function input-method-function) + (setq-local input-method-function nil) (isearch-update)) ;;;###autoload @@ -57,9 +55,8 @@ (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 input-method-function nil) + (setq isearch-input-method-function input-method-function) + (setq-local input-method-function nil) (isearch-update)) (defvar isearch-minibuffer-local-map diff --git a/lisp/isearch.el b/lisp/isearch.el index a0aa250c4b6..0d5c480c8d4 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -965,10 +965,6 @@ Each element is an `isearch--state' struct where the slots are ;; 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 @@ used to set the value of `isearch-regexp-function'." 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,9 +1254,7 @@ used to set the value of `isearch-regexp-function'." ;; 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) + (setq-local input-method-function nil) (looking-at "") (setq isearch-window-configuration @@ -1418,8 +1411,8 @@ NOPUSH is t and EDIT is t." (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/language/korea-util.el b/lisp/language/korea-util.el index 3821785da73..36e1d20a22f 100644 --- a/lisp/language/korea-util.el +++ b/lisp/language/korea-util.el @@ -70,27 +70,24 @@ (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 input-method-function nil) + (setq isearch-input-method-function input-method-function) + (setq-local input-method-function nil) (isearch-update)) (defun 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 input-method-function nil) + (setq isearch-input-method-function input-method-function) + (setq-local input-method-function nil) (isearch-update)) (defun 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 input-method-function nil) + (setq isearch-input-method-function input-method-function) + (setq-local input-method-function nil) (isearch-update)) ;; Information for setting and exiting Korean environment. -- 2.39.2