[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/el-search ab5bcd8 266/332: [el-search] Follow-up to "Fi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/el-search ab5bcd8 266/332: [el-search] Follow-up to "Fix nested match issues in *El Occur*" |
Date: |
Tue, 1 Dec 2020 15:49:00 -0500 (EST) |
branch: externals/el-search
commit ab5bcd8c053c332fd5bd46533983bc170d917fa4
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>
[el-search] Follow-up to "Fix nested match issues in *El Occur*"
Get rid of the now obsolete el-search-match overlay property. Always
create match overlays with front-advance flag so added indentation
doesn't get part of the overlays.
Bump version to 1.7.12.
* packages/el-search/el-search.el (el-search-occur-jump-to-match): Use
the data provided through the 'el-search-occur-match-ov-prop'
property.
(el-search-occur--next-match): Correct a typo.
(el-search--occur): Don't attach the el-search-match property any
more. Create all match-spanning overlays with front-advance flag.
---
el-search.el | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/el-search.el b/el-search.el
index 1640f55..cb8cf63 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.7.11
+;; Version: 1.7.12
;; Package-Requires: ((emacs "25") (stream "2.2.4") (cl-print "1.0"))
@@ -408,8 +408,6 @@
;;
;; TODO:
;;
-;; - Get rid of the redundant el-search-match overlays in occur buffers
-;;
;; - There should be a way to go back to the starting position, like
;; in Isearch, which does this with (push-mark isearch-opoint t) in
;; `isearch-done'.
@@ -2919,11 +2917,14 @@ Prompt for a new pattern and revert."
(el-search-compile-pattern-in-search el-search-occur-search-object)
(revert-buffer))
+(defvar el-search-occur-match-ov-prop 'el-occur-match-data)
+
(defun el-search-occur-jump-to-match ()
(interactive)
(if (button-at (point))
(push-button)
- (if-let ((params (get-char-property (point) 'el-search-match)))
+ (if-let ((params (pcase (get-char-property (point)
el-search-occur-match-ov-prop)
+ (`(,buffer ,match-beg ,file ,_) (list (or file buffer)
match-beg)))))
(apply #'el-search--occur-button-action params)
;; User clicked not directly on a match
(catch 'nothing-here
@@ -2936,10 +2937,11 @@ Prompt for a new pattern and revert."
(unless (< defun-end (point)) (goto-char defun-beg))))
;; Try to find corresponding position in source buffer
(setq some-match-pos (point))
- (while (and (not done) (setq some-match-pos (funcall
#'next-single-char-property-change
-
some-match-pos 'el-search-match)))
+ (while (and (not done) (setq some-match-pos
+ (funcall
#'next-single-char-property-change
+ some-match-pos
el-search-occur-match-ov-prop)))
(setq done (or (memq some-match-pos (list (point-min)
(point-max)))
- (cl-some (lambda (ov) (overlay-get ov
'el-search-match))
+ (cl-some (lambda (ov) (overlay-get ov
el-search-occur-match-ov-prop))
(overlays-at some-match-pos))))))
(let ((delta-lines (count-lines clicked-pos some-match-pos)))
(when (save-excursion
@@ -2948,10 +2950,10 @@ Prompt for a new pattern and revert."
(cl-decf delta-lines))
(when (< clicked-pos some-match-pos)
(cl-callf - delta-lines))
- (pcase-let ((`(,file-name-or-buffer ,pos)
- (get-char-property some-match-pos 'el-search-match)))
+ (pcase-let ((`(,buffer ,pos ,file . ,_)
+ (get-char-property some-match-pos
el-search-occur-match-ov-prop)))
(el-search--occur-button-action
- file-name-or-buffer nil
+ (or file buffer) nil
(lambda ()
(goto-char pos)
(beginning-of-line)
@@ -2995,14 +2997,12 @@ Prompt for a new pattern and revert."
(add-hook 'post-command-hook #'el-search-hl-post-command-fun t t)
(when do-fun (funcall do-fun)))))
-(defvar el-search-occur-match-ov-prop 'el-occur-match-data)
-
(defun el-search-occur--next-match (&optional backward)
(let ((pos (point)) new-pos)
(cl-flet ((at-a-match-beg-p
(lambda (pos)
(when-let ((match-data (get-char-property pos
el-search-occur-match-ov-prop)))
- (and (not (= (point) (if backward (point-min) (point-max))))
+ (and (not (= pos (if backward (point-min) (point-max))))
(not (eq match-data
(get-char-property (1- pos)
el-search-occur-match-ov-prop))))))))
(while (and (setq new-pos (funcall (if backward
#'previous-single-char-property-change
@@ -3231,11 +3231,9 @@ Prompt for a new pattern and revert."
(buffer-substring-no-properties
(goto-char match-beg)
(goto-char
(el-search--end-of-sexp)))))
- (let ((ov (make-overlay
insertion-point (point) nil t)))
+ (let ((ov (make-overlay
insertion-point (point) nil 'fr-ad)))
(overlay-put ov 'face
'el-search-occur-match)
(overlay-put
- ov 'el-search-match (list (or
file buffer) match-beg))
- (overlay-put
ov el-search-occur-match-ov-prop
`(,buffer ,match-beg ,file
,nbr)))
(with-current-buffer buffer
(point)))))
@@ -3260,7 +3258,8 @@ Prompt for a new pattern and revert."
ov-start
(+ ov-start
(with-current-buffer buffer
- (el-search--end-of-sexp
mb))))
+ (el-search--end-of-sexp
mb)))
+ nil 'front-advance) ;f-a is
needed for later indenting
el-search-occur-match-ov-prop
`(,buffer ,mb ,file ,nbr)))
(stream-pop matches)
- [elpa] externals/el-search 3bb5b76 236/332: * el-search/el-search.el: Prefer adverb "backward" in names and text, (continued)
- [elpa] externals/el-search 3bb5b76 236/332: * el-search/el-search.el: Prefer adverb "backward" in names and text, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 41e0251 224/332: * el-search/el-search.el: Bump version to 1.6; some minor tweaks, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search c4eeae5 223/332: * el-search/el-search.el: Fix single buffer query-replace, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search bd67d58 239/332: [el-search] Raise user-error when replacement contains gensyms, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 96b7423 245/332: [el-search] Special case 'el-search-make-matcher' for '_', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search eef5de0 243/332: [el-search] Save two 'eval' calls, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 427afa8 253/332: [el-search] Bump version to 1.7.1, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 0907a21 248/332: [el-search] Bump version to 1.7, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 1bc9c89 252/332: [el-search] Improve 'el-search-display-match-count', Stefan Monnier, 2020/12/01
- [elpa] externals/el-search ba806ce 251/332: [el-search] Enforce defun start for heuristic matching, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search ab5bcd8 266/332: [el-search] Follow-up to "Fix nested match issues in *El Occur*",
Stefan Monnier <=
- [elpa] externals/el-search 2c2930b 256/332: * el-search/el-search.el: Again tweak commentary in header, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 5e97386 255/332: [el-search] Improve match faces, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search fdb5656 270/332: [el-search] Make y move forward after replacing, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 75d0232 279/332: [el-search] Fix C-J with numeric arg in case of no match, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search a661225 272/332: [el-search] Minor tweaks in el-search-query-replace, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search e29370e 281/332: [el-search] Fix more "redundant _ pattern" warnings, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 5c903d9 292/332: [el-search] Small fix for my last commit, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search be0324a 301/332: [el-search] Some minor tweaks and bump version to 1.10.1, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 3b4b95b 304/332: [el-search] Small fix in el-search--changed-files-in-repo, Stefan Monnier, 2020/12/01
- [elpa] externals/el-search 2f427dd 318/332: [el-search] Query-replace: Change skip keys, Stefan Monnier, 2020/12/01