summaryrefslogtreecommitdiff
path: root/bog.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-12-07 20:29:04 -0500
committerKyle Meyer <kyle@kyleam.com>2014-12-07 20:29:04 -0500
commitba1d2321e87dff688eca44f22c3ee07f3c4efbba (patch)
tree8419bf62da34250874f7f455e636ff01e9e55dfd /bog.el
parentc56fa21bd478f1b8d0de1f2e344b25ee92a7c47b (diff)
downloadbog-ba1d2321e87dff688eca44f22c3ee07f3c4efbba.tar.gz
Update commander for upstream changes
See Projectile commit 2fd7ec96465aea135ff9017ce7f2001f870f7765.
Diffstat (limited to 'bog.el')
-rw-r--r--bog.el25
1 files changed, 8 insertions, 17 deletions
diff --git a/bog.el b/bog.el
index 130a1c1..d0d3b51 100644
--- a/bog.el
+++ b/bog.el
@@ -835,20 +835,11 @@ to invoke. Press \"?\" to describe available actions.
See `def-bog-commander-method' for defining new methods."
(interactive)
- (message "Commander [%s]: "
- (apply #'string (mapcar #'car bog-commander-methods)))
- (let* ((ch (save-window-excursion
- (select-window (minibuffer-window))
- (read-char)))
- (method (cl-find ch bog-commander-methods :key #'car)))
- (cond (method
- (funcall (cl-caddr method)))
- (t
- (message "No method for character: ?\\%c" ch)
- (ding)
- (sleep-for 1)
- (discard-input)
- (bog-commander)))))
+ (-let* ((choices (-map #'car bog-commander-methods))
+ (prompt (concat "Commander [" choices "]: "))
+ (ch (read-char-choice prompt choices))
+ ((_ _ fn) (assq ch bog-commander-methods)))
+ (funcall fn)) )
(defmacro def-bog-commander-method (key description &rest body)
"Define a new `bog-commander' method.
@@ -862,9 +853,9 @@ chosen."
(let ((method `(lambda ()
,@body)))
`(setq bog-commander-methods
- (cl-sort (cons (list ,key ,description ,method)
- (cl-remove ,key bog-commander-methods :key #'car))
- #'< :key #'car))))
+ (--sort (< (car it) (car other))
+ (cons (list ,key ,description ,method)
+ (assq-delete-all ,key bog-commander-methods))))))
(def-bog-commander-method ?? "Commander help buffer."
(ignore-errors (kill-buffer bog-commander-help-buffer))