Skip to content

Commit

Permalink
[Refactor] parse-keymap
Browse files Browse the repository at this point in the history
Use `push'. Explicitly pass the output variable `commands'.
  • Loading branch information
purcell authored and nonsequitur committed Apr 21, 2013
1 parent 45fb863 commit 068339e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions smex.el
Expand Up @@ -436,16 +436,16 @@ Returns nil when reaching the end of the list."

(defun smex-extract-commands-from-keymap (map)
(let (commands)
(smex-parse-keymap map)
(smex-parse-keymap map commands)
commands))

(defun smex-parse-keymap (map)
(defun smex-parse-keymap (map commands)
(map-keymap (lambda (binding element)
(if (and (listp element) (eq 'keymap (car element)))
(smex-parse-keymap element)
(smex-parse-keymap element commands)
; Strings are commands, too. Reject them.
(if (and (symbolp element) (commandp element))
(setq commands (cons element commands)))))
(push element commands))))
map))

(defun smex-extract-commands-from-features (mode)
Expand Down

0 comments on commit 068339e

Please sign in to comment.