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

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

[elpa] master efa751b 28/90: counsel.el (counsel-M-x): Piggyback on smex


From: Oleh Krehel
Subject: [elpa] master efa751b 28/90: counsel.el (counsel-M-x): Piggyback on smex for sorting
Date: Tue, 30 Jun 2015 07:28:14 +0000

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

    counsel.el (counsel-M-x): Piggyback on smex for sorting
    
    * counsel.el (counsel-M-x): When smex is present, use it for sorting the
      candidates. Also use `counsel-describe-map', so that "C-." and "C-,"
      work for commands.
    
    Re #136
---
 counsel.el |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/counsel.el b/counsel.el
index 097dbdc..a510325 100644
--- a/counsel.el
+++ b/counsel.el
@@ -490,15 +490,27 @@ If a command is bound, add it's binding after it."
 (defun counsel-M-x ()
   "Ivy version of `execute-extended-command'."
   (interactive)
-  (let ((ivy-format-function #'counsel--format-function-M-x))
-    (ivy-read "M-x " obarray
-              :predicate 'commandp
+  (let ((ivy-format-function #'counsel--format-function-M-x)
+        (cands obarray)
+        (pred 'commandp)
+        (sort t))
+    (when (or (featurep 'smex)
+              (package-installed-p 'smex))
+      (require 'smex)
+      (smex-detect-new-commands)
+      (smex-update)
+      (setq cands smex-ido-cache)
+      (setq pred nil)
+      (setq sort nil))
+    (ivy-read "M-x " cands
+              :predicate pred
               :require-match t
               :history 'extended-command-history
               :action
               (lambda (cmd)
                 (execute-extended-command current-prefix-arg cmd))
-              :sort t)))
+              :sort sort
+              :keymap counsel-describe-map)))
 
 (provide 'counsel)
 



reply via email to

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