1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Restore isearch correctly after M-e in special modes (bug#30187)

* lisp/isearch.el (isearch-suspended): New defvar.
(with-isearch-suspended): Set isearch-suspended to t
at the beginning, then set it back to nil at the end.

* lisp/comint.el (comint-history-isearch-backward)
(comint-history-isearch-backward-regexp): Set global value of
comint-history-isearch to t.
(comint-history-isearch-end): Reevaluate
comint-history-isearch when isearch-edit-string finishes.

* lisp/dired-aux.el (dired-isearch-filenames)
(dired-isearch-filenames-regexp): Set global value of
dired-isearch-filenames to t.
(dired-isearch-filenames-end): Reevaluate
dired-isearch-filenames when isearch-edit-string finishes.
This commit is contained in:
Juri Linkov 2018-01-23 00:14:10 +02:00
parent 4aabb425db
commit 71e458505f
3 changed files with 21 additions and 10 deletions

View file

@ -1233,6 +1233,8 @@ If this is set inside code wrapped by the macro
(define-obsolete-variable-alias 'isearch-new-word
'isearch-new-regexp-function "25.1")
(defvar isearch-suspended nil)
(defmacro with-isearch-suspended (&rest body)
"Exit Isearch mode, run BODY, and reinvoke the pending search.
You can update the global isearch variables by setting new values to
@ -1299,6 +1301,8 @@ You can update the global isearch variables by setting new values to
isearch-original-minibuffer-message-timeout)
old-point old-other-end)
(setq isearch-suspended t)
;; Actually terminate isearching until editing is done.
;; This is so that the user can do anything without failure,
;; like switch buffers and start another isearch, and return.
@ -1313,6 +1317,8 @@ You can update the global isearch variables by setting new values to
(unwind-protect
(progn ,@body)
(setq isearch-suspended nil)
;; Always resume isearching by restarting it.
(isearch-mode isearch-forward
isearch-regexp
@ -1374,6 +1380,7 @@ You can update the global isearch variables by setting new values to
(message "")))))
(quit ; handle abort-recursive-edit
(setq isearch-suspended nil)
(isearch-abort) ;; outside of let to restore outside global values
)))