diff options
| author | Juri Linkov | 2018-11-17 23:31:52 +0200 |
|---|---|---|
| committer | Juri Linkov | 2018-11-17 23:31:52 +0200 |
| commit | 8a481d29706eaf023ca786e3b905d397fbcfd685 (patch) | |
| tree | 768a2ad9aad825649fa0f583f91804d100a5985e | |
| parent | 81f0e05a02013bd1c9ea177e234561348b108578 (diff) | |
| download | emacs-8a481d29706eaf023ca786e3b905d397fbcfd685.tar.gz emacs-8a481d29706eaf023ca786e3b905d397fbcfd685.zip | |
Don't exit Isearch while resizing windows with mouse (bug#32990)
* lisp/isearch.el (isearch-mouse-leave-buffer): New function.
(isearch-mode): Use isearch-mouse-leave-buffer instead of
isearch-done for mouse-leave-buffer-hook.
(isearch-done): Remove isearch-mouse-leave-buffer from
mouse-leave-buffer-hook.
(enlarge-window-horizontally, shrink-window-horizontally)
(shrink-window, mouse-drag-mode-line, mouse-drag-vertical-line):
Put property isearch-scroll with t.
(isearch-mode): Reset isearch-pre-scroll-point and
isearch-pre-move-point to nil for the case when Isearch exits
between isearch-pre-command-hook (that sets these values) and
isearch-post-command-hook (that used to reset them).
| -rw-r--r-- | lisp/isearch.el | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 035ff693275..87f4d495f4e 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -973,6 +973,9 @@ used to set the value of `isearch-regexp-function'." | |||
| 973 | isearch-input-method-local-p (local-variable-p 'input-method-function) | 973 | isearch-input-method-local-p (local-variable-p 'input-method-function) |
| 974 | regexp-search-ring-yank-pointer nil | 974 | regexp-search-ring-yank-pointer nil |
| 975 | 975 | ||
| 976 | isearch-pre-scroll-point nil | ||
| 977 | isearch-pre-move-point nil | ||
| 978 | |||
| 976 | ;; Save the original value of `minibuffer-message-timeout', and | 979 | ;; Save the original value of `minibuffer-message-timeout', and |
| 977 | ;; set it to nil so that isearch's messages don't get timed out. | 980 | ;; set it to nil so that isearch's messages don't get timed out. |
| 978 | isearch-original-minibuffer-message-timeout minibuffer-message-timeout | 981 | isearch-original-minibuffer-message-timeout minibuffer-message-timeout |
| @@ -1015,7 +1018,7 @@ used to set the value of `isearch-regexp-function'." | |||
| 1015 | 1018 | ||
| 1016 | (add-hook 'pre-command-hook 'isearch-pre-command-hook) | 1019 | (add-hook 'pre-command-hook 'isearch-pre-command-hook) |
| 1017 | (add-hook 'post-command-hook 'isearch-post-command-hook) | 1020 | (add-hook 'post-command-hook 'isearch-post-command-hook) |
| 1018 | (add-hook 'mouse-leave-buffer-hook 'isearch-done) | 1021 | (add-hook 'mouse-leave-buffer-hook 'isearch-mouse-leave-buffer) |
| 1019 | (add-hook 'kbd-macro-termination-hook 'isearch-done) | 1022 | (add-hook 'kbd-macro-termination-hook 'isearch-done) |
| 1020 | 1023 | ||
| 1021 | ;; isearch-mode can be made modal (in the sense of not returning to | 1024 | ;; isearch-mode can be made modal (in the sense of not returning to |
| @@ -1112,7 +1115,7 @@ NOPUSH is t and EDIT is t." | |||
| 1112 | 1115 | ||
| 1113 | (remove-hook 'pre-command-hook 'isearch-pre-command-hook) | 1116 | (remove-hook 'pre-command-hook 'isearch-pre-command-hook) |
| 1114 | (remove-hook 'post-command-hook 'isearch-post-command-hook) | 1117 | (remove-hook 'post-command-hook 'isearch-post-command-hook) |
| 1115 | (remove-hook 'mouse-leave-buffer-hook 'isearch-done) | 1118 | (remove-hook 'mouse-leave-buffer-hook 'isearch-mouse-leave-buffer) |
| 1116 | (remove-hook 'kbd-macro-termination-hook 'isearch-done) | 1119 | (remove-hook 'kbd-macro-termination-hook 'isearch-done) |
| 1117 | (setq isearch-lazy-highlight-start nil) | 1120 | (setq isearch-lazy-highlight-start nil) |
| 1118 | (when (buffer-live-p isearch--current-buffer) | 1121 | (when (buffer-live-p isearch--current-buffer) |
| @@ -1176,6 +1179,11 @@ NOPUSH is t and EDIT is t." | |||
| 1176 | 1179 | ||
| 1177 | (and (not edit) isearch-recursive-edit (exit-recursive-edit))) | 1180 | (and (not edit) isearch-recursive-edit (exit-recursive-edit))) |
| 1178 | 1181 | ||
| 1182 | (defun isearch-mouse-leave-buffer () | ||
| 1183 | "Exit Isearch unless the mouse command is allowed in Isearch." | ||
| 1184 | (unless (eq (get this-command 'isearch-scroll) t) | ||
| 1185 | (isearch-done))) | ||
| 1186 | |||
| 1179 | (defun isearch-update-ring (string &optional regexp) | 1187 | (defun isearch-update-ring (string &optional regexp) |
| 1180 | "Add STRING to the beginning of the search ring. | 1188 | "Add STRING to the beginning of the search ring. |
| 1181 | REGEXP if non-nil says use the regexp search ring." | 1189 | REGEXP if non-nil says use the regexp search ring." |
| @@ -2390,6 +2398,12 @@ to the barrier." | |||
| 2390 | (put 'split-window-right 'isearch-scroll t) | 2398 | (put 'split-window-right 'isearch-scroll t) |
| 2391 | (put 'split-window-below 'isearch-scroll t) | 2399 | (put 'split-window-below 'isearch-scroll t) |
| 2392 | (put 'enlarge-window 'isearch-scroll t) | 2400 | (put 'enlarge-window 'isearch-scroll t) |
| 2401 | (put 'enlarge-window-horizontally 'isearch-scroll t) | ||
| 2402 | (put 'shrink-window-horizontally 'isearch-scroll t) | ||
| 2403 | (put 'shrink-window 'isearch-scroll t) | ||
| 2404 | ;; The next two commands don't exit Isearch in isearch-mouse-leave-buffer | ||
| 2405 | (put 'mouse-drag-mode-line 'isearch-scroll t) | ||
| 2406 | (put 'mouse-drag-vertical-line 'isearch-scroll t) | ||
| 2393 | 2407 | ||
| 2394 | ;; Aliases for split-window-* | 2408 | ;; Aliases for split-window-* |
| 2395 | (put 'split-window-vertically 'isearch-scroll t) | 2409 | (put 'split-window-vertically 'isearch-scroll t) |