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

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

[elpa] master 582c9d4 014/184: swiper.el (swiper--candidates): Don't sto


From: Oleh Krehel
Subject: [elpa] master 582c9d4 014/184: swiper.el (swiper--candidates): Don't store line number as a string
Date: Wed, 16 Oct 2019 13:14:40 -0400 (EDT)

branch: master
commit 582c9d4bf118f58e424ada5f4c69da7128757564
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    swiper.el (swiper--candidates): Don't store line number as a string
---
 ivy.el    |  4 ++--
 swiper.el | 20 ++++++++------------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/ivy.el b/ivy.el
index d580167..2bf0b2d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3452,7 +3452,7 @@ CANDS are the current candidates."
                   (res 0)
                   (i 0))
               (dolist (c cands)
-                (when (eq n (read (get-text-property 0 'swiper-line-number c)))
+                (when (eq n (get-text-property 0 'swiper-line-number c))
                   (setq res i))
                 (cl-incf i))
               res))))
@@ -3463,7 +3463,7 @@ CANDS are the current candidates."
 CANDS are the current candidates."
   (let ((idx (ivy-recompute-index-swiper re-str cands)))
     (if (or (= idx -1)
-            (<= (read (get-text-property 0 'swiper-line-number (nth idx 
cands)))
+            (<= (get-text-property 0 'swiper-line-number (nth idx cands))
                 (line-number-at-pos)))
         idx
       (- idx 1))))
diff --git a/swiper.el b/swiper.el
index 5071cec..b437b2d 100644
--- a/swiper.el
+++ b/swiper.el
@@ -528,7 +528,7 @@ numbers; replaces calculating the width from buffer line 
count."
                     (put-text-property
                      0 1 'display line-number-str str))
                   (put-text-property
-                   0 1 'swiper-line-number line-number-str str))
+                   0 1 'swiper-line-number line-number str))
                 (push str candidates)))
             (funcall advancer 1)
             (cl-incf line-number))
@@ -604,10 +604,9 @@ such as `scroll-conservatively' are set to a high value.")
               (if (eq (ivy-state-caller ivy-last) 'swiper-isearch)
                   (swiper--isearch-occur-cands cands)
                 (mapcar (lambda (s)
-                          (let ((l (get-text-property 0 'swiper-line-number 
s)))
-                            (setq s (substring s 1))
-                            (put-text-property 0 1 'swiper-line-number l s)
-                            (cons (read l) s)))
+                          (cons
+                           (get-text-property 0 'swiper-line-number s)
+                           s))
                         cands)))
              (offset (+ (length fname) 2)))
         (mapcar (lambda (x)
@@ -776,7 +775,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
                  (if initial-input
                      (cl-position-if
                       (lambda (x)
-                        (= (1+ preselect) (read (get-text-property 0 
'swiper-line-number x))))
+                        (= (1+ preselect) (get-text-property 0 
'swiper-line-number x)))
                       (progn
                         (setq ivy--old-re nil)
                         (ivy--filter initial-input candidates)))
@@ -904,10 +903,7 @@ the face, window and priority of the overlay."
           (let* ((re (replace-regexp-in-string
                       "    " "\t"
                       re))
-                 (str (get-text-property 0 'swiper-line-number 
(ivy-state-current ivy-last)))
-                 (num (if (string-match "^[0-9]+" str)
-                          (string-to-number (match-string 0 str))
-                        0)))
+                 (num (get-text-property 0 'swiper-line-number 
(ivy-state-current ivy-last))))
             (unless (memq this-command '(ivy-yank-word
                                          ivy-yank-symbol
                                          ivy-yank-char
@@ -1034,7 +1030,7 @@ WND, when specified is the window."
 
 (defun swiper--action (x)
   "Goto line X."
-  (let ((ln (1- (read (get-text-property 0 'swiper-line-number x))))
+  (let ((ln (1- (get-text-property 0 'swiper-line-number x)))
         (re (ivy--regex ivy-text)))
     (if (null x)
         (user-error "No candidates")
@@ -1146,7 +1142,7 @@ otherwise continue prompting for buffers."
         (with-ivy-window
           (switch-to-buffer buffer-name)
           (goto-char (point-min))
-          (forward-line (1- (read (get-text-property 0 'swiper-line-number 
x))))
+          (forward-line (1- (get-text-property 0 'swiper-line-number x)))
           (re-search-forward
            (ivy--regex ivy-text)
            (line-end-position) t)



reply via email to

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