diff options
Diffstat (limited to 'configs/shared/.emacs.d/wpc/prelude.el')
-rw-r--r-- | configs/shared/.emacs.d/wpc/prelude.el | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/configs/shared/.emacs.d/wpc/prelude.el b/configs/shared/.emacs.d/wpc/prelude.el index fb459627899d..c1579d558985 100644 --- a/configs/shared/.emacs.d/wpc/prelude.el +++ b/configs/shared/.emacs.d/wpc/prelude.el @@ -20,7 +20,6 @@ (require 'dash) (require 'f) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Libraries ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -111,6 +110,22 @@ difficult to troubleshoot bugs in your init files." "Read input from user with PROMPT." (read-string prompt)) +;; TODO: Fix the bug with tokenizing here, since it will split any whitespace +;; character, (even though it shouldn't in the case of quoted string in shell). +;; e.g. - "xmodmap -e 'one two three'" => '("xmodmap" "-e" "'one two three'") +(cl-defun prelude/start-process (&key name command) + "Pass command string, COMMAND, and the function name, NAME. +This is a wrapper around `start-process' that has an API that resembles +`shell-command'." + (let* ((tokens (string/split " " command)) + (program-name (list/head tokens)) + (program-args (list/tail tokens))) + (apply #'start-process + `(,(string/format "*%s<%s>*" program-name name) + ,nil + ,program-name + ,@program-args)))) + (defun prelude/executable-exists? (name) "Return t if CLI tool NAME exists according to `exec-path'." (let ((file (locate-file name exec-path))) |