[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 66cfba8: [el-search] Follow-up to "Fix nested match issues

From: Michael Heerdegen
Subject: [elpa] master 66cfba8: [el-search] Follow-up to "Fix nested match issues in *El Occur*"
Date: Sun, 4 Nov 2018 11:15:28 -0500 (EST)

branch: master
commit 66cfba85edfda22b03fa699f02b7717f516c19e8
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    [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'
    (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.
 packages/el-search/el-search.el | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 1640f55..cb8cf63 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/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)
+(defvar el-search-occur-match-ov-prop 'el-occur-match-data)
 (defun el-search-occur-jump-to-match ()
   (if (button-at (point))
-    (if-let ((params  (get-char-property (point) 'el-search-match)))
+    (if-let ((params (pcase (get-char-property (point) 
+                       (`(,buffer ,match-beg ,file ,_) (list (or file buffer) 
         (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 
some-match-pos 'el-search-match)))
+            (while (and (not done) (setq some-match-pos
+                                         (funcall 
+                                                  some-match-pos 
               (setq done (or (memq some-match-pos (list (point-min) 
-                             (cl-some (lambda (ov) (overlay-get ov 
+                             (cl-some (lambda (ov) (overlay-get ov 
                                       (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 
-               file-name-or-buffer nil
+               (or file buffer) nil
                (lambda ()
                  (goto-char pos)
@@ -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 
-                   (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) 
       (while (and (setq new-pos (funcall (if backward 
@@ -3231,11 +3231,9 @@ Prompt for a new pattern and revert."
                                                       (goto-char match-beg)
-                                           (let ((ov (make-overlay 
insertion-point (point) nil t)))
+                                           (let ((ov (make-overlay 
insertion-point (point) nil 'fr-ad)))
                                              (overlay-put ov 'face 
-                                              ov 'el-search-match (list (or 
file buffer) match-beg))
-                                             (overlay-put
                                               ov el-search-occur-match-ov-prop
                                               `(,buffer ,match-beg ,file 
                                            (with-current-buffer buffer 
@@ -3260,7 +3258,8 @@ Prompt for a new pattern and revert."
                                                  (+ ov-start
                                                     (with-current-buffer buffer
-                                                      (el-search--end-of-sexp 
+                                                      (el-search--end-of-sexp 
+                                                 nil 'front-advance) ;f-a is 
needed for later indenting
                                                 `(,buffer ,mb ,file ,nbr)))
                                              (stream-pop matches)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]