From 802b49e3b4bf4f365ca18beff0842949b8e3ce11 Mon Sep 17 00:00:00 2001 From: Crazazy Date: Fri, 1 Dec 2023 18:11:38 +0100 Subject: formalized the repository a bit --- emenu.el | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'emenu.el') 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 +;; 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)) -- cgit 1.4.1-2-gfad0