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

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

[elpa] master d63ce8f 2/7: Ensure that inserted candidates don't have re


From: Oleh Krehel
Subject: [elpa] master d63ce8f 2/7: Ensure that inserted candidates don't have read-only property
Date: Thu, 26 Mar 2015 11:30:30 +0000

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

    Ensure that inserted candidates don't have read-only property
    
    * ivy.el (ivy-completions): Update.
    
    Fixes #28.
    
    The issue was that the whole text of erc buffer has (read-only t)
    property. That means if I copy some of those strings and insert them
    into the minibuffer, I can't delete them unless I set
    `inhibit-read-only' to t. Instead, I set the read-only to nil for the
    string that I insert. It doesn't affect the original buffer string.
---
 ivy.el |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/ivy.el b/ivy.el
index 4d307f3..a06b50c 100644
--- a/ivy.el
+++ b/ivy.el
@@ -401,12 +401,14 @@ CANDIDATES is a list of strings."
         (setq ivy--current (copy-sequence (nth index cands)))
         (setf (nth index cands)
               (ivy--add-face ivy--current 'ivy-current-match))
-        (concat "\n" (mapconcat
-                      (lambda (s)
-                        (if (> (length s) ww)
-                            (concat (substring s 0 (- ww 3)) "...")
-                          s))
-                      cands "\n"))))))
+        (let ((res (concat "\n" (mapconcat
+                                 (lambda (s)
+                                   (if (> (length s) ww)
+                                       (concat (substring s 0 (- ww 3)) "...")
+                                     s))
+                                 cands "\n"))))
+          (put-text-property 0 (length res) 'read-only nil res)
+          res)))))
 
 (provide 'ivy)
 



reply via email to

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