Commit 4e235781 authored by Juri Linkov's avatar Juri Linkov
Browse files

‘M-s w RET word C-s’ repeats incremental search.

* lisp/isearch.el (isearch-new-nonincremental): New variable.
(with-isearch-suspended): Bind isearch-new-nonincremental to
isearch-nonincremental, and restore it afterwards.
(isearch-forward-exit-minibuffer, isearch-reverse-exit-minibuffer):
Set isearch-new-nonincremental to nil.  (Bug#25562)
parent 3fb9f545
...@@ -638,6 +638,9 @@ Each element is an `isearch--state' struct where the slots are ...@@ -638,6 +638,9 @@ Each element is an `isearch--state' struct where the slots are
;; Should isearch be terminated after doing one search? ;; Should isearch be terminated after doing one search?
(defvar isearch-nonincremental nil) (defvar isearch-nonincremental nil)
;; New value of isearch-nonincremental after isearch-edit-string.
(defvar isearch-new-nonincremental nil)
;; New value of isearch-forward after isearch-edit-string. ;; New value of isearch-forward after isearch-edit-string.
(defvar isearch-new-forward nil) (defvar isearch-new-forward nil)
...@@ -1228,7 +1231,7 @@ If this is set inside code wrapped by the macro ...@@ -1228,7 +1231,7 @@ If this is set inside code wrapped by the macro
"Exit Isearch mode, run BODY, and reinvoke the pending search. "Exit Isearch mode, run BODY, and reinvoke the pending search.
You can update the global isearch variables by setting new values to You can update the global isearch variables by setting new values to
`isearch-new-string', `isearch-new-message', `isearch-new-forward', `isearch-new-string', `isearch-new-message', `isearch-new-forward',
`isearch-new-regexp-function', `isearch-new-case-fold'." `isearch-new-regexp-function', `isearch-new-case-fold', `isearch-new-nonincremental'."
;; This code is very hairy for several reasons, explained in the code. ;; This code is very hairy for several reasons, explained in the code.
;; Mainly, isearch-mode must be terminated while editing and then restarted. ;; Mainly, isearch-mode must be terminated while editing and then restarted.
;; If there were a way to catch any change of buffer from the minibuffer, ;; If there were a way to catch any change of buffer from the minibuffer,
...@@ -1236,7 +1239,7 @@ You can update the global isearch variables by setting new values to ...@@ -1236,7 +1239,7 @@ You can update the global isearch variables by setting new values to
;; Editing doesn't back up the search point. Should it? ;; Editing doesn't back up the search point. Should it?
`(condition-case nil `(condition-case nil
(progn (progn
(let ((isearch-nonincremental isearch-nonincremental) (let ((isearch-new-nonincremental isearch-nonincremental)
;; Locally bind all isearch global variables to protect them ;; Locally bind all isearch global variables to protect them
;; from recursive isearching. ;; from recursive isearching.
...@@ -1315,6 +1318,7 @@ You can update the global isearch variables by setting new values to ...@@ -1315,6 +1318,7 @@ You can update the global isearch variables by setting new values to
(setq isearch-string isearch-new-string (setq isearch-string isearch-new-string
isearch-message isearch-new-message isearch-message isearch-new-message
isearch-forward isearch-new-forward isearch-forward isearch-new-forward
isearch-nonincremental isearch-new-nonincremental
isearch-regexp-function isearch-new-regexp-function isearch-regexp-function isearch-new-regexp-function
isearch-case-fold-search isearch-new-case-fold isearch-case-fold-search isearch-new-case-fold
multi-isearch-current-buffer multi-isearch-current-buffer-new multi-isearch-current-buffer multi-isearch-current-buffer-new
...@@ -1405,22 +1409,22 @@ The following additional command keys are active while editing. ...@@ -1405,22 +1409,22 @@ The following additional command keys are active while editing.
(defun isearch-nonincremental-exit-minibuffer () (defun isearch-nonincremental-exit-minibuffer ()
(interactive) (interactive)
(setq isearch-nonincremental t) (setq isearch-new-nonincremental t)
(exit-minibuffer)) (exit-minibuffer))
;; Changing the value of `isearch-nonincremental' has no effect here, ;; It makes no sense to change the value of `isearch-new-nonincremental'
;; because `isearch-edit-string' ignores this change. Thus marked as obsolete. ;; from nil to t during `isearch-edit-string'. Thus marked as obsolete.
(make-obsolete 'isearch-nonincremental-exit-minibuffer 'exit-minibuffer "24.4") (make-obsolete 'isearch-nonincremental-exit-minibuffer 'exit-minibuffer "24.4")
(defun isearch-forward-exit-minibuffer () (defun isearch-forward-exit-minibuffer ()
"Resume isearching forward from the minibuffer that edits the search string." "Resume isearching forward from the minibuffer that edits the search string."
(interactive) (interactive)
(setq isearch-new-forward t) (setq isearch-new-forward t isearch-new-nonincremental nil)
(exit-minibuffer)) (exit-minibuffer))
(defun isearch-reverse-exit-minibuffer () (defun isearch-reverse-exit-minibuffer ()
"Resume isearching backward from the minibuffer that edits the search string." "Resume isearching backward from the minibuffer that edits the search string."
(interactive) (interactive)
(setq isearch-new-forward nil) (setq isearch-new-forward nil isearch-new-nonincremental nil)
(exit-minibuffer)) (exit-minibuffer))
(defun isearch-cancel () (defun isearch-cancel ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment