1 Return-Path: <tomi.ollila@iki.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id D2342431FCB
\r
6 for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 10:09:58 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id ok0dBvzcs0f2 for <notmuch@notmuchmail.org>;
\r
16 Wed, 29 Oct 2014 10:09:54 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 9C837431FB6
\r
19 for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 10:09:53 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 51C9F100051
\r
22 for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 19:09:36 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: notmuch@notmuchmail.org
\r
25 Subject: Re: [DRAFT PATCH] modified notmuch-emacs-mua
\r
26 In-Reply-To: <1405026779-29966-1-git-send-email-tomi.ollila@iki.fi>
\r
27 References: <1405026779-29966-1-git-send-email-tomi.ollila@iki.fi>
\r
28 User-Agent: Notmuch/0.18.1+130~ga61922f (http://notmuchmail.org) Emacs/24.3.1
\r
29 (x86_64-unknown-linux-gnu)
\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
31 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
32 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
33 Date: Wed, 29 Oct 2014 19:09:36 +0200
\r
34 Message-ID: <m24mumvm3z.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Wed, 29 Oct 2014 17:09:59 -0000
\r
52 This mail id:1405026779-29966-1-git-send-email-tomi.ollila@iki.fi
\r
53 has not got much attention, probably due it is marked as 'draft'
\r
54 and as it was not marked 'needs-review' in nmbug (this is now changed).
\r
56 As the script is IMO in good condition (is IMO feature-complete and robust)
\r
57 the draftness comes from the commit message being blunt and the namual .rst
\r
60 I've been using this version like 3-10 times per week for quite a long time
\r
61 now. I normaly use the -nw, --to, --subject and --body options to send
\r
62 work-related mail. Just yesterday I was planning to also use the --from
\r
63 option to send email on (mutually agreed) behalf of a colleaque...
\r
65 This is somewhat more complex than the older alternative at
\r
66 id:1404244957-3671-1-git-send-email-david@tethera.net, but addresses
\r
67 the comments I sent in id:m2k37thvq1.fsf@guru.guru-group.fi .
\r
69 I think the script is straightforward enough for anyone who knows
\r
70 shell scripts a bit more than just the shiny surface ;)
\r
72 This script also handles mailto: urls -- I just set firefox to run
\r
73 this script on mailto: links and (in my case) emacs in my X desktop
\r
74 appears with Message buffer filled with initial contents as expected.
\r
75 If mailto: link had body content, then Message buffer was in modified
\r
76 state (otherwise not!), which is a bit PITA to exit in case of accidental
\r
77 clicks. I have a potential "fix" for that in a diff that otherwise contains
\r
78 comment changes below -- whether the fix should be applied is a bit
\r
79 controversial -- is there a chance that some other buffer is set to
\r
80 non-modified state; I tried with emacsclient(1) interface (too) and
\r
81 right buffer was set to non-modified state in this case too...
\r
83 If users are interested to have this version of notmuch-emacs-mua
\r
84 available in future notmuch versions I'll update the manual .rst,
\r
85 pick David's manual building change and write suitable commit message to
\r
86 the forthcoming patch email.
\r
90 First the "commit message" from previous mail and then diff of further
\r
95 > * notmuch-emacs-mua without arguments runs (notmuch-hello)
\r
97 > * runs emacs(1) in case emacsclient(1) fails to connect to running emacs
\r
99 > * takes -nw option
\r
101 > * handles mailto:
\r
103 > * --from option when sending non-mailto: way
\r
105 > * -i includes file --body[= ]string inserts string
\r
108 diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
\r
109 index b1696f7..2dfd160 100755
\r
110 --- a/notmuch-emacs-mua
\r
111 +++ b/notmuch-emacs-mua
\r
112 @@ -24,14 +24,14 @@
\r
116 -# "expand" '\' to '\\' & '"' to '\"'
\r
117 +# "expand" '\' to '\\' and '"' to '\"'
\r
120 OPTARG=${OPTARG//\\/\\\\}; OPTARG=${OPTARG//\"/\\\"}
\r
123 -# ditto, in case there is '\n' sequence in the source, otherwise
\r
124 -# "expand" only trailing '\'s to '\\'s
\r
125 +# ditto, in case there is '\"' sequence in the source,
\r
126 +# otherwise "expand" only trailing '\'s to '\\'s
\r
127 escape_body_optarg ()
\r
130 @@ -54,6 +54,7 @@ exec_mua ()
\r
132 ${X:-exec} "$emacs" $W --eval "$*"
\r
134 + # unused alternative to the above
\r
135 ${X:-exec "$emacs" $W --eval} "$*"
\r
138 @@ -71,9 +72,11 @@ while
\r
142 + # concatenate all args to one string, using ';' as a separator
\r
143 oIFS=$IFS; IFS=; OPTARG="$*" IFS=$oIFS
\r
145 - exec_mua "(progn (require 'notmuch) (browse-url-mail \"$OPTARG\"))"
\r
146 + exec_mua "(progn (require 'notmuch) (browse-url-mail \"$OPTARG\")
\r
147 + (set-buffer (window-buffer)) (set-buffer-modified-p nil))"
\r
151 @@ -176,6 +179,7 @@ done
\r
153 # Positional parameters.
\r
155 + # like escape_optarg, but for 'arg' variable
\r
156 arg=${arg//\\/\\\\}; arg=${arg//\"/\\\"}
\r
157 TO=${TO:+$TO, }${arg}
\r