Skip to content

Commit

Permalink
User option to ignore clues to menu bar bindings
Browse files Browse the repository at this point in the history
(Suggested by Philipp Haselwarter)
  • Loading branch information
nonsequitur committed Oct 2, 2011
1 parent 1671553 commit 34b341c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.markdown
Expand Up @@ -78,6 +78,9 @@ Smex keeps track of.
### Prompt
Set `smex-prompt-string` for a custom prompt.

### Ignore menu bar bindings
Enable `smex-key-advice-ignore-menu-bar` to ignore clues to menu bar bindings.

## Appendix

Smex is my first venture into Elisp. I'd be glad to receive patches,
Expand Down
11 changes: 10 additions & 1 deletion smex.el
Expand Up @@ -25,7 +25,7 @@
;; http://github.com/nonsequitur/smex/blob/master/README.markdown

(require 'ido)
;; Provides `union' and `dolist'.
;; Provides `union', `dolist' and `delete-if'.
(require 'cl)

(defgroup smex nil
Expand Down Expand Up @@ -60,6 +60,11 @@ Must be set before initializing Smex."
:type 'string
:group 'smex)

(defcustom smex-key-advice-ignore-menu-bar nil
"If non-nil, `smex-key-advice' ignores `menu-bar' bindings"
:type 'boolean
:group 'smex)

(defvar smex-cache)
(defvar smex-ido-cache)
(defvar smex-data)
Expand Down Expand Up @@ -364,6 +369,10 @@ Returns nil when reaching the end of the list."

(defun smex-key-advice (command)
(let ((keys (where-is-internal command)))
(if smex-key-advice-ignore-menu-bar
(setq keys (delete-if
(lambda (vect) (equal (aref vect 0) 'menu-bar))
keys)))
(if keys
(format "You can run the command `%s' with %s"
command
Expand Down

0 comments on commit 34b341c

Please sign in to comment.