aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2016-05-28 14:06:04 +0300
committerDavid Bremner <david@tethera.net>2016-06-11 13:09:22 -0300
commit65c219560f33d41f094a204c631fb5aa0ff3395e (patch)
tree0096273f31e80ba0d383e7d4a7572adf3f8e5b94
parente401daecab43ff974474319d1f996c03a076d319 (diff)
notmuch-emacs-mua: escape $PWD (and cd always)
Escaping $PWD makes this work in directories like 'foo"bar'... Cd'ing always makes the working directory to be consistent whether --body option was used or not (when using emacsclient, but cd'ing when using emacs does not cause any harm). Note that documentation of `insert-file` expects programs to call `insert-file-contents` instead. In our simple case `insert-file` works better as it does some good checks that we'd have to implement ourselves. Look lisp/files.el in emacs sources for more information.
-rwxr-xr-xnotmuch-emacs-mua6
1 files changed, 4 insertions, 2 deletions
diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 08be145b..f9d83713 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -39,8 +39,10 @@ USE_EMACSCLIENT=
AUTO_DAEMON=
CREATE_FRAME=
+escape -v pwd "$PWD"
+
# The crux of it all: construct an elisp progn and eval it.
-ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"
+ELISP="(prog1 'done (require 'notmuch) (cd \"$pwd\") (notmuch-mua-new-mail)"
# Short options compatible with mutt(1).
while getopts :s:c:b:i:h opt; do
@@ -95,7 +97,7 @@ while getopts :s:c:b:i:h opt; do
ELISP="${ELISP} (message-goto-bcc) (insert \"${OPTARG}, \")"
;;
--body|i)
- ELISP="${ELISP} (message-goto-body) (cd \"${PWD}\") (insert-file \"${OPTARG}\")"
+ ELISP="${ELISP} (message-goto-body) (insert-file \"${OPTARG}\")"
;;
--print)
PRINT_ONLY=1