aboutsummaryrefslogtreecommitdiffstats
path: root/mail/notmuch/files/patch-emacs_notmuch-emacs-mua
blob: 56878a4b1648ba835cc4b7c23198d9e84b152047 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- emacs/notmuch-emacs-mua.orig    2017-07-18 20:34:56 UTC
+++ emacs/notmuch-emacs-mua
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
 #
 # notmuch-emacs-mua - start composing a mail on the command line
 #
@@ -26,8 +26,8 @@ set -eu
 # calling convention: escape -v var "$arg" (like in bash printf).
 escape ()
 {
-    local __escape_arg__=${3//\\/\\\\}
-    printf -v $2 '%s' "${__escape_arg__//\"/\\\"}"
+    __escape_arg__="$(printf '%s' "$3" | sed -e 's|\\|\\\\|g' -e 's|\"|\\\"|g')"
+    eval "$2=\$__escape_arg__"
 }
 
 EMACS=${EMACS:-emacs}
@@ -150,14 +150,14 @@ if [ -n "${MAILTO}" ]; then
    exit 1
     fi
     ELISP="(browse-url-mail \"${MAILTO}\")"
-elif [ -z "${ELISP}" -a -n "${HELLO}" ]; then
+elif [ -z "${ELISP}" ] && [ -n "${HELLO}" ]; then
     ELISP="(notmuch)"
 else
     ELISP="(notmuch-mua-new-mail) ${ELISP}"
 fi
 
 # Kill the terminal/frame if we're creating one.
-if [ -z "$USE_EMACSCLIENT" -o -n "$CREATE_FRAME" -o -n "$NO_WINDOW" ]; then
+if [ -z "$USE_EMACSCLIENT" ] || [ -n "$CREATE_FRAME" ] || [ -n "$NO_WINDOW" ]; then
     ELISP="${ELISP} (message-add-action #'save-buffers-kill-terminal 'exit)"
 fi