diff options
author | Crazazy | 2022-02-03 18:52:18 +0100 |
---|---|---|
committer | Crazazy | 2022-02-10 16:13:34 +0100 |
commit | 9084be4a037fbb7a8770c7a94eace8ec89e05271 (patch) | |
tree | b469647006b5056fbf86bc686b6f288ae6822656 | |
parent | 97a505c09f6b5ca9d993fd2abb4799ba0a99a0a8 (diff) |
add emenu
-rw-r--r-- | emacs.org | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/emacs.org b/emacs.org index b79d407..3acdef4 100644 --- a/emacs.org +++ b/emacs.org @@ -312,15 +312,44 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto ** Other, less useful stuff *** Themes I like to have a nice theme in my setup - #+begin_src emacs-lisp :tangle misc.el + #+begin_src emacs-lisp :tangle emacsconfig/misc.el (use-package flatland-theme :config (load-theme 'flatland)) #+end_src *** Discord My discord buddies /have/ to know I'm using emacs whenever I have my computer running - #+begin_src emacs-lisp :tangle misc.el + #+begin_src emacs-lisp :tangle emacsconfig/misc.el (use-package elcord :config (elcord-mode)) #+end_src +*** Emenu + Since I'm using emacs as a daemon, it can also be benefical to make an application launcer + #+begin_src emacs-lisp :tangle emacsconfig/misc.el + (defun all-commands () + "does a completing read of all the programs accessible to you in $PATH" + (let ((ls-output (mapcan (lambda (path) + (when (file-readable-p path) + (cl-remove-if (lambda (file) + (let ((fullpath (concat path "/" file))) + (or (file-directory-p fullpath) + (not (file-executable-p fullpath))))) + (directory-files path nil directory-files-no-dot-files-regexp nil)))) + (split-string (getenv "PATH") ":" t))) + (alias-output (split-string (shell-command-to-string "alias -p | sed -E 's/^alias ([^=]*)=.*$/\1/'") "\n"))) + (ido-completing-read "Command: " (append ls-output alias-output)))) + + (defun emenu () + "A dmenu-inspired application launcher using a separate emacs frame" + (interactive) + (with-selected-frame (make-frame '((name . "emenu") + (minibuffer . only) + (width . 151) + (height . 1))) + (unwind-protect + (progn + (call-process (all-commands) nil 0) + (keyboard-quit)) + (delete-frame)))) + #+end_src |