about summary refs log tree commit diff
path: root/configs/shared
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-01-16T01·12+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-17T10·56+0000
commit438ff66eed6e698f206c5b5ac454fbb5eb3440b9 (patch)
tree9765441c707f8035ded71f85ec1b93f77bcdb728 /configs/shared
parent34c9d74335980e329e6a027504946e9b650fa103 (diff)
Support call-process-to-string
Writes an Elisp macro to use `call-process` (because it's fast) but capture the
output to a string.
Diffstat (limited to 'configs/shared')
-rw-r--r--configs/shared/.emacs.d/wpc/prelude.el6
1 files changed, 6 insertions, 0 deletions
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
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;