3 test_description="emacs interface"
6 EXPECTED=$TEST_DIRECTORY/emacs.expected-output
10 test_begin_subtest "Basic notmuch-hello view in emacs"
11 test_emacs '(notmuch-hello)
13 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
15 test_begin_subtest "Saved search with 0 results"
16 test_emacs '(let ((notmuch-show-empty-saved-searches t)
17 (notmuch-saved-searches
18 '\''(("inbox" . "tag:inbox")
19 ("unread" . "tag:unread")
20 ("empty" . "tag:doesnotexist"))))
23 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
25 test_begin_subtest "No saved searches displayed (all with 0 results)"
26 test_emacs '(let ((notmuch-saved-searches
27 '\''(("empty" . "tag:doesnotexist"))))
30 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
32 test_begin_subtest "Basic notmuch-search view in emacs"
33 test_emacs '(notmuch-search "tag:inbox")
36 test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox
38 test_begin_subtest "Incremental parsing of search results"
39 test_emacs "(ad-enable-advice 'notmuch-search-process-filter 'around 'pessimal)
40 (ad-activate 'notmuch-search-process-filter)
41 (notmuch-search \"tag:inbox\")
43 (ad-disable-advice 'notmuch-search-process-filter 'around 'pessimal)
44 (ad-activate 'notmuch-search-process-filter)
46 test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox
48 test_begin_subtest "Navigation of notmuch-hello to search results"
49 test_emacs '(notmuch-hello)
50 (goto-char (point-min))
51 (re-search-forward "inbox")
52 (widget-button-press (1- (point)))
55 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox
57 test_begin_subtest "Basic notmuch-show view in emacs"
58 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
59 test_emacs "(notmuch-show \"$maildir_storage_thread\")
61 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
63 test_begin_subtest "Basic notmuch-show view in emacs default indentation"
64 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
65 test_emacs "(let ((notmuch-show-indent-messages-width 1))
66 (notmuch-show \"$maildir_storage_thread\")
68 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
70 test_begin_subtest "Basic notmuch-show view in emacs without indentation"
71 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
72 test_emacs "(let ((notmuch-show-indent-messages-width 0))
73 (notmuch-show \"$maildir_storage_thread\")
75 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage-without-indentation
77 test_begin_subtest "Basic notmuch-show view in emacs with fourfold indentation"
78 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
79 test_emacs "(let ((notmuch-show-indent-messages-width 4))
80 (notmuch-show \"$maildir_storage_thread\")
82 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation
84 test_begin_subtest "notmuch-show for message with invalid From"
85 add_message "[subject]=\"message-with-invalid-from\"" \
86 "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
87 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
88 test_emacs "(notmuch-show \"$thread\")
91 "Invalid " (2001-01-05) (inbox)
92 Subject: message-with-invalid-from
93 To: Notmuch Test Suite <test_suite@notmuchmail.org>
94 Date: Fri, 05 Jan 2001 15:43:57 +0000
96 This is just a test message (#1)
98 test_expect_equal_file OUTPUT EXPECTED
100 test_begin_subtest "Navigation of notmuch-search to thread view"
101 test_emacs '(notmuch-search "tag:inbox")
103 (goto-char (point-min))
104 (re-search-forward "Working with Maildir")
105 (notmuch-search-show-thread)
108 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
110 test_begin_subtest "Add tag from search view"
111 os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com)
112 test_emacs "(notmuch-search \"$os_x_darwin_thread\")
114 (execute-kbd-macro \"+tag-from-search-view\")"
115 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
116 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-search-view unread)"
118 test_begin_subtest "Remove tag from search view"
119 test_emacs "(notmuch-search \"$os_x_darwin_thread\")
121 (execute-kbd-macro \"-tag-from-search-view\")"
122 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
123 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
125 test_begin_subtest "notmuch-show: add single tag to single message"
126 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
127 (execute-kbd-macro \"+tag-from-show-view\")"
128 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
129 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-show-view unread)"
131 test_begin_subtest "notmuch-show: remove single tag from single message"
132 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
133 (execute-kbd-macro \"-tag-from-show-view\")"
134 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
135 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
137 test_begin_subtest "notmuch-show: add multiple tags to single message"
138 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
139 (execute-kbd-macro \"+tag1-from-show-view +tag2-from-show-view\")"
140 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
141 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag1-from-show-view tag2-from-show-view unread)"
143 test_begin_subtest "notmuch-show: remove multiple tags from single message"
144 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
145 (execute-kbd-macro \"-tag1-from-show-view -tag2-from-show-view\")"
146 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
147 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
149 test_begin_subtest "Message with .. in Message-Id:"
150 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
151 test_emacs '(notmuch-search "id:\"123..456@example\"")
153 (execute-kbd-macro "+search-add")
154 (execute-kbd-macro "+search-remove")
155 (execute-kbd-macro "-search-remove")
156 (notmuch-show "id:\"123..456@example\"")
158 (execute-kbd-macro "+show-add")
159 (execute-kbd-macro "+show-remove")
160 (execute-kbd-macro "-show-remove")'
161 output=$(notmuch search 'id:"123..456@example"' | notmuch_search_sanitize)
162 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
164 test_begin_subtest "Message with quote in Message-Id:"
165 add_message '[id]="\"quote\"@example"' '[subject]="Message with quote in Message-Id"'
166 test_emacs '(notmuch-search "subject:\"Message with quote\"")
168 (execute-kbd-macro "+search-add")
169 (notmuch-search-show-thread)
171 (execute-kbd-macro "+show-add")'
172 output=$(notmuch search 'id:"""quote""@example"' | notmuch_search_sanitize)
173 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with quote in Message-Id (inbox search-add show-add)"
175 test_begin_subtest "Sending a message via (fake) SMTP"
176 emacs_deliver_message \
177 'Testing message sent via SMTP' \
178 'This is a test that messages are sent via SMTP' \
181 (insert "To: user@example.com\n")'
183 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
184 -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' \
185 -e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message >OUTPUT
187 From: Notmuch Test Suite <test_suite@notmuchmail.org>
189 Subject: Testing message sent via SMTP
190 Date: 01 Jan 2000 12:00:00 -0000
191 User-Agent: Notmuch/XXX Emacs/XXX
194 Content-Type: text/plain
196 This is a test that messages are sent via SMTP
198 test_expect_equal_file OUTPUT EXPECTED
200 test_begin_subtest "Verify that sent messages are saved/searchable (via FCC)"
201 notmuch new > /dev/null
202 output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_search_sanitize)
203 test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
205 test_begin_subtest "notmuch-fcc-dirs set to nil"
206 test_emacs "(let ((notmuch-fcc-dirs nil))
210 From: Notmuch Test Suite <test_suite@notmuchmail.org>
213 --text follows this line--
215 test_expect_equal_file OUTPUT EXPECTED
217 # Make another FCC maildir specific for the next test
218 mkdir -p mail/sent-string/cur
219 mkdir -p mail/sent-string/new
220 mkdir -p mail/sent-string/tmp
222 test_begin_subtest "notmuch-fcc-dirs set to a string"
223 test_emacs "(let ((notmuch-fcc-dirs \"sent-string\"))
227 From: Notmuch Test Suite <test_suite@notmuchmail.org>
230 Fcc: ${MAIL_DIR}/sent-string
231 --text follows this line--
233 test_expect_equal_file OUTPUT EXPECTED
235 # Make more FCC maildirs specific for the next test
236 mkdir -p mail/sent-list-match/cur
237 mkdir -p mail/sent-list-match/new
238 mkdir -p mail/sent-list-match/tmp
239 mkdir -p mail/failure/cur
240 mkdir -p mail/failure/new
241 mkdir -p mail/failure/tmp
243 test_begin_subtest "notmuch-fcc-dirs set to a list (with match)"
244 test_emacs "(let ((notmuch-fcc-dirs
245 '((\"notmuchmail.org\" . \"sent-list-match\")
246 (\".*\" . \"failure\"))))
250 From: Notmuch Test Suite <test_suite@notmuchmail.org>
253 Fcc: ${MAIL_DIR}/sent-list-match
254 --text follows this line--
256 test_expect_equal_file OUTPUT EXPECTED
258 # Make another FCC maildir specific for the next test
259 mkdir -p mail/sent-list-catch-all/cur
260 mkdir -p mail/sent-list-catch-all/new
261 mkdir -p mail/sent-list-catch-all/tmp
263 test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
264 test_emacs "(let ((notmuch-fcc-dirs
265 '((\"example.com\" . \"failure\")
266 (\".*\" . \"sent-list-catch-all\"))))
270 From: Notmuch Test Suite <test_suite@notmuchmail.org>
273 Fcc: ${MAIL_DIR}/sent-list-catch-all
274 --text follows this line--
276 test_expect_equal_file OUTPUT EXPECTED
278 test_begin_subtest "notmuch-fcc-dirs set to a list (no match)"
279 test_emacs "(let ((notmuch-fcc-dirs
280 '((\"example.com\" . \"failure\")
281 (\"nomatchhere.net\" . \"failure\"))))
285 From: Notmuch Test Suite <test_suite@notmuchmail.org>
288 --text follows this line--
290 test_expect_equal_file OUTPUT EXPECTED
292 test_begin_subtest "Reply within emacs"
293 test_emacs '(let ((message-hidden-headers ''()))
294 (notmuch-search "subject:\"testing message sent via SMTP\"")
296 (notmuch-search-reply-to-thread)
298 sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
299 sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
300 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
302 From: Notmuch Test Suite <test_suite@notmuchmail.org>
304 Subject: Re: Testing message sent via SMTP
306 Fcc: ${MAIL_DIR}/sent
308 User-Agent: Notmuch/XXX Emacs/XXX
309 --text follows this line--
310 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
312 > This is a test that messages are sent via SMTP
314 test_expect_equal_file OUTPUT EXPECTED
316 test_begin_subtest "Reply from alternate address within emacs"
317 add_message '[from]="Sender <sender@example.com>"' \
318 [to]=test_suite_other@notmuchmail.org
320 test_emacs "(let ((message-hidden-headers '()))
321 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
323 (notmuch-search-reply-to-thread)
325 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
327 From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
328 To: Sender <sender@example.com>
329 Subject: Re: ${test_subtest_name}
330 In-Reply-To: <${gen_msg_id}>
331 Fcc: ${MAIL_DIR}/sent
332 References: <${gen_msg_id}>
333 User-Agent: Notmuch/XXX Emacs/XXX
334 --text follows this line--
335 Sender <sender@example.com> writes:
337 > This is just a test message (#${gen_msg_cnt})
339 test_expect_equal_file OUTPUT EXPECTED
341 test_begin_subtest "Reply from address in named group list within emacs"
342 add_message '[from]="Sender <sender@example.com>"' \
343 '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
344 [cc]=test_suite_other@notmuchmail.org
346 test_emacs "(let ((message-hidden-headers '()))
347 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
349 (notmuch-search-reply-to-thread)
351 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
353 From: Notmuch Test Suite <test_suite@notmuchmail.org>
354 To: Sender <sender@example.com>, someone@example.com
355 Subject: Re: ${test_subtest_name}
356 In-Reply-To: <${gen_msg_id}>
357 Fcc: ${MAIL_DIR}/sent
358 References: <${gen_msg_id}>
359 User-Agent: Notmuch/XXX Emacs/XXX
360 --text follows this line--
361 Sender <sender@example.com> writes:
363 > This is just a test message (#${gen_msg_cnt})
365 test_expect_equal_file OUTPUT EXPECTED
367 test_begin_subtest "Reply within emacs to a multipart/mixed message"
368 test_emacs '(let ((message-hidden-headers ''()))
369 (notmuch-show "id:20091118002059.067214ed@hikari")
372 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
374 From: Notmuch Test Suite <test_suite@notmuchmail.org>
375 To: Adrian Perez de Castro <aperez@igalia.com>, notmuch@notmuchmail.org
376 Subject: Re: [notmuch] Introducing myself
377 In-Reply-To: <20091118002059.067214ed@hikari>
378 Fcc: ${MAIL_DIR}/sent
379 References: <20091118002059.067214ed@hikari>
380 User-Agent: Notmuch/XXX Emacs/XXX
381 --text follows this line--
382 Adrian Perez de Castro <aperez@igalia.com> writes:
386 > I have just heard about Not Much today in some random Linux-related news
387 > site (LWN?), my name is Adrian Perez and I work as systems administrator
388 > (although I can do some code as well :P). I have always thought that the
389 > ideas behind Sup were great, but after some time using it, I got tired of
390 > the oddities that it has. I also do not like doing things like having to
391 > install Ruby just for reading and sorting mails. Some time ago I thought
392 > about doing something like Not Much and in fact I played a bit with the
393 > Python+Xapian and the Python+Whoosh combinations, because I find relaxing
394 > to code things in Python when I am not working and also it is installed
395 > by default on most distribution. I got to have some mailboxes indexed and
396 > basic searching working a couple of months ago. Lately I have been very
397 > busy and had no time for coding, and them... boom! Not Much appears -- and
398 > it is almost exactly what I was trying to do, but faster. I have been
399 > playing a bit with Not Much today, and I think it has potential.
401 > Also, I would like to share one idea I had in mind, that you might find
402 > interesting: One thing I have found very annoying is having to re-tag my
403 > mail when the indexes get b0rked (it happened a couple of times to me while
404 > using Sup), so I was planning to mails as read/unread and adding the tags
405 > not just to the index, but to the mail text itself, e.g. by adding a
406 > "X-Tags" header field or by reusing the "Keywords" one. This way, the index
407 > could be totally recreated by re-reading the mail directories, and this
408 > would also allow to a tools like OfflineIMAP [1] to get the mails into a
409 > local maildir, tagging and indexing the mails with the e-mail reader and
410 > then syncing back the messages with the "X-Tags" header to the IMAP server.
411 > This would allow to use the mail reader from a different computer and still
412 > have everything tagged finely.
418 > [1] http://software.complete.org/software/projects/show/offlineimap
421 > Adrian Perez de Castro <aperez@igalia.com>
422 > Igalia - Free Software Engineering
423 > _______________________________________________
424 > notmuch mailing list
425 > notmuch@notmuchmail.org
426 > http://notmuchmail.org/mailman/listinfo/notmuch
428 test_expect_equal_file OUTPUT EXPECTED
430 test_begin_subtest "Reply within emacs to a multipart/alternative message"
431 test_emacs '(let ((message-hidden-headers ''()))
432 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
435 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
437 From: Notmuch Test Suite <test_suite@notmuchmail.org>
438 To: Alex Botero-Lowry <alex.boterolowry@gmail.com>, notmuch@notmuchmail.org
439 Subject: Re: [notmuch] preliminary FreeBSD support
440 In-Reply-To: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
441 Fcc: ${MAIL_DIR}/sent
442 References: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
443 User-Agent: Notmuch/XXX Emacs/XXX
444 --text follows this line--
445 Alex Botero-Lowry <alex.boterolowry@gmail.com> writes:
447 > I saw the announcement this morning, and was very excited, as I had been
448 > hoping sup would be turned into a library,
449 > since I like the concept more than the UI (I'd rather an emacs interface).
451 > I did a preliminary compile which worked out fine, but
452 > sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on
453 > FreeBSD, so notmuch_config_open segfaulted.
455 > Attached is a patch that supplies a default buffer size of 64 in cases where
458 > http://www.opengroup.org/austin/docs/austin_328.txt - seems to indicate this
459 > is acceptable behavior,
460 > and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically
463 > _______________________________________________
464 > notmuch mailing list
465 > notmuch@notmuchmail.org
466 > http://notmuchmail.org/mailman/listinfo/notmuch
468 test_expect_equal_file OUTPUT EXPECTED
470 test_begin_subtest "Reply within emacs to an html-only message"
471 add_message '[content-type]="text/html"' \
472 '[body]="Hi,<br />This is an <b>HTML</b> test message.<br /><br />OK?"'
473 test_emacs "(let ((message-hidden-headers '()) (mm-text-html-renderer 'html2text))
474 (notmuch-show \"id:${gen_msg_id}\")
477 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
479 From: Notmuch Test Suite <test_suite@notmuchmail.org>
481 Subject: Re: Reply within emacs to an html-only message
482 In-Reply-To: <${gen_msg_id}>
483 Fcc: ${MAIL_DIR}/sent
484 References: <${gen_msg_id}>
485 User-Agent: Notmuch/XXX Emacs/XXX
486 --text follows this line--
487 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
489 > Hi,This is an HTML test message.OK?
491 test_expect_equal_file OUTPUT EXPECTED
493 test_begin_subtest "Quote MML tags in reply"
494 message_id='test-emacs-mml-quoting@message.id'
495 add_message [id]="$message_id" \
496 "[subject]='$test_subtest_name'" \
497 '[body]="<#part disposition=inline>"'
498 test_emacs "(let ((message-hidden-headers '()))
499 (notmuch-show \"id:$message_id\")
502 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
504 From: Notmuch Test Suite <test_suite@notmuchmail.org>
506 Subject: Re: Quote MML tags in reply
507 In-Reply-To: <test-emacs-mml-quoting@message.id>
508 Fcc: ${MAIL_DIR}/sent
509 References: <test-emacs-mml-quoting@message.id>
510 User-Agent: Notmuch/XXX Emacs/XXX
511 --text follows this line--
512 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
514 > <#!part disposition=inline>
516 test_expect_equal_file OUTPUT EXPECTED
518 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments"
519 # save as archive to test that Emacs does not re-compress .gz
520 test_emacs '(let ((standard-input "\"attachment1.gz\""))
521 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
522 (notmuch-show-save-attachments))'
523 test_expect_equal_file attachment1.gz "$EXPECTED/attachment"
525 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
526 # save as archive to test that Emacs does not re-compress .gz
527 test_emacs '(let ((standard-input "\"attachment2.gz\""))
528 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
529 (search-forward "0001-Deal-with")
530 (notmuch-show-save-part))'
531 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
533 test_begin_subtest "Save 8bit attachment from within emacs using notmuch-show-save-attachments"
535 add_message '[subject]="Attachment with 8bit chars"' \
536 '[header]="MIME-Version: 1.0"' \
537 '[content-type]="multipart/mixed; boundary=\"abcd\""' \
539 Content-Type: text/plain
544 Content-Type: application/octet-stream; name=\"sample\"
545 Content-Transfer-Encoding: 8bit
546 Content-Disposition: attachment; filename=\"sample\"
548 “¡ Hey ! It compiles ¡ Ship it !”
552 test_emacs '(notmuch-show "id:'"${gen_msg_id}"'")
553 (delete-file "OUTPUT")
554 (let ((standard-input "\"OUTPUT\""))
555 (notmuch-show-save-attachments))'
557 test_expect_equal "$(cat OUTPUT)" '“¡ Hey ! It compiles ¡ Ship it !”'
559 test_begin_subtest "View raw message within emacs"
560 test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
561 (notmuch-show-view-raw-message)
563 test_expect_equal_file OUTPUT $EXPECTED/raw-message-cf0c4d-52ad0a
565 test_begin_subtest "Hiding/showing signature in notmuch-show view"
566 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
567 test_emacs "(notmuch-show \"$maildir_storage_thread\")
568 (search-forward \"Click/Enter to show.\")
569 (button-activate (button-at (point)))
570 (search-backward \"Click/Enter to hide.\")
571 (button-activate (button-at (point)))
573 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
575 test_begin_subtest "Detection and hiding of top-post quoting of message"
576 add_message '[subject]="The problem with top-posting"' \
577 [id]=top-post-target \
578 '[body]="A: Because it messes up the order in which people normally read text.
579 Q: Why is top-posting such a bad thing?
581 Q: What is the most annoying thing in e-mail?"'
582 add_message '[from]="Top Poster <top@poster.com>"' \
583 [in-reply-to]=top-post-target \
584 [references]=top-post-target \
585 '[subject]="Re: The problem with top-posting"' \
586 '[body]="Thanks for the advice! I will be sure to put it to good use.
590 ----- Original Message -----
591 From: Notmuch Test Suite <test_suite@notmuchmail.org>
592 To: Notmuch Test Suite <test_suite@notmuchmai.org>
593 Sent: Fri, 05 Jan 2001 15:43:57 +0000
594 Subject: The problem with top-posting
596 Q: Why is top-posting such a bad thing?
598 Q: What is the most annoying thing in e-mail?"'
599 test_emacs "(notmuch-show \"top-posting\")
600 (test-visible-output)"
601 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
602 Subject: The problem with top-posting
603 To: Notmuch Test Suite <test_suite@notmuchmail.org>
604 Date: Fri, 05 Jan 2001 15:43:57 +0000
606 A: Because it messes up the order in which people normally read text.
607 Q: Why is top-posting such a bad thing?
609 Q: What is the most annoying thing in e-mail?
610 Top Poster <top@poster.com> (2001-01-05) (inbox unread)
611 Subject: Re: The problem with top-posting
612 To: Notmuch Test Suite <test_suite@notmuchmail.org>
613 Date: Fri, 05 Jan 2001 15:43:57 +0000
615 Thanks for the advice! I will be sure to put it to good use.
619 [ 9-line hidden original message. Click/Enter to show. ]" > EXPECTED
620 test_expect_equal_file OUTPUT EXPECTED
622 test_begin_subtest "Hiding message in notmuch-show view"
623 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
624 (notmuch-show-toggle-message)
625 (test-visible-output)'
626 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
628 test_begin_subtest "Hiding message with visible citation in notmuch-show view"
629 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
630 (search-forward "Click/Enter to show.")
631 (button-activate (button-at (point)))
632 (notmuch-show-toggle-message)
633 (test-visible-output)'
634 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
636 test_begin_subtest "notmuch-show: show message headers"
638 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
639 (notmuch-message-headers-visible t))
640 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
641 (test-visible-output))'
642 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-visible
644 test_begin_subtest "notmuch-show: hide message headers"
646 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
647 (notmuch-message-headers-visible nil))
648 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
649 (test-visible-output))'
650 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden
652 test_begin_subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-visibility-headers)"
654 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
655 (notmuch-message-headers-visible t))
656 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
657 (notmuch-show-toggle-visibility-headers)
658 (test-visible-output))'
659 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden
661 test_begin_subtest "notmuch-show: collapse all messages in thread"
662 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")
663 (let ((current-prefix-arg t))
664 (notmuch-show-open-or-close-all)
665 (test-visible-output))'
666 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-collapsed
668 test_begin_subtest "notmuch-show: uncollapse all messages in thread"
669 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")
670 (notmuch-show-open-or-close-all)
671 (test-visible-output)'
672 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed
674 test_begin_subtest "Stashing in notmuch-show"
675 add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
676 '[from]="Some One <someone@somewhere.org>"' \
677 '[to]="Some One Else <notsomeone@somewhere.org>"' \
678 '[cc]="Notmuch <notmuch@notmuchmail.org>"' \
679 '[subject]="Stash my stashables"' \
681 '[body]="Unable to stash body. Where did you get it in the first place?!?"'
682 notmuch tag +stashtest id:${gen_msg_id}
683 test_emacs '(notmuch-show "id:\"bought\"")
684 (notmuch-show-stash-date)
685 (notmuch-show-stash-from)
686 (notmuch-show-stash-to)
687 (notmuch-show-stash-cc)
688 (notmuch-show-stash-subject)
689 (notmuch-show-stash-message-id)
690 (notmuch-show-stash-message-id-stripped)
691 (notmuch-show-stash-tags)
692 (notmuch-show-stash-filename)
693 (notmuch-show-stash-mlarchive-link "Gmane")
694 (notmuch-show-stash-mlarchive-link "MARC")
695 (notmuch-show-stash-mlarchive-link "Mail Archive, The")
697 (generate-new-buffer "*test-stashing*"))
701 (rotate-yank-pointer 1))
702 (reverse-region (point-min) (point-max))
705 Sat, 01 Jan 2000 12:00:00 +0000
706 Some One <someone@somewhere.org>
707 Some One Else <notsomeone@somewhere.org>
708 Notmuch <notmuch@notmuchmail.org>
714 http://mid.gmane.org/bought
715 http://marc.info/?i=bought
716 http://mail-archive.com/search?l=mid&q=bought
718 test_expect_equal_file OUTPUT EXPECTED
720 test_begin_subtest "Stashing in notmuch-search"
721 test_emacs '(notmuch-search "id:\"bought\"")
723 (notmuch-search-stash-thread-id)
725 (generate-new-buffer "*test-stashing*"))
728 sed -i -e 's/^thread:.*$/thread:XXX/' OUTPUT
729 test_expect_equal "$(cat OUTPUT)" "thread:XXX"
731 test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
732 message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
733 message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
734 test_emacs "(notmuch-show \"$message2\")
735 (test-output \"EXPECTED\")"
736 test_emacs "(notmuch-search \"$message1 or $message2\")
738 (notmuch-search-show-thread)
739 (goto-char (point-max))
741 (notmuch-show-advance-and-archive)
743 test_expect_equal_file OUTPUT EXPECTED
745 test_begin_subtest "Refresh show buffer"
746 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
747 (test-visible-output "EXPECTED")
748 (notmuch-show-refresh-view)
749 (test-visible-output)'
750 test_expect_equal_file OUTPUT EXPECTED
752 test_begin_subtest "Refresh modified show buffer"
753 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
754 (notmuch-show-toggle-message)
755 (notmuch-show-next-message)
756 (notmuch-show-toggle-message)
757 (test-visible-output "EXPECTED")
758 (notmuch-show-refresh-view)
759 (test-visible-output)'
760 test_expect_equal_file OUTPUT EXPECTED
762 test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts"
763 id='message-with-application/mpeg-attachment@notmuchmail.org'
764 emacs_deliver_message \
765 'Message with application/mpeg attachment' \
768 (insert \"Message-ID: <$id>\n\")
770 (mml-insert-part \"application/mpeg\")
771 (insert \"a fake mp3 file\")"
772 notmuch_counter_reset
773 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
774 (notmuch-show \"id:$id\"))"
775 test_expect_equal $(notmuch_counter_value) 1
777 test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"
778 id='message-with-audio/mpeg-attachment@notmuchmail.org'
779 emacs_deliver_message \
780 'Message with audio/mpeg attachment' \
783 (insert \"Message-ID: <$id>\n\")
785 (mml-insert-part \"audio/mpeg\")
786 (insert \"a fake mp3 file\")"
787 notmuch_counter_reset
788 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
789 (notmuch-show \"id:$id\"))"
790 test_expect_equal $(notmuch_counter_value) 1
792 test_begin_subtest "notmuch-hello-mode hook is called"
793 counter=$(test_emacs \
794 '(let ((notmuch-hello-mode-hook-counter 0))
795 (kill-buffer "*notmuch-hello*")
797 notmuch-hello-mode-hook-counter)'
799 test_expect_equal "$counter" 1
801 test_begin_subtest "notmuch-hello-mode hook is not called on updates"
802 counter=$(test_emacs \
803 '(let ((notmuch-hello-mode-hook-counter 0))
804 (kill-buffer "*notmuch-hello*")
806 (notmuch-hello-update)
807 notmuch-hello-mode-hook-counter)'
809 test_expect_equal "$counter" 1
811 test_begin_subtest "notmuch-hello-refresh hook is called"
812 counter=$(test_emacs \
813 '(let ((notmuch-hello-refresh-hook-counter 0))
814 (kill-buffer "*notmuch-hello*")
816 notmuch-hello-refresh-hook-counter)'
818 test_expect_equal "$counter" 1
820 test_begin_subtest "notmuch-hello-refresh hook is called on updates"
821 counter=$(test_emacs \
822 '(let ((notmuch-hello-refresh-hook-counter 0))
823 (kill-buffer "*notmuch-hello*")
825 (notmuch-hello-update)
826 notmuch-hello-refresh-hook-counter)'
828 test_expect_equal "$counter" 2
831 add_message '[subject]="HTML mail with images"' \
832 '[content-type]="multipart/related; boundary=abcd"' \
834 Content-Type: text/html
836 <img src="cid:330@goomoji.gmail"> smiley
839 Content-Type: image/gif
840 Content-Transfer-Encoding: base64
841 Content-ID: <330@goomoji.gmail>
843 R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMl
844 WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7
846 test_emacs "(let ((mm-text-html-renderer
847 (if (assq 'shr mm-text-html-renderer-alist)
849 (notmuch-show \"id:${gen_msg_id}\"))
850 (test-output)" > /dev/null
851 # Different Emacs versions and renderers give very different results,
852 # so just check that something reasonable showed up. We first cat the
853 # output so the test framework will print it if the test fails.
854 test_expect_success "Rendering HTML mail with images" \
855 'cat OUTPUT && grep -q smiley OUTPUT'
858 test_begin_subtest "Search handles subprocess error exit codes"
859 cat > notmuch_fail <<EOF
864 chmod a+x notmuch_fail
865 test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
866 (with-current-buffer \"*Messages*\" (erase-buffer))
867 (notmuch-search \"tag:inbox\")
869 (with-current-buffer \"*Messages*\"
870 (test-output \"MESSAGES\"))
871 (with-current-buffer \"*Notmuch errors*\"
872 (test-output \"ERROR\"))
874 sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
875 test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
876 End of search results.
878 $PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
881 $PWD/notmuch_fail exited with status 1
882 command: $PWD/notmuch_fail search --format\=sexp --format-version\=1 --sort\=newest-first tag\:inbox
885 test_begin_subtest "Search handles subprocess warnings"
886 cat > notmuch_fail <<EOF
889 echo This is a warning >&2
890 echo This is another warning >&2
893 chmod a+x notmuch_fail
894 test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
895 (with-current-buffer \"*Messages*\" (erase-buffer))
896 (with-current-buffer \"*Notmuch errors*\" (erase-buffer))
897 (notmuch-search \"tag:inbox\")
899 (with-current-buffer \"*Messages*\"
900 (test-output \"MESSAGES\"))
901 (with-current-buffer \"*Notmuch errors*\"
902 (test-output \"ERROR\"))
904 sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
905 test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
906 End of search results.
908 This is a warning (see *Notmuch errors* for more details)
912 This is another warning"