[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/mheerdegen-preview 91f5bd3 18/35: WIP [el-search] Fix C-j
From: |
Michael Heerdegen |
Subject: |
[elpa] scratch/mheerdegen-preview 91f5bd3 18/35: WIP [el-search] Fix C-j with numeric arg in error case |
Date: |
Mon, 29 Oct 2018 22:24:06 -0400 (EDT) |
branch: scratch/mheerdegen-preview
commit 91f5bd3dddb3c99a57b4632a21787b269cfe59b8
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
WIP [el-search] Fix C-j with numeric arg in error case
---
packages/el-search/el-search.el | 76 ++++++++++++++++++++++-------------------
1 file changed, 41 insertions(+), 35 deletions(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index d9791d0..bd979c7 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -2762,41 +2762,47 @@ make current."
(el-search-continue-search))
(setq this-command 'el-search-pattern)
(pop-to-buffer current-search-buffer
el-search-display-buffer-popup-action)
- (let ((last-match (el-search-object-last-match search)))
- (cond
- ((< (prefix-numeric-value arg) 0)
- (progn (setq arg (prefix-numeric-value arg))
- (goto-char (window-end))))
- ((not (numberp arg))
- (goto-char (if (not (and last-match
- ;; this should only happen for bad search
patterns
- (eq (marker-buffer last-match)
(current-buffer))))
- (el-search-head-position current-head)
- last-match)))
- ((zerop arg) (setq arg 1))
- (t (goto-char (window-start))))
- (let ((match-pos
- (save-excursion
- (el-search--search-pattern-1
- (el-search--current-matcher)
- (not (numberp arg)) nil ;FIXME: Handle no match case
explicitly
- (el-search--current-heuristic-matcher)
- (if (numberp arg) arg 1)))))
- (unless (or (numberp arg) (eq (point) match-pos))
- (message "No match at search head any more - going to the next
match")
- (redisplay)
- ;; Don't just `sit-for' here: `pop-to-buffer' may have generated
frame
- ;; focus events
- (sleep-for 1.5))
- (if (not match-pos)
- (el-search-continue-search)
- (goto-char match-pos)
- (setf (el-search-head-position current-head)
- (copy-marker (point)))
- (setf (el-search-object-last-match el-search--current-search)
- (copy-marker (point)))
- (el-search-hl-sexp)
- (el-search-hl-other-matches (el-search--current-matcher))))))
+ (el-search-protect-search-head
+ (let ((last-match (el-search-object-last-match search)))
+ (cond
+ ((< (prefix-numeric-value arg) 0)
+ (progn (setq arg (prefix-numeric-value arg))
+ (goto-char (window-end))))
+ ((not (numberp arg))
+ (goto-char (if (not (and last-match
+ ;; this should only happen for bad
search patterns
+ (eq (marker-buffer last-match)
(current-buffer))))
+ (el-search-head-position current-head)
+ last-match)))
+ ((zerop arg) (setq arg 1))
+ (t (goto-char (window-start))))
+ (let ((match-pos
+ (save-excursion
+ (el-search--search-pattern-1
+ (el-search--current-matcher)
+ t nil
+ (el-search--current-heuristic-matcher)
+ (if (numberp arg) arg 1)))))
+ (when (and (numberp arg) (not match-pos))
+ (setq el-search--success nil)
+ (el-search-hl-post-command-fun 'stop)
+ (goto-char el-search--search-origin)
+ (user-error "No match there"))
+ (unless (or (numberp arg) (eq (point) match-pos))
+ (message "No match at search head any more - going to the next
match")
+ (redisplay)
+ ;; Don't just `sit-for' here: `pop-to-buffer' may have
generated frame
+ ;; focus events
+ (sleep-for 1.5))
+ (if (not match-pos)
+ (el-search-continue-search)
+ (goto-char match-pos)
+ (setf (el-search-head-position current-head)
+ (copy-marker (point)))
+ (setf (el-search-object-last-match el-search--current-search)
+ (copy-marker (point)))
+ (el-search-hl-sexp)
+ (el-search-hl-other-matches (el-search--current-matcher)))))))
(el-search--message-no-log "[Search completed - restarting]")
(sit-for 1.5)
(el-search-reset-search el-search--current-search)
- [elpa] scratch/mheerdegen-preview f23fe5e 17/35: WIP: Optimize caching, (continued)
- [elpa] scratch/mheerdegen-preview f23fe5e 17/35: WIP: Optimize caching, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview b4b94b0 11/35: WIP [el-search] Implement 'el-search-keyboard-quit', Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 44715aa 05/35: WIP: New package "gnus-article-notes", Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 5057b57 14/35: WIP [el-search] Discourage using symbols as LPATS in `append' and `l', Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 5e2aea1 20/35: WIP [el-search] Adjust prev/next match commands for search and occur, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 38def8b 25/35: WIP: Test: Make mouse clicks not abort the search, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview feede7d 23/35: WIP: [el-search] Fine tune separator for splicing replace, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 82abecf 16/35: WIP: Additions to "Mb hints", Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview df2132a 21/35: WIP: Improvements for change and changed, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 2ec7a9e 22/35: WIP: More colorful match count, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 91f5bd3 18/35: WIP [el-search] Fix C-j with numeric arg in error case,
Michael Heerdegen <=
- [elpa] scratch/mheerdegen-preview 237c2c6 33/35: WIP: [el-search] Enhance doc of el-search-occur-mode, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 99782c3 19/35: WIP [el-search] Fix search setup when occur flag bound, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview acc2594 24/35: WIP: Improvise eldoc support for search pattern prompt, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview f1dde5c 28/35: WIP: Include leading comments in occur defun context, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview e557155 31/35: WIP: Small fix in 'el-search--reset-wrap-flag', Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 1f85214 32/35: WIP: Small fix in el-search--changed-files-in-repo, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 869266f 15/35: WIP [el-search] Minibuffer hints when entering pattern, Fix case when search pattern fails for some sexps, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview 7c82465 30/35: WIP: Fix C-A and C-J after finished single-buffer search, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview b43f7bb 07/35: WIP: Add el-search-hi-lock.el, Michael Heerdegen, 2018/10/29
- [elpa] scratch/mheerdegen-preview c8d9698 26/35: WIP: [el-search] Some minor tweaks, Michael Heerdegen, 2018/10/29