[Top][All Lists]

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

[elpa] master 18d7f84 117/399: counsel.el (counsel-yank-pop-action): Als

From: Oleh Krehel
Subject: [elpa] master 18d7f84 117/399: counsel.el (counsel-yank-pop-action): Also works for strings
Date: Sat, 20 Jul 2019 14:57:03 -0400 (EDT)

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

    counsel.el (counsel-yank-pop-action): Also works for strings
    That are not on the kill ring.
    Use case:
        (defvar ora-last-eval-expression-result "")
        (defun ora-last-eval-expression-result ()
          (list ora-last-eval-expression-result))
        (defun ora-eval-expression (orig-fun &rest args)
          (setq ora-last-eval-expression-result
                 (apply orig-fun args))))
        (advice-add 'eval-expression :around #'ora-eval-expression)
 counsel.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index ca21886..fb26f4f 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3722,9 +3722,12 @@ buffer position."
     (setq last-command 'yank)
     (setq yank-window-start (window-start))
-    ;; Avoid unexpected additions to `kill-ring'
-    (let (interprogram-paste-function)
-      (yank-pop (counsel--yank-pop-position s)))
+    (condition-case nil
+        ;; Avoid unexpected additions to `kill-ring'
+        (let (interprogram-paste-function)
+          (yank-pop (counsel--yank-pop-position s)))
+      (error
+       (insert s)))
     (when (funcall (if counsel-yank-pop-after-point #'> #'<)
                    (point) (mark t))
       (exchange-point-and-mark t))))

reply via email to

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