emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/with-editor ac6b2e3 085/140: with-editor*: New macro


From: Jonas Bernoulli
Subject: [nongnu] elpa/with-editor ac6b2e3 085/140: with-editor*: New macro
Date: Fri, 6 Aug 2021 12:51:25 -0400 (EDT)

branch: elpa/with-editor
commit ac6b2e3aa219a6e0073341665bee859f19627519
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    with-editor*: New macro
---
 with-editor.el | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]