summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2018-10-26 15:47:38 +0200
committerJonas Bernoulli <jonas@bernoul.li>2018-10-26 15:47:38 +0200
commitac6b2e3aa219a6e0073341665bee859f19627519 (patch)
tree484dbad0bf5ead811e809539056567daba39616e
parentf69daaf0acd9096bd3758fdc73a34b1a48d9c4f1 (diff)
with-editor*: New macro
-rw-r--r--with-editor.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/with-editor.el b/with-editor.el
index 88c55ba..2f6fcca 100644
--- a/with-editor.el
+++ b/with-editor.el
@@ -448,7 +448,8 @@ or \\[with-editor-cancel] to cancel"))))))
"Use the Emacsclient as $EDITOR while evaluating BODY.
Modify the `process-environment' for processes started in BODY,
instructing them to use the Emacsclient as $EDITOR. If optional
-ENVVAR is provided then bind that environment variable instead.
+ENVVAR is a literal string then bind that environment variable
+instead.
\n(fn [ENVVAR] BODY...)"
(declare (indent defun) (debug (body)))
`(let ((with-editor--envvar ,(if (stringp (car body))
@@ -458,6 +459,19 @@ ENVVAR is provided then bind that environment variable instead.
(with-editor--setup)
,@body))
+(defmacro with-editor* (envvar &rest body)
+ "Use the Emacsclient as the editor while evaluating BODY.
+Modify the `process-environment' for processes started in BODY,
+instructing them to use the Emacsclient as editor. ENVVAR is the
+environment variable that is exported to do so, it is evaluated
+at run-time.
+\n(fn [ENVVAR] BODY...)"
+ (declare (indent defun) (debug (body)))
+ `(let ((with-editor--envvar ,envvar)
+ (process-environment process-environment))
+ (with-editor--setup)
+ ,@body))
+
(defun with-editor--setup ()
(if (or (not with-editor-emacsclient-executable)
(file-remote-p default-directory))