diff options
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/isearch.el | 61 |
2 files changed, 37 insertions, 27 deletions
| @@ -697,6 +697,9 @@ position after moving point in the current buffer. 'shift-move' | |||
| 697 | extends the search string by motion commands while holding down | 697 | extends the search string by motion commands while holding down |
| 698 | the shift key. | 698 | the shift key. |
| 699 | 699 | ||
| 700 | *** 'isearch-allow-scroll' provides new option 'unlimited' to allow | ||
| 701 | scrolling any distance off screen. | ||
| 702 | |||
| 700 | --- | 703 | --- |
| 701 | *** Isearch now remembers the regexp-based search mode for words/symbols | 704 | *** Isearch now remembers the regexp-based search mode for words/symbols |
| 702 | and case-sensitivity together with search strings in the search ring. | 705 | and case-sensitivity together with search strings in the search ring. |
diff --git a/lisp/isearch.el b/lisp/isearch.el index eb0b25f9b17..cc199b16d81 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -2746,9 +2746,13 @@ to the barrier." | |||
| 2746 | (defcustom isearch-allow-scroll nil | 2746 | (defcustom isearch-allow-scroll nil |
| 2747 | "Whether scrolling is allowed during incremental search. | 2747 | "Whether scrolling is allowed during incremental search. |
| 2748 | If non-nil, scrolling commands can be used in Isearch mode. | 2748 | If non-nil, scrolling commands can be used in Isearch mode. |
| 2749 | However, the current match will never scroll offscreen. | 2749 | However, you cannot scroll far enough that the current match is |
| 2750 | If nil, scrolling commands will first cancel Isearch mode." | 2750 | no longer visible (is off screen). But if the value is `unlimited' |
| 2751 | :type 'boolean | 2751 | that limitation is removed and you can scroll any distance off screen. |
| 2752 | If nil, scrolling commands exit Isearch mode." | ||
| 2753 | :type '(choice (const :tag "Scrolling exits Isearch" nil) | ||
| 2754 | (const :tag "Scrolling with current match on screen" t) | ||
| 2755 | (const :tag "Scrolling with current match off screen" unlimited)) | ||
| 2752 | :group 'isearch) | 2756 | :group 'isearch) |
| 2753 | 2757 | ||
| 2754 | (defcustom isearch-allow-prefix t | 2758 | (defcustom isearch-allow-prefix t |
| @@ -2846,7 +2850,8 @@ See more for options in `search-exit-option'." | |||
| 2846 | (or (eq (get this-command 'isearch-scroll) t) | 2850 | (or (eq (get this-command 'isearch-scroll) t) |
| 2847 | (eq (get this-command 'scroll-command) t)))) | 2851 | (eq (get this-command 'scroll-command) t)))) |
| 2848 | (when isearch-allow-scroll | 2852 | (when isearch-allow-scroll |
| 2849 | (setq isearch-pre-scroll-point (point)))) | 2853 | (unless (eq isearch-allow-scroll 'unlimited) |
| 2854 | (setq isearch-pre-scroll-point (point))))) | ||
| 2850 | ;; A mouse click on the isearch message starts editing the search string. | 2855 | ;; A mouse click on the isearch message starts editing the search string. |
| 2851 | ((and (eq (car-safe main-event) 'down-mouse-1) | 2856 | ((and (eq (car-safe main-event) 'down-mouse-1) |
| 2852 | (window-minibuffer-p (posn-window (event-start main-event)))) | 2857 | (window-minibuffer-p (posn-window (event-start main-event)))) |
| @@ -2875,29 +2880,31 @@ See more for options in `search-exit-option'." | |||
| 2875 | (isearch-clean-overlays))))) | 2880 | (isearch-clean-overlays))))) |
| 2876 | 2881 | ||
| 2877 | (defun isearch-post-command-hook () | 2882 | (defun isearch-post-command-hook () |
| 2878 | (cond | 2883 | (when isearch-pre-scroll-point |
| 2879 | (isearch-pre-scroll-point | 2884 | (let ((ab-bel (isearch-string-out-of-window isearch-pre-scroll-point))) |
| 2880 | (let ((ab-bel (isearch-string-out-of-window isearch-pre-scroll-point))) | 2885 | (if ab-bel |
| 2881 | (if ab-bel | 2886 | (isearch-back-into-window (eq ab-bel 'above) isearch-pre-scroll-point) |
| 2882 | (isearch-back-into-window (eq ab-bel 'above) isearch-pre-scroll-point) | 2887 | (goto-char isearch-pre-scroll-point))) |
| 2883 | (goto-char isearch-pre-scroll-point))) | 2888 | (setq isearch-pre-scroll-point nil) |
| 2884 | (setq isearch-pre-scroll-point nil) | 2889 | (isearch-update)) |
| 2885 | (isearch-update)) | 2890 | (when (eq isearch-allow-scroll 'unlimited) |
| 2886 | ((memq search-exit-option '(move shift-move)) | 2891 | (when isearch-lazy-highlight |
| 2887 | (when (and isearch-pre-move-point | 2892 | (isearch-lazy-highlight-new-loop))) |
| 2888 | (not (eq isearch-pre-move-point (point)))) | 2893 | (when (memq search-exit-option '(move shift-move)) |
| 2889 | (let ((string (buffer-substring-no-properties | 2894 | (when (and isearch-pre-move-point |
| 2890 | (or isearch-other-end isearch-opoint) (point)))) | 2895 | (not (eq isearch-pre-move-point (point)))) |
| 2891 | (if isearch-regexp (setq string (regexp-quote string))) | 2896 | (let ((string (buffer-substring-no-properties |
| 2892 | (setq isearch-string string) | 2897 | (or isearch-other-end isearch-opoint) (point)))) |
| 2893 | (setq isearch-message (mapconcat 'isearch-text-char-description | 2898 | (if isearch-regexp (setq string (regexp-quote string))) |
| 2894 | string "")) | 2899 | (setq isearch-string string) |
| 2895 | (setq isearch-yank-flag t) | 2900 | (setq isearch-message (mapconcat 'isearch-text-char-description |
| 2896 | (setq isearch-forward (<= (or isearch-other-end isearch-opoint) (point))) | 2901 | string "")) |
| 2897 | (when isearch-forward | 2902 | (setq isearch-yank-flag t) |
| 2898 | (goto-char isearch-pre-move-point)) | 2903 | (setq isearch-forward (<= (or isearch-other-end isearch-opoint) (point))) |
| 2899 | (isearch-search-and-update))) | 2904 | (when isearch-forward |
| 2900 | (setq isearch-pre-move-point nil))) | 2905 | (goto-char isearch-pre-move-point)) |
| 2906 | (isearch-search-and-update))) | ||
| 2907 | (setq isearch-pre-move-point nil)) | ||
| 2901 | (force-mode-line-update)) | 2908 | (force-mode-line-update)) |
| 2902 | 2909 | ||
| 2903 | (defun isearch-quote-char (&optional count) | 2910 | (defun isearch-quote-char (&optional count) |