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

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

[elpa] master 802c9da 271/348: counsel.el: Add counsel-command-history


From: Oleh Krehel
Subject: [elpa] master 802c9da 271/348: counsel.el: Add counsel-command-history
Date: Sat, 8 Apr 2017 11:04:13 -0400 (EDT)

branch: master
commit 802c9dacb5379b8cec8d6751db44ecdf345dc61d
Author: joe di castro <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el: Add counsel-command-history
    
    Fixes #826
---
 counsel.el | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/counsel.el b/counsel.el
index cc7b65d..6290ba7 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3036,6 +3036,31 @@ candidate."
               :caller 'counsel-faces
               :sort t)))
 
+;;** `counsel-command-history'
+(defun counsel-command-history-action-eval (cmd)
+  "Eval the command CMD."
+    (eval (read cmd)))
+
+(defun counsel-command-history-action-edit-and-eval (cmd)
+  "Edit and eval the command CMD."
+    (edit-and-eval-command "Eval: " (read cmd)))
+
+(ivy-set-actions
+ 'counsel-command-history
+ '(("r" counsel-command-history-action-eval           "eval command")
+   ("e" counsel-command-history-action-edit-and-eval  "edit and eval 
command")))
+
+(defun counsel-command-history ()
+  "Show the history of commands."
+  (interactive)
+  (ivy-read "%d Command: "
+            (mapcar (lambda (x)
+                        (format "%s" x))
+                    command-history)
+          :require-match t
+          :action #'counsel-command-history-action-eval
+          :caller 'counsel-command-history))
+
 ;** `counsel-mode'
 (defvar counsel-mode-map
   (let ((map (make-sparse-keymap)))



reply via email to

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