Browse files

Move cryptic keybinding code into separate function

Drop 'delete-if' to get rid of the 'cl dependency.
  • Loading branch information...
1 parent 4923b99 commit 7c6fb9ce2cd1f5b7f7223294495c7ff4de9a8bae @nonsequitur committed Aug 11, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 smex.el
10 smex.el
@@ -405,14 +405,18 @@ 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)))
+ (setq keys (smex-filter-out-menu-bar-bindings keys)))
(if keys
(format "You can run the command `%s' with %s"
(mapconcat 'key-description keys ", ")))))
+(defsubst smex-filter-out-menu-bar-bindings (keys)
+ (delq nil (mapcar (lambda (key-vec)
+ (unless (equal (aref key-vec 0) 'menu-bar)
+ key-vec))
+ keys)))
(defun smex-unlogged-message (string)
"Bypasses logging in *Messages*"
(let (message-log-max)

0 comments on commit 7c6fb9c

Please sign in to comment.