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

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

[elpa] master e037fb0 101/167: counsel.el (counsel-M-x): Show current-pr


From: Oleh Krehel
Subject: [elpa] master e037fb0 101/167: counsel.el (counsel-M-x): Show current-prefix-arg in the prompt
Date: Tue, 08 Dec 2015 10:50:17 +0000

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

    counsel.el (counsel-M-x): Show current-prefix-arg in the prompt
    
    * counsel.el (counsel--M-x-prompt): New defun.
    (counsel-M-x): Update.
    
    Fixes #287
---
 counsel.el |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index dee0e59..9ed334a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -830,6 +830,20 @@ CMD is a command name."
 (declare-function smex-update "ext:smex")
 (declare-function smex-rank "ext:smex")
 
+(defun counsel--M-x-prompt ()
+  "M-x plus the string representation of `current-prefix-arg'."
+  (if (not current-prefix-arg)
+      "M-x "
+    (concat
+     (if (eq current-prefix-arg '-)
+         "- "
+       (if (integerp current-prefix-arg)
+           (format "%d " current-prefix-arg)
+         (if (= (car current-prefix-arg) 4)
+             "C-u "
+           (format "%d " (car current-prefix-arg)))))
+     "M-x ")))
+
 ;;;###autoload
 (defun counsel-M-x (&optional initial-input)
   "Ivy version of `execute-extended-command'.
@@ -856,7 +870,7 @@ Optional INITIAL-INPUT is the initial input in the 
minibuffer."
       (setq cands smex-ido-cache)
       (setq pred nil)
       (setq sort nil))
-    (ivy-read "M-x " cands
+    (ivy-read (counsel--M-x-prompt) cands
               :predicate pred
               :require-match t
               :history 'extended-command-history



reply via email to

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