Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / a8 / 5a44b3558ec6f5c4eda5ec4065786454d76033
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 arlo.cworth.org (Postfix) with ESMTP id 6C0E06DE0AC7\r
6  for <notmuch@notmuchmail.org>; Sun, 10 May 2015 11:45:49 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 1.08\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.08 tagged_above=-999 required=5 tests=[AWL=0.428,\r
12  SPF_NEUTRAL=0.652] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id tA4v0pKgR6NV for <notmuch@notmuchmail.org>;\r
16  Sun, 10 May 2015 11:45:46 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18  by arlo.cworth.org (Postfix) with ESMTP id 4936C6DE02C9\r
19  for <notmuch@notmuchmail.org>; Sun, 10 May 2015 11:45:45 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21  by guru.guru-group.fi (Postfix) with ESMTP id A7371100046;\r
22  Sun, 10 May 2015 21:45:20 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Jani Nikula <jani@nikula.org>, Jani Nikula <jani@nikula.org>,\r
25  notmuch@notmuchmail.org\r
26 Subject: Re: [PATCH] notmuch-emacs-mua: do not create a frame by default with\r
27  --client\r
28 In-Reply-To: <1431194464-2595-1-git-send-email-jani@nikula.org>\r
29 References: <m2twwt9zn6.fsf@guru.guru-group.fi>\r
30  <1431194464-2595-1-git-send-email-jani@nikula.org>\r
31 User-Agent: Notmuch/0.19+115~g9a981cb (http://notmuchmail.org) Emacs/24.3.1\r
32  (x86_64-unknown-linux-gnu)\r
33 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
34  $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
35  !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
36 Date: Sun, 10 May 2015 21:45:20 +0300\r
37 Message-ID: <m2zj5cw9tr.fsf@guru.guru-group.fi>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.18\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44  <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Sun, 10 May 2015 18:45:49 -0000\r
53 \r
54 On Sat, May 09 2015, Jani Nikula <jani@nikula.org> wrote:\r
55 \r
56 > Make the default behaviour for --client the same as emacsclient\r
57 > default: do not create a new frame. Add a new option --create-frame,\r
58 > passing the same option to emacsclient to create a frame.\r
59 \r
60 I apologize for not testing the previous version beyond the initial failure\r
61 of running notmuch-emacs-mua w/o the --client...\r
62 \r
63 ... as now further testing shows IMO a expectation problem when plain\r
64 --client argument is given -- it behaves similar to\r
65 \r
66 emacsclient -a '' --no-wait /dev/null\r
67 \r
68 (currently I don't have access to X environment so I cannot check this\r
69 fully, anyway try this without emacs server running to see yourselves)\r
70 \r
71 IMO the interface would be cleaner if these would pairs be somewhat analogous:\r
72 \r
73 \r
74 notmuch-emacs-mua --client\r
75 emacsclient -a '' /dev/null\r
76 \r
77 and\r
78 \r
79 notmuch-emacs-mua --client --no-wait\r
80 emacsclient -a '' --no-wait /dev/null\r
81 \r
82 \r
83 this also makes documentation so much easier\r
84 \r
85 \r
86 Tomi\r
87 \r
88 \r
89 \r
90 >\r
91 > ---\r
92 >\r
93 > v2: fix killing frame with --create-frame\r
94 >\r
95 > v3: fix --create-frame w/o --client parameter check\r
96 > ---\r
97 >  doc/man1/notmuch-emacs-mua.rst | 14 +++++++++-----\r
98 >  notmuch-emacs-mua              | 30 +++++++++++++++++++++---------\r
99 >  2 files changed, 30 insertions(+), 14 deletions(-)\r
100 >\r
101 > diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst\r
102 > index 36b51cdc3b18..e39d9e5fba1f 100644\r
103 > --- a/doc/man1/notmuch-emacs-mua.rst\r
104 > +++ b/doc/man1/notmuch-emacs-mua.rst\r
105 > @@ -18,10 +18,6 @@ Supported options for **notmuch-emacs-mua** include\r
106 >      ``-h, --help``\r
107 >          Display help.\r
108 >\r
109 > -    ``--client``\r
110 > -        Use emacsclient, rather than emacs. This will start\r
111 > -        an emacs daemon process if necessary.\r
112 > -\r
113 >      ``-s, --subject=``\ <subject>\r
114 >          Specify the subject of the message.\r
115 >\r
116 > @@ -38,7 +34,15 @@ Supported options for **notmuch-emacs-mua** include\r
117 >          Specify a file to include into the body of the message.\r
118 >\r
119 >      ``--no-window-system``\r
120 > -        Even if a window system is available, use the current terminal\r
121 > +        Even if a window system is available, use the current terminal.\r
122 > +\r
123 > +    ``--client``\r
124 > +        Use **emacsclient**, rather than **emacs**. This will start\r
125 > +        an emacs daemon process if necessary.\r
126 > +\r
127 > +    ``--create-frame``\r
128 > +         When --client is specified, create a new frame instead of trying\r
129 > +         to use the current Emacs frame.\r
130 >\r
131 >      ``--print``\r
132 >          Output the resulting elisp to stdout instead of evaluating it.\r
133 > diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua\r
134 > index 79714305b3e2..102410a23f3e 100755\r
135 > --- a/notmuch-emacs-mua\r
136 > +++ b/notmuch-emacs-mua\r
137 > @@ -34,12 +34,12 @@ EMACS=${EMACS-emacs}\r
138 >  EMACSCLIENT=${EMACSCLIENT-emacsclient}\r
139 >\r
140 >  PRINT_ONLY=\r
141 > +NO_WINDOW=\r
142 >  USE_EMACSCLIENT=\r
143 > -CLIENT_TYPE="-c"\r
144 > +CREATE_FRAME=\r
145 >\r
146 >  # The crux of it all: construct an elisp progn and eval it.\r
147 >  ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"\r
148 > -ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
149 >\r
150 >  # Short options compatible with mutt(1).\r
151 >  while getopts :s:c:b:i:h opt; do\r
152 > @@ -63,7 +63,7 @@ while getopts :s:c:b:i:h opt; do\r
153 >                   opt=${opt%%=*}\r
154 >                   ;;\r
155 >               # Long options without arguments.\r
156 > -             --help|--print|--no-window-system|--client)\r
157 > +             --help|--print|--no-window-system|--client|--create-frame)\r
158 >                   ;;\r
159 >               *)\r
160 >                   echo "$0: unknown long option ${opt}, or argument mismatch." >&2\r
161 > @@ -81,9 +81,6 @@ while getopts :s:c:b:i:h opt; do\r
162 >       --help|h)\r
163 >           exec man notmuch-emacs-mua\r
164 >           ;;\r
165 > -     --client)\r
166 > -         USE_EMACSCLIENT="yes"\r
167 > -         ;;\r
168 >       --subject|s)\r
169 >           ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")"\r
170 >           ;;\r
171 > @@ -103,7 +100,13 @@ while getopts :s:c:b:i:h opt; do\r
172 >           PRINT_ONLY=1\r
173 >           ;;\r
174 >       --no-window-system)\r
175 > -         CLIENT_TYPE="-t"\r
176 > +         NO_WINDOW="-nw"\r
177 > +         ;;\r
178 > +     --client)\r
179 > +         USE_EMACSCLIENT="yes"\r
180 > +         ;;\r
181 > +     --create-frame)\r
182 > +         CREATE_FRAME="--create-frame"\r
183 >           ;;\r
184 >       *)\r
185 >           # We should never end up here.\r
186 > @@ -122,6 +125,15 @@ for arg; do\r
187 >      ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"\r
188 >  done\r
189 >\r
190 > +# If reusing a frame in emacsclient, don't kill the buffer.\r
191 > +if [ -n "$CREATE_FRAME" ]; then\r
192 > +    if [ -z "$USE_EMACSCLIENT" ]; then\r
193 > +     echo "$0: --create-frame is only applicable with --client." >&2\r
194 > +     exit 1\r
195 > +    fi\r
196 > +    ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
197 > +fi\r
198 > +\r
199 >  # End progn.\r
200 >  ELISP="${ELISP})"\r
201 >\r
202 > @@ -132,7 +144,7 @@ fi\r
203 >\r
204 >  if [ -n "$USE_EMACSCLIENT" ]; then\r
205 >      # Evaluate the progn.\r
206 > -    exec ${EMACSCLIENT} ${CLIENT_TYPE} -a '' --eval "${ELISP}"\r
207 > +    exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} -a '' --eval "${ELISP}"\r
208 >  else\r
209 > -    exec ${EMACS} --eval "${ELISP}"\r
210 > +    exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"\r
211 >  fi\r
212 > --\r
213 > 2.1.4\r