[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b981290: * el-search/el-search.el: New user option `el-sea
[elpa] master b981290: * el-search/el-search.el: New user option `el-search-allow-scroll'
Sat, 7 Apr 2018 07:51:05 -0400 (EDT)
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
* el-search/el-search.el: New user option `el-search-allow-scroll'
packages/el-search/NEWS | 8 ++++++++
packages/el-search/el-search.el | 28 ++++++++++++++++++++++++----
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/packages/el-search/NEWS b/packages/el-search/NEWS
index 7a4cf25..c05a730 100644
@@ -1,6 +1,14 @@
Some of the user visible news were:
+ 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.
New function `el-search-looking-at', the el-search version of
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index adcd678..7a5c662 100644
@@ -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'
+to go back to the position of the current match."
+ :type 'boolean)
(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))))
+(defun el-search-keep-session-command-p (command)
+ "Non-nil when COMMAND should not deactivate the current search."
+ (symbolp command)
+ (or (get command 'isearch-scroll) ;isearch is preloaded
+ (get command 'scroll-command))))
(defun el-search-prefix-key-maybe-set-transient-map ()
- (lambda () (memq this-command
+ (lambda () (or (memq this-command
(defun el-search-shift-bindings-bind-function (map key command)
(define-key map `[(control ,@(if (<= ?a key ?z) `(shift ,key) `(,key)))]
@@ -2106,6 +2123,7 @@ local binding of `window-scroll-functions'."
+ ((pred el-search-keep-session-command-p))
(_ (unless el-search-keep-hl
(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
(let ((from-input (let ((el-search--initial-mb-contents
- (and (eq last-command 'el-search-pattern)
+ (and (or (eq last-command 'el-search-pattern)
(if (equal (el-search-read (car
@@ -3592,7 +3611,8 @@ consulted to construct the text form of each replacement."
(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--message-no-log "Using the current search to drive
|[Prev in Thread]
||[Next in Thread]|
- [elpa] master b981290: * el-search/el-search.el: New user option `el-search-allow-scroll',
Michael Heerdegen <=