aboutsummaryrefslogtreecommitdiff
path: root/emacs/notmuch-lib.el
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-08-29 12:23:29 -0700
committerDavid Bremner <david@tethera.net>2021-09-11 10:16:47 -0300
commita890241138ea468f8a275941b02da39b4e894c1e (patch)
tree8f26ee426bf692f34f2fe49377a0038e3c37af56 /emacs/notmuch-lib.el
parent06477bce03d09353e92cea7a59134b5ac3facae3 (diff)
emacs: wrap process-lines
Initially just set the working directory, to avoid (the implicit) call-process crashing when the default-directory points to a non-existent location. Use of a macro here is over-engineering for this change, but the same change needs to be applied to several other process creation primitives.
Diffstat (limited to 'emacs/notmuch-lib.el')
-rw-r--r--emacs/notmuch-lib.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index c7bb2091..928286c3 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -860,6 +860,15 @@ You may need to restart Emacs or upgrade your notmuch package."))
;; `notmuch-logged-error' does not return.
))))
+(defmacro notmuch--apply-with-env (func &rest args)
+ `(let ((default-directory "~"))
+ (apply ,func ,@args)))
+
+(defun notmuch--process-lines (program &rest args)
+ "Wrap process-lines, binding DEFAULT-DIRECTORY to a safe
+default"
+ (notmuch--apply-with-env #'process-lines program args))
+
(defun notmuch-call-notmuch--helper (destination args)
"Helper for synchronous notmuch invocation commands.