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

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

[elpa] master 5cc1e5c 298/399: swiper.el (swiper-isearch-thing-at-point)


From: Oleh Krehel
Subject: [elpa] master 5cc1e5c 298/399: swiper.el (swiper-isearch-thing-at-point): Improve
Date: Sat, 20 Jul 2019 14:57:44 -0400 (EDT)

branch: master
commit 5cc1e5c562e8d63af06cd36f6bcba5842cfb5cdd
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    swiper.el (swiper-isearch-thing-at-point): Improve
---
 swiper.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/swiper.el b/swiper.el
index 6690ef8..db5f037 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1330,19 +1330,25 @@ that we search only for one character."
 When not running `swiper-isearch' already, start it."
   (interactive)
   (if (window-minibuffer-p)
-      (let (bnd str)
+      (let (bnd str regionp)
         (with-ivy-window
-          (setq bnd (bounds-of-thing-at-point 'symbol))
+          (setq bnd
+                (if (setq regionp (region-active-p))
+                    (prog1 (cons (region-beginning) (region-end))
+                      (deactivate-mark))
+                  (bounds-of-thing-at-point 'symbol)))
           (setq str (buffer-substring-no-properties (car bnd) (cdr bnd))))
         (setq swiper--isearch-point-history
               (list (cons "" (car bnd))))
         (insert str)
-        (ivy--insert-symbol-boundaries))
+        (unless regionp
+          (ivy--insert-symbol-boundaries)))
     (let (thing)
       (if (use-region-p)
           (progn
+            (setq thing (buffer-substring-no-properties
+                         (region-beginning) (region-end)))
             (goto-char (region-beginning))
-            (setq thing (ivy-thing-at-point))
             (deactivate-mark))
         (let ((bnd (bounds-of-thing-at-point 'symbol)))
           (when bnd



reply via email to

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