[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/mheerdegen-preview fc2c159 29/32: WIP: Fix C-A and C-J af
From: |
Michael Heerdegen |
Subject: |
[elpa] scratch/mheerdegen-preview fc2c159 29/32: WIP: Fix C-A and C-J after finished single-buffer search |
Date: |
Sat, 20 Oct 2018 18:19:03 -0400 (EDT) |
branch: scratch/mheerdegen-preview
commit fc2c159b66edf46fc19ae87e755a14ce73f23170
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 76a480d..3c2ab56 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 d91a3bb 02/32: WIP: Add diverse "sloppy" pattern types, (continued)
- [elpa] scratch/mheerdegen-preview d91a3bb 02/32: WIP: Add diverse "sloppy" pattern types, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 9fce13a 05/32: WIP: New :key arg for "filename" and new pattern types "file" and "dir", Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview b8542ca 04/32: WIP: New package "gnus-article-notes", Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 73bca9f 12/32: WIP [el-search] Fix more "redundant _ pattern" cases, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview d27e751 19/32: WIP [el-search] Adjust prev/next match commands for search and occur, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 562b2db 18/32: WIP [el-search] Fix search setup when occur flag bound, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 1f46601 15/32: WIP: Additions to "Mb hints", Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview a8483cd 22/32: WIP: [el-search] Fine tune separator for splicing replace, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 5bdc539 27/32: WIP: Include leading comments in occur defun context, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview f11f566 31/32: WIP: Small fix in el-search--changed-files-in-repo, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview fc2c159 29/32: WIP: Fix C-A and C-J after finished single-buffer search,
Michael Heerdegen <=
- [elpa] scratch/mheerdegen-preview d6a3158 01/32: WIP: [el-search] Fix nested match issues in *El Occur*, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 74cc15a 08/32: WIP: New command 'el-search-repository', Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview e43d95b 10/32: WIP [el-search] Implement 'el-search-keyboard-quit', Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 163a7c7 03/32: WIP: Add package "sscell", Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 216fd06 07/32: WIP: New file el-search/el-search-pp.el, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 4f3d9bf 11/32: WIP [el-search] Add quick help command, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 5b994a5 17/32: WIP [el-search] Fix C-j with numeric arg in error case, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 54e3b67 16/32: WIP: Optimize caching, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 3aa418f 20/32: WIP: Improvements for change and changed, Michael Heerdegen, 2018/10/20
- [elpa] scratch/mheerdegen-preview 8c8e364 30/32: WIP: Small fix in 'el-search--reset-wrap-flag', Michael Heerdegen, 2018/10/20