aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2017-02-15 01:28:15 +0200
committerJuri Linkov2017-02-15 01:28:15 +0200
commit4e23578127fcb08d8289567dbb7ec3ad12e09382 (patch)
tree2b22ca6c4142a1d0c9bf6c96b692ca5941276bbd
parent3fb9f5452fbd0458f90115b0a95151b8e7a482a1 (diff)
downloademacs-4e23578127fcb08d8289567dbb7ec3ad12e09382.tar.gz
emacs-4e23578127fcb08d8289567dbb7ec3ad12e09382.zip
‘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)
-rw-r--r--lisp/isearch.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 4b35f256644..526243554b0 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -638,6 +638,9 @@ Each element is an `isearch--state' struct where the slots are
638;; Should isearch be terminated after doing one search? 638;; Should isearch be terminated after doing one search?
639(defvar isearch-nonincremental nil) 639(defvar isearch-nonincremental nil)
640 640
641;; New value of isearch-nonincremental after isearch-edit-string.
642(defvar isearch-new-nonincremental nil)
643
641;; New value of isearch-forward after isearch-edit-string. 644;; New value of isearch-forward after isearch-edit-string.
642(defvar isearch-new-forward nil) 645(defvar isearch-new-forward nil)
643 646
@@ -1228,7 +1231,7 @@ If this is set inside code wrapped by the macro
1228 "Exit Isearch mode, run BODY, and reinvoke the pending search. 1231 "Exit Isearch mode, run BODY, and reinvoke the pending search.
1229You can update the global isearch variables by setting new values to 1232You can update the global isearch variables by setting new values to
1230`isearch-new-string', `isearch-new-message', `isearch-new-forward', 1233`isearch-new-string', `isearch-new-message', `isearch-new-forward',
1231`isearch-new-regexp-function', `isearch-new-case-fold'." 1234`isearch-new-regexp-function', `isearch-new-case-fold', `isearch-new-nonincremental'."
1232 ;; This code is very hairy for several reasons, explained in the code. 1235 ;; This code is very hairy for several reasons, explained in the code.
1233 ;; Mainly, isearch-mode must be terminated while editing and then restarted. 1236 ;; Mainly, isearch-mode must be terminated while editing and then restarted.
1234 ;; If there were a way to catch any change of buffer from the minibuffer, 1237 ;; 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 ;; Editing doesn't back up the search point. Should it? 1239 ;; Editing doesn't back up the search point. Should it?
1237 `(condition-case nil 1240 `(condition-case nil
1238 (progn 1241 (progn
1239 (let ((isearch-nonincremental isearch-nonincremental) 1242 (let ((isearch-new-nonincremental isearch-nonincremental)
1240 1243
1241 ;; Locally bind all isearch global variables to protect them 1244 ;; Locally bind all isearch global variables to protect them
1242 ;; from recursive isearching. 1245 ;; from recursive isearching.
@@ -1315,6 +1318,7 @@ You can update the global isearch variables by setting new values to
1315 (setq isearch-string isearch-new-string 1318 (setq isearch-string isearch-new-string
1316 isearch-message isearch-new-message 1319 isearch-message isearch-new-message
1317 isearch-forward isearch-new-forward 1320 isearch-forward isearch-new-forward
1321 isearch-nonincremental isearch-new-nonincremental
1318 isearch-regexp-function isearch-new-regexp-function 1322 isearch-regexp-function isearch-new-regexp-function
1319 isearch-case-fold-search isearch-new-case-fold 1323 isearch-case-fold-search isearch-new-case-fold
1320 multi-isearch-current-buffer multi-isearch-current-buffer-new 1324 multi-isearch-current-buffer multi-isearch-current-buffer-new
@@ -1405,22 +1409,22 @@ The following additional command keys are active while editing.
1405 1409
1406(defun isearch-nonincremental-exit-minibuffer () 1410(defun isearch-nonincremental-exit-minibuffer ()
1407 (interactive) 1411 (interactive)
1408 (setq isearch-nonincremental t) 1412 (setq isearch-new-nonincremental t)
1409 (exit-minibuffer)) 1413 (exit-minibuffer))
1410;; Changing the value of `isearch-nonincremental' has no effect here, 1414;; It makes no sense to change the value of `isearch-new-nonincremental'
1411;; because `isearch-edit-string' ignores this change. Thus marked as obsolete. 1415;; from nil to t during `isearch-edit-string'. Thus marked as obsolete.
1412(make-obsolete 'isearch-nonincremental-exit-minibuffer 'exit-minibuffer "24.4") 1416(make-obsolete 'isearch-nonincremental-exit-minibuffer 'exit-minibuffer "24.4")
1413 1417
1414(defun isearch-forward-exit-minibuffer () 1418(defun isearch-forward-exit-minibuffer ()
1415 "Resume isearching forward from the minibuffer that edits the search string." 1419 "Resume isearching forward from the minibuffer that edits the search string."
1416 (interactive) 1420 (interactive)
1417 (setq isearch-new-forward t) 1421 (setq isearch-new-forward t isearch-new-nonincremental nil)
1418 (exit-minibuffer)) 1422 (exit-minibuffer))
1419 1423
1420(defun isearch-reverse-exit-minibuffer () 1424(defun isearch-reverse-exit-minibuffer ()
1421 "Resume isearching backward from the minibuffer that edits the search string." 1425 "Resume isearching backward from the minibuffer that edits the search string."
1422 (interactive) 1426 (interactive)
1423 (setq isearch-new-forward nil) 1427 (setq isearch-new-forward nil isearch-new-nonincremental nil)
1424 (exit-minibuffer)) 1428 (exit-minibuffer))
1425 1429
1426(defun isearch-cancel () 1430(defun isearch-cancel ()