Question

I use abbrev-mode, smex, and ido-mode. How do I turn off abbrev-mode in the minibuffer for when I smex a command?

Was it helpful?

Solution

This piece of code disables abbrev when you enter the minibuffer, then enables it again when you leave it.

(defun conditionally-disable-abbrev ()
  ""
  (if (string-match "smex-" (format "%s" this-command))
      (abbrev-mode -1)))

(add-hook 'minibuffer-setup-hook 'conditionally-disable-abbrev)
(add-hook 'minibuffer-exit-hook (lambda () (abbrev-mode 1)))

Added the fix by juanleon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top