From 438ff66eed6e698f206c5b5ac454fbb5eb3440b9 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Thu, 16 Jan 2020 01:12:35 +0000 Subject: Support call-process-to-string Writes an Elisp macro to use `call-process` (because it's fast) but capture the output to a string. --- configs/shared/.emacs.d/wpc/prelude.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'configs/shared/.emacs.d/wpc/prelude.el') diff --git a/configs/shared/.emacs.d/wpc/prelude.el b/configs/shared/.emacs.d/wpc/prelude.el index 8bc2f283c7cf..d1031daa19a1 100644 --- a/configs/shared/.emacs.d/wpc/prelude.el +++ b/configs/shared/.emacs.d/wpc/prelude.el @@ -44,6 +44,12 @@ (apply #'string/concat) message)) +(defmacro prelude/call-process-to-string (cmd &rest args) + "Return the string output of CMD called with ARGS." + `(with-temp-buffer + (call-process ,cmd nil (current-buffer) nil ,@args) + (buffer-string))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Assertions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -- cgit 1.4.1