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/display.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/display.el')
-rw-r--r-- | configs/shared/.emacs.d/wpc/display.el | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/configs/shared/.emacs.d/wpc/display.el b/configs/shared/.emacs.d/wpc/display.el index 716f3e5f5742..7f2f5e034609 100644 --- a/configs/shared/.emacs.d/wpc/display.el +++ b/configs/shared/.emacs.d/wpc/display.el @@ -14,6 +14,12 @@ ;;; Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Dependencies +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(require 'prelude) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -31,17 +37,18 @@ (defun display/enable-4k () "Attempt to connect to my 4K monitor." (interactive) - (shell-command - (string/format "xrandr --output %s --dpi 144 --auto --right-of %s" - display/4k - display/primary))) + (prelude/start-process + :name "display" + :command (string/format "xrandr --output %s --dpi 144 --auto --right-of %s" + display/4k + display/primary))) (defun display/disable-4k () "Disconnect from the 4K monitor." (interactive) - (shell-command - (string/format "xrandr --output %s --off" - display/4k))) + (prelude/start-process + :name "display/disable-4k" + :command (string/format "xrandr --output %s --off" display/4k))) (provide 'display) ;;; display.el ends here |