Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 61 / c73cd59d4d563ea5cd175778cbcae512050b59
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 9EB936DE0AF8\r
6  for <notmuch@notmuchmail.org>; Fri, 28 Aug 2015 12:19:52 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.835\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.835 tagged_above=-999 required=5 tests=[AWL=0.183, \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 hPmKsDw91emK for <notmuch@notmuchmail.org>;\r
16  Fri, 28 Aug 2015 12:19:50 -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 D564E6DE005F\r
19  for <notmuch@notmuchmail.org>; Fri, 28 Aug 2015 12:19:49 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21  by guru.guru-group.fi (Postfix) with ESMTP id 9400210008E;\r
22  Fri, 28 Aug 2015 22:18:17 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by\r
26  default with --client\r
27 In-Reply-To: <87si73uvbu.fsf@nikula.org>\r
28 References: <cover.1439629384.git.jani@nikula.org>\r
29  <455026447d3f75b1038ac11cebe734431604be9d.1439629384.git.jani@nikula.org>\r
30  <m21tepvpm5.fsf@guru.guru-group.fi> <87si73uvbu.fsf@nikula.org>\r
31 User-Agent: Notmuch/0.20.2+68~g0c35549 (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: Fri, 28 Aug 2015 22:18:17 +0300\r
37 Message-ID: <m2mvxbjk7a.fsf@guru.guru-group.fi>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain; charset=utf-8\r
40 Content-Transfer-Encoding: quoted-printable\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.18\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45  <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Fri, 28 Aug 2015 19:19:52 -0000\r
54 \r
55 On Fri, Aug 28 2015, Jani Nikula <jani@nikula.org> wrote:\r
56 \r
57 > On Wed, 26 Aug 2015, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
58 >> On Sat, Aug 15 2015, Jani Nikula <jani@nikula.org> wrote:\r
59 >>\r
60 >>> Make the default behaviour for --client the same as emacsclient\r
61 >>> default: do not create a new frame. Add a new option --create-frame,\r
62 >>> passing the same option to emacsclient to create a frame.\r
63 >>>\r
64 >>> ---\r
65 >>>\r
66 >>> v2: fix killing frame with --create-frame\r
67 >>>\r
68 >>> v3: fix --create-frame w/o --client parameter check\r
69 >>>\r
70 >>> v4: fix kill terminal logic, document behaviour with daemon mode\r
71 >>> ---\r
72 >>>  doc/man1/notmuch-emacs-mua.rst |  6 ++++++\r
73 >>>  notmuch-emacs-mua              | 14 ++++++++++----\r
74 >>>  2 files changed, 16 insertions(+), 4 deletions(-)\r
75 >>>\r
76 >>> diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mu=\r
77 a.rst\r
78 >>> index 89a2fead17b1..c3689eb82c8a 100644\r
79 >>> --- a/doc/man1/notmuch-emacs-mua.rst\r
80 >>> +++ b/doc/man1/notmuch-emacs-mua.rst\r
81 >>> @@ -45,6 +45,12 @@ Supported options for **notmuch-emacs-mua** include\r
82 >>>          Automatically start Emacs in daemon mode, if the Emacs server\r
83 >>>          is not running. Applicable with ``--client``.\r
84 >>>=20=20\r
85 >>> +    ``--create-frame``\r
86 >>> +        Create a new frame instead of trying to use the current Emacs\r
87 >>> +        frame. Applicable with ``--client``. This will be required\r
88 >>> +        when Emacs is running (or automatically started with\r
89 >>> +        ``--auto-daemon``) in daemon mode.\r
90 >>> +\r
91 >>>      ``--print``\r
92 >>>          Output the resulting elisp to stdout instead of evaluating it.\r
93 >>>=20=20\r
94 >>> diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua\r
95 >>> index ac03a4a60d56..b51d8d0e2c5b 100755\r
96 >>> --- a/notmuch-emacs-mua\r
97 >>> +++ b/notmuch-emacs-mua\r
98 >>> @@ -37,11 +37,10 @@ PRINT_ONLY=3D\r
99 >>>  NO_WINDOW=3D\r
100 >>>  USE_EMACSCLIENT=3D\r
101 >>>  AUTO_DAEMON=3D\r
102 >>> -CREATE_FRAME=3D"-c"\r
103 >>> +CREATE_FRAME=3D\r
104 >>>=20=20\r
105 >>>  # The crux of it all: construct an elisp progn and eval it.\r
106 >>>  ELISP=3D"(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"\r
107 >>> -ELISP=3D"${ELISP} (setq message-exit-actions (list #'save-buffers-kill=\r
108 -terminal))"\r
109 >>>=20=20\r
110 >>>  # Short options compatible with mutt(1).\r
111 >>>  while getopts :s:c:b:i:h opt; do\r
112 >>> @@ -65,7 +64,7 @@ while getopts :s:c:b:i:h opt; do\r
113 >>>                 opt=3D${opt%%=3D*}\r
114 >>>                 ;;\r
115 >>>             # Long options without arguments.\r
116 >>> -           --help|--print|--no-window-system|--client|--auto-daemon)\r
117 >>> +           --help|--print|--no-window-system|--client|--auto-daemon|--create-fr=\r
118 ame)\r
119 >>>                 ;;\r
120 >>>             *)\r
121 >>>                 echo "$0: unknown long option ${opt}, or argument mismatch." >&2\r
122 >>> @@ -103,7 +102,6 @@ while getopts :s:c:b:i:h opt; do\r
123 >>>         ;;\r
124 >>>     --no-window-system)\r
125 >>>         NO_WINDOW=3D"-nw"\r
126 >>> -       CREATE_FRAME=3D\r
127 >>>         ;;\r
128 >>>     --client)\r
129 >>>         USE_EMACSCLIENT=3D"yes"\r
130 >>> @@ -111,6 +109,9 @@ while getopts :s:c:b:i:h opt; do\r
131 >>>     --auto-daemon)\r
132 >>>         AUTO_DAEMON=3D"--alternate-editor=3D"\r
133 >>>         ;;\r
134 >>> +   --create-frame)\r
135 >>> +       CREATE_FRAME=3D"-c"\r
136 >>> +       ;;\r
137 >>>     *)\r
138 >>>         # We should never end up here.\r
139 >>>         echo "$0: internal error (option ${opt})." >&2\r
140 >>\r
141 >> This looks pretty good now; I player quite a bit with --client,\r
142 >> --create-frame and --auto-daemon=20\r
143 >> (with and without setting EMACSCLIENT=3D'echo emacsclient')\r
144 >>\r
145 >> Based on that I think this check should be added here (after option\r
146 >> parsing):\r
147 >>\r
148 >> if [ -n "$AUTO_DAEMON" -a -z "$CREATE_FRAME" ]; then\r
149 >>     echo "$0: --auto-daemon is only applicable with --create-frame." >&2\r
150 >>     exit 1=20=20=20=20=20=20=20\r
151 >> fi\r
152 >>\r
153 >> without this one may execute ./notmuch-emacs-mua --client --auto-daemon\r
154 >> which yields starting emacs in daemon mode (in this example it is expect=\r
155 ed\r
156 >> emacs is not running; otherwise --auto-daemon has no use in this example)\r
157 >> -- but no ui to that newly-running emacs is provided. Similar behaviour\r
158 >> can be observed by the following\r
159 >\r
160 > This problem is present with the current code already, right now. I\r
161 > don't see the need to fix everything in my series.\r
162 \r
163 Yes, the problem was already present in patch 4/5 (and probably earlier as\r
164 you mentioned that there was problem already) -- I just did not want\r
165 to pick that also in this discussion... ;/\r
166 \r
167 >> $ emacsclient --eval '(kill emacs) ;; but beware! '=20\r
168 >> $ emacsclient --alternate-editor=3D --eval '(find-file "/etc/passwd")'\r
169 >>\r
170 >> (side note: using this --alternate-editor=3D is pretty nifty way to get =\r
171 it done)\r
172 >>\r
173 >> emacs --daemon is executed which loaded /etc/passwd but w/o ui\r
174 >>\r
175 >> Note the difference in:\r
176 >>\r
177 >> emacsclient --alternate-editor=3D /etc/passwd\r
178 >>\r
179 >> now emacs --daemon is executed *and* ui where /etc/passwd is available is\r
180 >> provided!\r
181 >>\r
182 >> otoh,\r
183 >> emacsclient --alternate-editor=3D -c [-nw] --eval '(find-file "/etc/pass=\r
184 wd")'\r
185 >>\r
186 >> works fine, albeit a bit different than the one where /etc/passwd was gi=\r
187 ven\r
188 >> as a simple filename argument.\r
189 >>\r
190 >> comparative to ./notmuch-emacs-mua --client --create-frame --auto-daemon=\r
191 =20\r
192 >>\r
193 >>> @@ -128,6 +129,11 @@ for arg; do\r
194 >>>      ELISP=3D"${ELISP} (message-goto-to) (insert \"${arg}, \")"\r
195 >>>  done\r
196 >>>=20=20\r
197 >>> +# Kill the terminal/frame if we're creating one.\r
198 >>> +if [ -z "$USE_EMACSCLIENT" -o -n "$CREATE_FRAME" -o -n "$NO_WINDOW" ];=\r
199  then\r
200 >>> +    ELISP=3D"${ELISP} (setq message-exit-actions (list #'save-buffers-=\r
201 kill-terminal))"\r
202 >>> +fi\r
203 >>\r
204 >> I am not very happy that message-exit-actions was added to $ELISP when\r
205 >> not using emacsclient; when emacs is started its sole (initial) purpose =\r
206 is\r
207 >> to serve mail sending (and not lending a frame in some other emacs) -- in\r
208 >> this case it would be nice to be able to retrieve the sent mail buffer.\r
209 >\r
210 > And I am not very happy with being expected to modify these patches ad\r
211 > infinitum while trying to get back the *one* use case I wrote this\r
212 > script for in the first place, and that got broken somewhere down the\r
213 > line.\r
214 \r
215 I can agree that these patches could be applied as is and I can do the\r
216 followup patch that changes the things later ... but I'd like to get these\r
217 changes I presented discussed and agreed (whatever the agreement is) before\r
218 doing these so that the result will be good and safe for all potential\r
219 users...\r
220 \r
221 >\r
222 > Sincerely,\r
223 > Jani.\r
224 >\r
225 \r
226 yst=C3=A4v=C3=A4llisin terveisin :D,\r
227 Tomi\r
228 \r
229 >\r
230 >>\r
231 >> perhaps the above could be changed to just=20\r
232 >>\r
233 >> if [ -n "$CREATE_FRAME" ]; then\r
234 >>     ELISP=3D"${ELISP} (setq message-exit-actions (list #'save-buffers-ki=\r
235 ll-terminal))"\r
236 >> fi\r
237 >>\r
238 >> another option is --yet-another-option ;/\r
239 >>\r
240 >> No other issues (relevant to this series).\r
241 >>\r
242 >> Tomi\r
243 >>\r
244 >>\r
245 >>> +\r
246 >>>  # End progn.\r
247 >>>  ELISP=3D"${ELISP})"\r
248 >>>=20=20\r
249 >>> --=20\r
250 >>> 2.1.4\r