mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
* 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)
This commit is contained in:
parent
df5614297b
commit
beafe2bf50
2 changed files with 37 additions and 27 deletions
3
etc/NEWS
3
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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue