[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/mheerdegen-preview 4900664 29/33: WIP: Fix C-A and C-J af
From: |
Michael Heerdegen |
Subject: |
[elpa] scratch/mheerdegen-preview 4900664 29/33: WIP: Fix C-A and C-J after finished single-buffer search |
Date: |
Wed, 24 Oct 2018 18:30:53 -0400 (EDT) |
branch: scratch/mheerdegen-preview
commit 4900664fc0ebf95a3ba7c0360be4a975209ff6f9
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
WIP: Fix C-A and C-J after finished single-buffer search
---
packages/el-search/el-search.el | 90 ++++++++++++++++++++++++-----------------
1 file changed, 52 insertions(+), 38 deletions(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 40ff112..6bcc063 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -1486,9 +1486,20 @@ optional MESSAGE are used to construct the error
message."
(eq (or buffer (current-buffer))
(el-search-head-buffer (el-search-object-head
el-search--current-search)))))
+(defun el-search-revive-search ()
+ (el-search-hl-post-command-fun 'stop)
+ (setq el-search--success nil)
+ (setq el-search--wrap-flag nil)
+ (el-search-reset-search el-search--current-search))
+
(defun el-search-barf-if-not-search-buffer (&optional buffer &rest args)
- (unless (el-search--search-buffer-p buffer)
- (apply #'user-error (or args (list "Not in current search buffer")))))
+ (if (eq (alist-get 'is-single-buffer (el-search-object-properties
el-search--current-search))
+ (current-buffer))
+ (unless (el-search-head-buffer (el-search-object-head
el-search--current-search))
+ (el-search-revive-search)
+ (el-search--next-buffer el-search--current-search))
+ (unless (el-search--search-buffer-p buffer)
+ (apply #'user-error (or args (list "Not in current search buffer"))))))
(defun el-search--get-search-description-string (search &optional verbose
dont-propertize)
(concat
@@ -2855,8 +2866,8 @@ make current."
(el-search-hl-sexp)
(el-search-hl-other-matches (el-search--current-matcher)))))))
(el-search--message-no-log "[Search completed - restarting]")
+ (el-search-revive-search)
(sit-for 1.5)
- (el-search-reset-search el-search--current-search)
(el-search-continue-search))
(el-search-prefix-key-maybe-set-transient-map))
@@ -3004,7 +3015,7 @@ See `el-search-defined-patterns' for a list of defined
patterns."
(el-search--set-wrap-flag nil)
(el-search--message-no-log "[Wrapped search]")
(sit-for .7)
- (el-search-from-beginning 'restart)))
+ (el-search-from-beginning 1)))
((or
(el-search--pending-search-p)
(and (eq this-command last-command)
@@ -3013,12 +3024,13 @@ See `el-search-defined-patterns' for a list of defined
patterns."
(el-search--skip-expression nil t)
(el-search-continue-search 'from-here)))
(t ;create a new search single-buffer search
- (el-search-setup-search
- pattern
- (let ((current-buffer (current-buffer)))
- (lambda () (stream (list current-buffer))))
- (lambda (search) (setf (alist-get 'is-single-buffer
(el-search-object-properties search)) t))
- 'from-here))))
+ (let ((current-buffer (current-buffer)))
+ (el-search-setup-search
+ pattern
+ (lambda () (stream (list current-buffer)))
+ (lambda (search) (setf (alist-get 'is-single-buffer
(el-search-object-properties search))
+ current-buffer))
+ 'from-here)))))
(defmacro el-search--unless-no-buffer-match (&rest body)
"Execute BODY unless no match for current search in current buffer.
@@ -3169,12 +3181,13 @@ See the command `el-search-pattern' for more
information."
(progn
(el-search-compile-pattern-in-search el-search--current-search)
(el-search-prefix-key-maybe-set-transient-map))
- (el-search-setup-search-1
- pattern
- (let ((current-buffer (current-buffer)))
- (lambda () (stream (list current-buffer))))
- 'from-here
- (lambda (search) (setf (alist-get 'is-single-buffer
(el-search-object-properties search)) t)))
+ (let ((current-buffer (current-buffer)))
+ (el-search-setup-search-1
+ pattern
+ (lambda () (stream (list current-buffer)))
+ 'from-here
+ (lambda (search) (setf (alist-get 'is-single-buffer
(el-search-object-properties search))
+ current-buffer))))
;; Make this buffer the current search buffer so that a following C-S
;; doesn't delete highlighting
(el-search--next-buffer el-search--current-search))
@@ -3238,12 +3251,13 @@ Use the normal search commands to seize the search."
(user-error "No sexp at point")))))))
(let ((printed-sexp (el-search--pp-to-string sexp)))
(el-search--pushnew-to-history (concat "'" printed-sexp)
'el-search-pattern-history)
- (el-search-setup-search-1
- `',sexp
- (let ((current-buffer (current-buffer)))
- (lambda () (stream (list current-buffer))))
- 'from-here
- (lambda (search) (setf (alist-get 'is-single-buffer
(el-search-object-properties search)) t)))
+ (let ((current-buffer (current-buffer)))
+ (el-search-setup-search-1
+ `',sexp
+ (lambda () (stream (list current-buffer)))
+ 'from-here
+ (lambda (search) (setf (alist-get 'is-single-buffer
(el-search-object-properties search))
+ current-buffer))))
(el-search--next-buffer el-search--current-search)
(setf (el-search-head-position (el-search-object-head
el-search--current-search))
(copy-marker (point)))
@@ -3378,7 +3392,7 @@ Prompt for a new pattern and revert."
'from-here
(lambda (search)
(setf (alist-get 'is-single-buffer (el-search-object-properties
search))
- t)))
+ buffer)))
(el-search--next-buffer el-search--current-search)
(setq this-command 'el-search-pattern
el-search--success t)
@@ -4121,21 +4135,21 @@ exactly you did? Thanks!"))))
(defun el-search--search-and-replace-pattern
(pattern replacement &optional splice to-input-string use-current-search)
(unless use-current-search
- (el-search-setup-search-1 pattern
- (let ((current-buffer (current-buffer)))
- (lambda () (stream (list current-buffer))))
- t
- (let ((here (copy-marker (point))))
- (lambda (search)
- (setf (alist-get 'is-single-buffer
-
(el-search-object-properties search))
- t)
- (setf (alist-get 'description
(el-search-object-properties search))
- "Search created by
`el-search-query-replace'")
- (let ((inhibit-message t))
- (el-search--next-buffer search)
- (setf (el-search-head-position
(el-search-object-head search))
- here))))))
+ (let ((current-buffer (current-buffer)))
+ (el-search-setup-search-1 pattern
+ (lambda () (stream (list current-buffer)))
+ t
+ (let ((here (copy-marker (point))))
+ (lambda (search)
+ (setf (alist-get 'is-single-buffer
+
(el-search-object-properties search))
+ current-buffer)
+ (setf (alist-get 'description
(el-search-object-properties search))
+ "Search created by
`el-search-query-replace'")
+ (let ((inhibit-message t))
+ (el-search--next-buffer search)
+ (setf (el-search-head-position
(el-search-object-head search))
+ here)))))))
(catch 'done
(let ((replace-all nil) (replace-all-and-following nil)
nbr-replaced nbr-skipped (nbr-replaced-total 0) (nbr-changed-buffers
0)
- [elpa] scratch/mheerdegen-preview 60fd31c 19/33: WIP [el-search] Adjust prev/next match commands for search and occur, (continued)
- [elpa] scratch/mheerdegen-preview 60fd31c 19/33: WIP [el-search] Adjust prev/next match commands for search and occur, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview fb5a73b 30/33: WIP: Small fix in 'el-search--reset-wrap-flag', Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 86f4f18 17/33: WIP [el-search] Fix C-j with numeric arg in error case, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 1d22a6c 14/33: WIP [el-search] Minibuffer hints when entering pattern, Fix case when search pattern fails for some sexps, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 0e37f94 28/33: WIP: Add alarm-clock.el, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 6a048a7 26/33: WIP: Don't initially fold occur buffer, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 6de70fb 20/33: WIP: Improvements for change and changed, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 0d07bb8 33/33: WIP: [el-search] Don't kill modified buffers, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 8391d56 31/33: WIP: Small fix in el-search--changed-files-in-repo, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 19bbc05 21/33: WIP: More colorful match count, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview 4900664 29/33: WIP: Fix C-A and C-J after finished single-buffer search,
Michael Heerdegen <=
- [elpa] scratch/mheerdegen-preview 10e346c 25/33: WIP: [el-search] Some minor tweaks, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview dc25f93 09/33: WIP: qr: Make shown replacement editable and ediffable; r twice restores match; stop for problematic comments, Michael Heerdegen, 2018/10/24
- [elpa] scratch/mheerdegen-preview ae9928e 06/33: WIP: Add el-search-hi-lock.el, Michael Heerdegen, 2018/10/24