From eb0909b7e17be5e52f2c7ef8209b867df8450824 Mon Sep 17 00:00:00 2001 From: "Ryan C. Thompson" Date: Sun, 12 Mar 2017 00:07:16 -0800 Subject: [PATCH] Add smex-mode, a global minor mode Fixes #11. The minor mode currently only remaps "execute-extended-command" to "smex". It doesn't add bindings for the other smex commands such as "smex-major-mode-commands". --- smex.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/smex.el b/smex.el index 6d4a72b..b8ae80d 100644 --- a/smex.el +++ b/smex.el @@ -35,6 +35,19 @@ :group 'convenience :link '(emacs-library-link :tag "Lisp File" "smex.el")) +;;;###autoload +(define-minor-mode smex-mode + "Use ido completion for M-x" + :global t + :group 'smex + (if smex-mode + (progn + (unless smex-initialized-p + (smex-initialize)) + (global-set-key [remap execute-extended-command] 'smex)) + (when (eq (global-key-binding [remap execute-extended-command]) 'smex) + (global-unset-key [remap execute-extended-command])))) + (defcustom smex-auto-update t "If non-nil, `Smex' checks for new commands each time it is run. Turn it off for minor speed improvements on older systems."