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

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

[elpa] externals/ivy-hydra 4ba0944 064/395: counsel.el (counsel-set-vari


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 4ba0944 064/395: counsel.el (counsel-set-variable): Save expr to the kill ring
Date: Thu, 25 Feb 2021 08:31:32 -0500 (EST)

branch: externals/ivy-hydra
commit 4ba0944bec05c22d695fd5b89527160603649d62
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    counsel.el (counsel-set-variable): Save expr to the kill ring
---
 counsel.el       | 10 +++++++---
 targets/plain.el |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index 7547aba..c5cbc9b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -627,13 +627,14 @@ to `ivy-highlight-face'."
                      (insert (format "%S " sym)))
                  (read-from-minibuffer "Eval: "
                                        (format
-                                        (if (and sym-value (consp sym-value))
+                                        (if (and sym-value (or (consp 
sym-value)
+                                                               (symbolp 
sym-value)))
                                             "(setq '%S)"
                                           "(setq %S)")
                                         sym-value)
                                        read-expression-map t
                                        'read-expression-history))))
-    (eval-expression expr)))
+    expr))
 
 (defun counsel--setq-doconst (x)
   "Return a cons of description and value for X.
@@ -710,12 +711,15 @@ With a prefix arg, restrict list to variables defined 
using
                          (if (assoc res cands)
                              (cdr (assoc res cands))
                            (read res)))
+                   (kill-new (format "(setq %S %S)" sym res))
                    (set sym (if (and (listp res) (eq (car res) 'quote))
                                 (cadr res)
                               res))))
              (unless (boundp sym)
                (set sym nil))
-             (counsel-read-setq-expression sym)))
+             (let ((expr (counsel-read-setq-expression sym)))
+               (kill-new (prin1-char expr))
+               (eval-expression expr))))
       (when doc
         (lv-delete-window)))))
 
diff --git a/targets/plain.el b/targets/plain.el
index 140db3e..7b3a27b 100644
--- a/targets/plain.el
+++ b/targets/plain.el
@@ -6,4 +6,5 @@
 (global-set-key (kbd "C-s") 'swiper)
 (global-set-key (kbd "C-c j") 'counsel-git-grep)
 (global-set-key (kbd "C-c k") 'counsel-rg)
+(global-set-key (kbd "<f2> j") 'counsel-set-variable)
 (global-set-key (kbd "C-c s") 'isearch-forward-regexp)



reply via email to

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