summary refs log tree commit diff
path: root/emenu.el
diff options
context:
space:
mode:
authorCrazazy2023-12-01 18:11:38 +0100
committerCrazazy2023-12-01 18:11:38 +0100
commit802b49e3b4bf4f365ca18beff0842949b8e3ce11 (patch)
treeebbce3e90e02a0f26f56dfb1a7c1e84ca5e237ea /emenu.el
parenta29cd37c1069cafaeb7ffd4dad98d13ff7d6603f (diff)
formalized the repository a bit
Diffstat (limited to 'emenu.el')
-rw-r--r--emenu.el28
1 files changed, 25 insertions, 3 deletions
diff --git a/emenu.el b/emenu.el
index 6293cf0..85a4bb7 100644
--- a/emenu.el
+++ b/emenu.el
@@ -1,8 +1,30 @@
+;; emenu.el --- An emacs dmenu clone -*- lexical-binding t -*-
+
+;; Copyright © 2022 Erik Oosting
+
+;; Author: Erik Oosting <crazazy@tilde.cafe>
+;; Keywords: application-launcher, misc
+;; URL: https://crazazy.tilde.cafe/emenu.git/log.html
+
+;;; License:
+;; This file comes with the MIT license, and without any warranty whatsoever
+;; You can do with this stuff whatever you want to, but just remember
+;; to put me in the footnote :D. Would be nice at least
+
+;;; Commentary:
+;; This is basically what dmenu does, but then in emacs. There is a function 'all-commands'
+;; that gets you all the commands that are on your system. If you instead want to use emenu
+;; on a different list of strings, you can just pass that list to emenu itself and it will
+;; let you select something yourself
+
 (require 'cl-seq)
 (require 'ido)
 
-(defun all-commands ()
-  "does a completing read of all the programs accessible to you in $PATH"
+(defun emenu--all-commands ()
+  "returns a list of all the programs accessible to you in $PATH"
+  ;; This ls-output part was mostly created by phundrak because he found my shell-piping implementation
+  ;; inelegant. If something has to change about this chances are this is going to return to shell
+  ;; scripting again
   (let ((ls-output (mapcan (lambda (path)
                              (when (file-readable-p path)
                                (cl-remove-if (lambda (file)
@@ -26,7 +48,7 @@
           (call-process
            (ido-completing-read "Command: " (or
                                              command-list
-                                             (all-commands)))
+                                             (emenu--all-commands)))
            nil
            0)
           (keyboard-quit))