[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/el-search 82b807f 231/332: * el-search/el-search.el: Ne
From: |
Stefan Monnier |
Subject: |
[elpa] externals/el-search 82b807f 231/332: * el-search/el-search.el: New user option `el-search-allow-scroll' |
Date: |
Tue, 1 Dec 2020 15:48:52 -0500 (EST) |
branch: externals/el-search
commit 82b807fd57b95773c6238b96f2da43a0c310ba5e
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>
* el-search/el-search.el: New user option `el-search-allow-scroll'
---
NEWS | 8 ++++++++
el-search.el | 28 ++++++++++++++++++++++++----
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 7a4cf25..c05a730 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,14 @@
Some of the user visible news were:
+Version: 1.6.5
+
+ When the new user option `el-search-allow-scroll' is enabled (the
+ default), scrolling doesn't deactivate the current el-search.
+ Unlike isearch you can scroll the current match offscreen - use
+ `el-search-jump-to-search-head' (C-J or M-s e j when using the
+ suggested key bindings) to jump back to the current match.
+
Version: 1.6.1
New function `el-search-looking-at', the el-search version of
diff --git a/el-search.el b/el-search.el
index adcd678..7a5c662 100644
--- a/el-search.el
+++ b/el-search.el
@@ -7,7 +7,7 @@
;; Created: 29 Jul 2015
;; Keywords: lisp
;; Compatibility: GNU Emacs 25
-;; Version: 1.6.4
+;; Version: 1.6.5
;; Package-Requires: ((emacs "25") (stream "2.2.4") (cl-print "1.0"))
@@ -543,6 +543,14 @@ When `el-search-use-transient-map' is non-nil, when any
of these commands will keep the
`el-search-prefix-key-transient-map' further in effect.")
+(defcustom el-search-allow-scroll t
+ "Whether scrolling is allowed during el-search.
+When non-nil, scrolling commands don't deactivate the current
+search. Unlike isearch, it's possible to scroll the current
+match offscreen. Use `el-search-jump-to-search-head'
(\\[el-search-jump-to-search-head])
+to go back to the position of the current match."
+ :type 'boolean)
+
(defvar el-search-read-expression-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map read-expression-map)
@@ -1579,10 +1587,19 @@ in, in order, when called with no arguments."
(define-key transient-map (vector key) command))))
transient-map))
+(defun el-search-keep-session-command-p (command)
+ "Non-nil when COMMAND should not deactivate the current search."
+ (and
+ el-search-allow-scroll
+ (symbolp command)
+ (or (get command 'isearch-scroll) ;isearch is preloaded
+ (get command 'scroll-command))))
+
(defun el-search-prefix-key-maybe-set-transient-map ()
(when el-search-use-transient-map
(set-transient-map el-search-prefix-key-transient-map
- (lambda () (memq this-command
el-search-keep-transient-map-commands)))))
+ (lambda () (or (memq this-command
el-search-keep-transient-map-commands)
+ (el-search-keep-session-command-p
this-command))))))
(defun el-search-shift-bindings-bind-function (map key command)
(define-key map `[(control ,@(if (<= ?a key ?z) `(shift ,key) `(,key)))]
command))
@@ -2106,6 +2123,7 @@ local binding of `window-scroll-functions'."
(pcase this-command
('el-search-query-replace)
('el-search-pattern (el-search-display-match-count))
+ ((pred el-search-keep-session-command-p))
(_ (unless el-search-keep-hl
(el-search-hl-remove)
(remove-hook 'post-command-hook 'el-search-hl-post-command-fun t)
@@ -3492,7 +3510,8 @@ Don't save this buffer and all following buffers; don't
ask again"))))
(barf-if-buffer-read-only)
(let ((from-input (let ((el-search--initial-mb-contents
(or el-search--initial-mb-contents
- (and (eq last-command 'el-search-pattern)
+ (and (or (eq last-command 'el-search-pattern)
+ (el-search--pending-search-p))
(if (equal (el-search-read (car
el-search-pattern-history))
(el-search-read (car
el-search-query-replace-history)))
(car el-search-query-replace-history)
@@ -3592,7 +3611,8 @@ consulted to construct the text form of each replacement."
search-head
(eq (el-search-head-buffer search-head) (current-buffer))
(equal from-pattern (el-search-object-pattern el-search--current-search))
- (eq last-command 'el-search-pattern)
+ (or (eq last-command 'el-search-pattern)
+ (el-search--pending-search-p))
(prog1 t
(el-search--message-no-log "Using the current search to drive
query-replace...")
(sit-for 1.))))))
- [elpa] externals/el-search 4961830 273/332: [el-search] Make replacement editable and ediff'able, (continued)
- [elpa] externals/el-search 4961830 273/332: [el-search] Make replacement editable and ediff'able, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search da1f46b 282/332: [el-search] Make mouse clicks not abort the search, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 2a098da 293/332: [el-search] Unify go-to-previous/next-match key bindings, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search d4f8b3b 289/332: [el-search] Tweak my last commit "Add menus", Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 4d81139 299/332: [el-search] Fine tune separator for splicing replace, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 424138b 307/332: [el-search] Tweak 'display-buffer' actions, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search d9acf3a 314/332: [el-search] Fix sanity check regarding comments, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 13fc32d 323/332: [el-search] Fix a highlighting corner case, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 9e95e79 325/332: [el-search] Also overwrite replaced matches automatically, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search f7e4c5b 327/332: [el-search] Small fix in occur filter-buffer-substring-function, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 82b807f 231/332: * el-search/el-search.el: New user option `el-search-allow-scroll',
Stefan Monnier <=
- [elpa] externals/el-search 3218858 261/332: [el-search] Add some key bindings, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search db7ccbb 220/332: * el-search/el-search.el: Don't highlight inserted replacement, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 226296a 229/332: * el-search/el-search-x.el: New pattern type `string-lines', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 3503cf0 280/332: [el-search] Fix search setup with non-nil occur flag, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 1a46fca 291/332: [el-search] Allow expressions as args of 'string', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 2f7770a 311/332: [el-search] Label matches when copying from *El-Occur*, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 07bed84 330/332: [el-search] Fix eldoc support for uncompiled patterns, Stefan Monnier, 2020/12/01