summary refs log tree commit diff
diff options
context:
space:
mode:
authorCrazazy2023-12-01 18:11:39 +0100
committerCrazazy2023-12-01 18:11:39 +0100
commitcab4697d79e9f6af82bcaa9e182eb28aba8b36f0 (patch)
tree241bf7eb9ac38231c3f3758c657702df9bf9d944
parentf48fbcbbdaa694bdba1857483c293494b65ff879 (diff)
modularized emenu a bit better HEAD master
-rw-r--r--emenu.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/emenu.el b/emenu.el
index 9d464e4..8d8b92a 100644
--- a/emenu.el
+++ b/emenu.el
@@ -1,6 +1,6 @@
 ;;; emenu.el --- An emacs dmenu clone -*- lexical-binding: t; -*-
 
-;; Copyright © 2022 Erik Oosting
+;; Copyright © 2023 Erik Oosting
 
 ;; Author: Erik Oosting <crazazy@tilde.cafe>
 ;; Keywords: application-launcher, misc
@@ -39,21 +39,20 @@
     (append ls-output alias-output)))
 
 ;;;###autoload
-(defun emenu (&optional command-list)
+(defun emenu (action &optional command-list)
   "A dmenu-inspired application launcher using a separate emacs frame"
-  (interactive)
+  (interactive (list (lambda (command) (call-process command nil 0))))
   (with-selected-frame (make-frame '((name . "emenu")
                                      (minibuffer . only)
                                      (width . 151)
                                      (height . 1)))
     (unwind-protect
         (progn
-          (call-process
-           (ido-completing-read "Command: " (or
-                                             command-list
-                                             (emenu--all-commands)))
-           nil
-           0)
+          (funcall action
+                   (ido-completing-read
+                    "Command: " (or
+                                 command-list
+                                 (emenu--all-commands))))
           (keyboard-quit))
       (delete-frame))))