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

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

[elpa] master 83f7ae6 129/348: counsel.el (counsel-yank-pop): Fix candid


From: Oleh Krehel
Subject: [elpa] master 83f7ae6 129/348: counsel.el (counsel-yank-pop): Fix candidates not showing sometimes
Date: Sat, 8 Apr 2017 11:03:41 -0400 (EDT)

branch: master
commit 83f7ae66056291be5c1c982a742cebc8b59c1406
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-yank-pop): Fix candidates not showing sometimes
    
    * ivy.el (ivy-cleanup-string): New defun.
    
    * swiper.el (swiper--candidates): Use `ivy-cleanup-string'.
    
    * counsel.el (counsel-yank-pop): Use `ivy-cleanup-string'.
---
 counsel.el | 12 +++++++-----
 ivy.el     |  5 +++++
 swiper.el  |  2 +-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/counsel.el b/counsel.el
index 3fbb2eb..9101d03 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2040,11 +2040,13 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
                 (point))))
     (setq ivy-completion-beg (point))
     (setq ivy-completion-end (point)))
-  (let ((candidates (cl-remove-if
-                     (lambda (s)
-                       (or (< (length s) 3)
-                           (string-match "\\`[\n[:blank:]]+\\'" s)))
-                     (delete-dups kill-ring))))
+  (let ((candidates
+         (mapcar #'ivy-cleanup-string
+                 (cl-remove-if
+                  (lambda (s)
+                    (or (< (length s) 3)
+                        (string-match "\\`[\n[:blank:]]+\\'" s)))
+                  (delete-dups kill-ring)))))
     (let ((ivy-format-function #'counsel--yank-pop-format-function)
           (ivy-height 5))
       (ivy-read "kill-ring: " candidates
diff --git a/ivy.el b/ivy.el
index aa32186..f9f1d97 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1979,6 +1979,11 @@ depending on the number of candidates."
     (goto-char (minibuffer-prompt-end))
     (delete-region (line-end-position) (point-max))))
 
+(defun ivy-cleanup-string (str)
+  "Remove unwanted text properties from STR."
+  (remove-text-properties 0 (length str) '(field) str)
+  str)
+
 (defvar ivy-set-prompt-text-properties-function
   'ivy-set-prompt-text-properties-default
   "Function to set the text properties of the default ivy prompt.
diff --git a/swiper.el b/swiper.el
index cc3c741..7cb95a4 100644
--- a/swiper.el
+++ b/swiper.el
@@ -311,7 +311,7 @@ numbers; replaces calculating the width from buffer line 
count."
                            (buffer-substring
                             (point)
                             (line-end-position)))))))
-              (remove-text-properties 0 (length str) '(field) str)
+              (setq str (ivy-cleanup-string str))
               (let ((line-number-str
                      (format swiper--format-spec (cl-incf line-number))))
                 (if swiper-include-line-number-in-search



reply via email to

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