emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 2098d27 148/399: swiper.el: Set up occur for swiper-isearc


From: Oleh Krehel
Subject: [elpa] master 2098d27 148/399: swiper.el: Set up occur for swiper-isearch
Date: Sat, 20 Jul 2019 14:57:12 -0400 (EDT)

branch: master
commit 2098d273d381dd755730b6228bb04f4b041af8a1
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    swiper.el: Set up occur for swiper-isearch
---
 ivy.el    |  3 ++-
 swiper.el | 13 +++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index c15e7fa..2690e9d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4505,7 +4505,8 @@ EVENT gives the mouse position."
                          (assoc str coll)
                        str))))
         (if (memq (ivy-state-caller ivy-last)
-                  '(swiper counsel-git-grep counsel-grep counsel-ag 
counsel-rg))
+                  '(swiper swiper-isearch
+                    counsel-git-grep counsel-grep counsel-ag counsel-rg))
             (with-current-buffer (window-buffer (selected-window))
               (swiper--cleanup)
               (swiper--add-overlays
diff --git a/swiper.el b/swiper.el
index ea10979..960010d 100644
--- a/swiper.el
+++ b/swiper.el
@@ -489,9 +489,16 @@ such as `scroll-conservatively' are set to a high value.")
       (mapcar
        (lambda (s)
          (let* ((n (get-text-property 0 'swiper-line-number s))
-                (nn (number-to-string (+ (read n) line-delta))))
+                (pt (get-text-property 0 'point s))
+                (nn (number-to-string
+                     (if n
+                         (progn
+                           (setq s (substring s 1))
+                           (+ (read n) line-delta))
+                       (line-number-at-pos pt)))))
+           (put-text-property 0 1 'point pt fname)
            (put-text-property 0 (length nn) 'face 'ivy-grep-line-number nn)
-           (format "%s:%s:%s" fname nn (substring s 1))))
+           (format "%s:%s:%s" fname nn s)))
        cands))))
 
 (defun swiper-occur (&optional revert)
@@ -1205,6 +1212,8 @@ See `ivy-format-function' for further information."
       (unless (or res (string= ivy-text ""))
         (cl-pushnew ivy-text swiper-history)))))
 
+(ivy-set-occur 'swiper-isearch 'swiper-occur)
+
 (provide 'swiper)
 
 ;;; swiper.el ends here



reply via email to

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