diff options
author | William Carroll <wpcarro@gmail.com> | 2019-12-23T17·31+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-01-06T15·25+0000 |
commit | 5785a5d126210e8c9651da038b6c8b083041fef6 (patch) | |
tree | 2303a7bc5b7928b528e06e1abb899119882c15bb /configs/shared/.emacs.d/wpc/keyboard.el | |
parent | c078f0452666e4d7a03d234393ccec7210a86642 (diff) |
Support prelude/start-process
If you refer to the previous commit where I change shell-command usages to start-process function calls, you'll see the rationale for why I prefer start-process. This commit introduces a more ergonomic API for start-process that fits most of my current use-cases of it. This cleans up the code. I have introduced a bug in the way that I'm tokenizing the COMMAND value. I've tracked that with a TODO. For now it only affects the `xmodmap -e '<command-string>'` calls, which isn't too disruptive.
Diffstat (limited to 'configs/shared/.emacs.d/wpc/keyboard.el')
-rw-r--r-- | configs/shared/.emacs.d/wpc/keyboard.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/configs/shared/.emacs.d/wpc/keyboard.el b/configs/shared/.emacs.d/wpc/keyboard.el index ac778d1698d8..176ac074dcd0 100644 --- a/configs/shared/.emacs.d/wpc/keyboard.el +++ b/configs/shared/.emacs.d/wpc/keyboard.el @@ -51,8 +51,9 @@ (rate keyboard/repeat-rate) (delay keyboard/repeat-delay)) "Use xset to set the key-repeat RATE and DELAY." - (shell-command - (string/format "xset r rate %s %s" delay rate))) + (prelude/start-process + :name "keyboard/set-key-repeat" + :command (string/format "xset r rate %s %s" delay rate))) ;; NOTE: Settings like this are machine-dependent. For instance I only need to ;; do this on my laptop and other devices where I don't have access to my split @@ -64,8 +65,12 @@ (defun keyboard/swap-caps-lock-and-escape () "Swaps the caps lock and escape keys using xmodmap." (interactive) - (shell-command "xmodmap -e 'remove Lock = Caps_Lock'") - (shell-command "xmodmap -e 'keysym Caps_Lock = Escape'")) + (prelude/start-process + :name "keyboard/swap-caps-lock-and-escape" + :command "xmodmap -e 'remove Lock = Caps_Lock'") + (prelude/start-process + :name "keyboard/swap-caps-lock-and-escape" + :command "xmodmap -e 'keysym Caps_Lock = Escape'")) (defun keyboard/inc-repeat-rate () "Increment `keyboard/repeat-rate'." |