From fa681ffdf091143f85f83db21f54b3e374fd296f Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 18 Jan 2020 22:34:55 +0000 Subject: Use assert in prelude/start-process Since the tokenizing isn't working as expected, my keyboard.el function keyboard/swap-caps-lock-and-escape was silenting failing. I'm adding a prelude/refute in that function to make the failures noisy until the tokenizing is properly supported. --- configs/shared/.emacs.d/wpc/keyboard.el | 2 ++ configs/shared/.emacs.d/wpc/prelude.el | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'configs/shared') diff --git a/configs/shared/.emacs.d/wpc/keyboard.el b/configs/shared/.emacs.d/wpc/keyboard.el index 176ac074dcd0..1323f2835675 100644 --- a/configs/shared/.emacs.d/wpc/keyboard.el +++ b/configs/shared/.emacs.d/wpc/keyboard.el @@ -65,6 +65,8 @@ (defun keyboard/swap-caps-lock-and-escape () "Swaps the caps lock and escape keys using xmodmap." (interactive) + ;; TODO: Ensure these work once the tokenizing in prelude/start-process works + ;; as expected. (prelude/start-process :name "keyboard/swap-caps-lock-and-escape" :command "xmodmap -e 'remove Lock = Caps_Lock'") diff --git a/configs/shared/.emacs.d/wpc/prelude.el b/configs/shared/.emacs.d/wpc/prelude.el index d1031daa19a1..c1039c80a34d 100644 --- a/configs/shared/.emacs.d/wpc/prelude.el +++ b/configs/shared/.emacs.d/wpc/prelude.el @@ -116,13 +116,14 @@ 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'." + ;; 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'") + (prelude/refute (string/contains? "'" command)) (let* ((tokens (string/split " " command)) (program-name (list/head tokens)) (program-args (list/tail tokens))) -- cgit 1.4.1