branch: master
commit e9bb58348f48f9de0f592a0c0c1e878530eb4bb6
Author: Sebastian Christ <[email protected]>
Commit: Sebastian Christ <[email protected]>

    counsel.el (counsel-M-x): Don't rebuild cache on every invocation.
    
    The `smex-ido-cache' needs only be rebuild when new commands has been
    detected. So, check first if new commands available and then update
    smex.
    
    This should speed up sequential invocations of `counsel-M-x'.
---
 counsel.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index 6bd25a7..1b2a7c3 100644
--- a/counsel.el
+++ b/counsel.el
@@ -773,8 +773,8 @@ Optional INITIAL-INPUT is the initial input in the 
minibuffer."
     (when (require 'smex nil 'noerror)
       (unless smex-initialized-p
         (smex-initialize))
-      (smex-detect-new-commands)
-      (smex-update)
+      (when (smex-detect-new-commands)
+        (smex-update))
       (setq cands smex-ido-cache)
       (setq pred nil)
       (setq sort nil))

Reply via email to