From 5785a5d126210e8c9651da038b6c8b083041fef6 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 23 Dec 2019 17:31:42 +0000 Subject: 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 ''` calls, which isn't too disruptive. --- configs/shared/.emacs.d/wpc/screen-brightness.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'configs/shared/.emacs.d/wpc/screen-brightness.el') diff --git a/configs/shared/.emacs.d/wpc/screen-brightness.el b/configs/shared/.emacs.d/wpc/screen-brightness.el index 8183196cccbc..715fc7baee35 100644 --- a/configs/shared/.emacs.d/wpc/screen-brightness.el +++ b/configs/shared/.emacs.d/wpc/screen-brightness.el @@ -8,6 +8,12 @@ ;; TODO: Define some isomorphisms. E.g. int->string, string->int. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Dependencies +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(require 'prelude) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -25,23 +31,17 @@ (defun screen-brightness/increase () "Increase the screen brightness." (interactive) - (start-process - "*xbacklight*" - nil - "xbacklight" - "-inc" - (int-to-string screen-brightness/step-size)) + (prelude/start-process + :name "screen-brightness/increase" + :command (string/format "xbacklight -inc %s" screen-brightness/step-size)) (message "[screen-brightness.el] Increased screen brightness.")) (defun screen-brightness/decrease () "Decrease the screen brightness." (interactive) - (start-process - "*xbacklight*" - nil - "xbacklight" - "-dec" - (int-to-string screen-brightness/step-size)) + (prelude/start-process + :name "screen-brightness/decrease" + :command (string/format "xbacklight -dec %s" screen-brightness/step-size)) (message "[screen-brightness.el] Decreased screen brightness.")) (when screen-brightness/install-kbds? -- cgit 1.4.1