[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master beafe2b: * lisp/isearch.el (isearch-allow-scroll):
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] master beafe2b: * lisp/isearch.el (isearch-allow-scroll): New option `unlimited'. |
Date: |
Mon, 3 Dec 2018 19:24:36 -0500 (EST) |
branch: master
commit beafe2bf50992b60cb4e8c9628a7000317279c8c
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
* lisp/isearch.el (isearch-allow-scroll): New option `unlimited'.
(isearch-pre-command-hook): Call isearch-pre-scroll-point unless
isearch-allow-scroll is 'unlimited'.
(isearch-post-command-hook): Use `when' instead of `cond'.
Call isearch-lazy-highlight-new-loop when isearch-allow-scroll is
'unlimited'. (Bug#15839)
---
etc/NEWS | 3 +++
lisp/isearch.el | 61 ++++++++++++++++++++++++++++++++-------------------------
2 files changed, 37 insertions(+), 27 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 6297d07..042a4b5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -697,6 +697,9 @@ position after moving point in the current buffer.
'shift-move'
extends the search string by motion commands while holding down
the shift key.
+*** 'isearch-allow-scroll' provides new option 'unlimited' to allow
+scrolling any distance off screen.
+
---
*** Isearch now remembers the regexp-based search mode for words/symbols
and case-sensitivity together with search strings in the search ring.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index eb0b25f..cc199b1 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2746,9 +2746,13 @@ to the barrier."
(defcustom isearch-allow-scroll nil
"Whether scrolling is allowed during incremental search.
If non-nil, scrolling commands can be used in Isearch mode.
-However, the current match will never scroll offscreen.
-If nil, scrolling commands will first cancel Isearch mode."
- :type 'boolean
+However, you cannot scroll far enough that the current match is
+no longer visible (is off screen). But if the value is `unlimited'
+that limitation is removed and you can scroll any distance off screen.
+If nil, scrolling commands exit Isearch mode."
+ :type '(choice (const :tag "Scrolling exits Isearch" nil)
+ (const :tag "Scrolling with current match on screen" t)
+ (const :tag "Scrolling with current match off screen"
unlimited))
:group 'isearch)
(defcustom isearch-allow-prefix t
@@ -2846,7 +2850,8 @@ See more for options in `search-exit-option'."
(or (eq (get this-command 'isearch-scroll) t)
(eq (get this-command 'scroll-command) t))))
(when isearch-allow-scroll
- (setq isearch-pre-scroll-point (point))))
+ (unless (eq isearch-allow-scroll 'unlimited)
+ (setq isearch-pre-scroll-point (point)))))
;; A mouse click on the isearch message starts editing the search string.
((and (eq (car-safe main-event) 'down-mouse-1)
(window-minibuffer-p (posn-window (event-start main-event))))
@@ -2875,29 +2880,31 @@ See more for options in `search-exit-option'."
(isearch-clean-overlays)))))
(defun isearch-post-command-hook ()
- (cond
- (isearch-pre-scroll-point
- (let ((ab-bel (isearch-string-out-of-window isearch-pre-scroll-point)))
- (if ab-bel
- (isearch-back-into-window (eq ab-bel 'above) isearch-pre-scroll-point)
- (goto-char isearch-pre-scroll-point)))
- (setq isearch-pre-scroll-point nil)
- (isearch-update))
- ((memq search-exit-option '(move shift-move))
- (when (and isearch-pre-move-point
- (not (eq isearch-pre-move-point (point))))
- (let ((string (buffer-substring-no-properties
- (or isearch-other-end isearch-opoint) (point))))
- (if isearch-regexp (setq string (regexp-quote string)))
- (setq isearch-string string)
- (setq isearch-message (mapconcat 'isearch-text-char-description
- string ""))
- (setq isearch-yank-flag t)
- (setq isearch-forward (<= (or isearch-other-end isearch-opoint)
(point)))
- (when isearch-forward
- (goto-char isearch-pre-move-point))
- (isearch-search-and-update)))
- (setq isearch-pre-move-point nil)))
+ (when isearch-pre-scroll-point
+ (let ((ab-bel (isearch-string-out-of-window isearch-pre-scroll-point)))
+ (if ab-bel
+ (isearch-back-into-window (eq ab-bel 'above)
isearch-pre-scroll-point)
+ (goto-char isearch-pre-scroll-point)))
+ (setq isearch-pre-scroll-point nil)
+ (isearch-update))
+ (when (eq isearch-allow-scroll 'unlimited)
+ (when isearch-lazy-highlight
+ (isearch-lazy-highlight-new-loop)))
+ (when (memq search-exit-option '(move shift-move))
+ (when (and isearch-pre-move-point
+ (not (eq isearch-pre-move-point (point))))
+ (let ((string (buffer-substring-no-properties
+ (or isearch-other-end isearch-opoint) (point))))
+ (if isearch-regexp (setq string (regexp-quote string)))
+ (setq isearch-string string)
+ (setq isearch-message (mapconcat 'isearch-text-char-description
+ string ""))
+ (setq isearch-yank-flag t)
+ (setq isearch-forward (<= (or isearch-other-end isearch-opoint)
(point)))
+ (when isearch-forward
+ (goto-char isearch-pre-move-point))
+ (isearch-search-and-update)))
+ (setq isearch-pre-move-point nil))
(force-mode-line-update))
(defun isearch-quote-char (&optional count)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master beafe2b: * lisp/isearch.el (isearch-allow-scroll): New option `unlimited'.,
Juri Linkov <=