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/playback.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'configs/shared/.emacs.d/wpc/playback.el') diff --git a/configs/shared/.emacs.d/wpc/playback.el b/configs/shared/.emacs.d/wpc/playback.el index 9ab1e30ef0ac..e7ad4b2481a4 100644 --- a/configs/shared/.emacs.d/wpc/playback.el +++ b/configs/shared/.emacs.d/wpc/playback.el @@ -6,20 +6,36 @@ ;;; Code: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Dependencies +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(require 'prelude) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Library +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (defun playback/prev () "Move to the previous song." (interactive) - (shell-command "playerctl previous")) + (prelude/start-process + :name "playback/prev" + :command "playerctl previous")) (defun playback/next () "Move to the next song." (interactive) - (shell-command "playerctl next")) + (prelude/start-process + :name "playback/next" + :command "playerctl next")) (defun playback/play-pause () "Play or pause the current song." (interactive) - (shell-command "playerctl play-pause")) + (prelude/start-process + :name "playback/play-pause" + :command "playerctl play-pause")) (provide 'playback) ;;; playback.el ends here -- cgit 1.4.1