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 "Add tag from notmuch-show view"
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 "Remove tag from notmuch-show view"
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 "Message with .. in Message-Id:"
138 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
139 test_emacs '(notmuch-search "id:\"123..456@example\"")
141 (execute-kbd-macro "+search-add")
142 (execute-kbd-macro "+search-remove")
143 (execute-kbd-macro "-search-remove")
144 (notmuch-show "id:\"123..456@example\"")
146 (execute-kbd-macro "+show-add")
147 (execute-kbd-macro "+show-remove")
148 (execute-kbd-macro "-show-remove")'
149 output=$(notmuch search 'id:"123..456@example"' | notmuch_search_sanitize)
150 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
152 test_begin_subtest "Message with quote in Message-Id:"
153 add_message '[id]="\"quote\"@example"' '[subject]="Message with quote in Message-Id"'
154 test_emacs '(notmuch-search "subject:\"Message with quote\"")
156 (execute-kbd-macro "+search-add")
157 (notmuch-search-show-thread)
159 (execute-kbd-macro "+show-add")'
160 output=$(notmuch search 'id:"""quote""@example"' | notmuch_search_sanitize)
161 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)"
163 test_begin_subtest "Sending a message via (fake) SMTP"
164 emacs_deliver_message \
165 'Testing message sent via SMTP' \
166 'This is a test that messages are sent via SMTP' \
169 (insert "To: user@example.com\n")'
171 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
172 -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message >OUTPUT
174 From: Notmuch Test Suite <test_suite@notmuchmail.org>
176 Subject: Testing message sent via SMTP
177 Date: 01 Jan 2000 12:00:00 -0000
178 User-Agent: Notmuch/XXX Emacs/XXX
181 Content-Type: text/plain; charset=us-ascii
183 This is a test that messages are sent via SMTP
185 test_expect_equal_file OUTPUT EXPECTED
187 test_begin_subtest "Verify that sent messages are saved/searchable (via FCC)"
188 notmuch new > /dev/null
189 output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_search_sanitize)
190 test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
192 test_begin_subtest "notmuch-fcc-dirs set to nil"
193 test_emacs "(let ((notmuch-fcc-dirs nil))
197 From: Notmuch Test Suite <test_suite@notmuchmail.org>
200 --text follows this line--
202 test_expect_equal_file OUTPUT EXPECTED
204 # Make another FCC maildir specific for the next test
205 mkdir -p mail/sent-string/cur
206 mkdir -p mail/sent-string/new
207 mkdir -p mail/sent-string/tmp
209 test_begin_subtest "notmuch-fcc-dirs set to a string"
210 test_emacs "(let ((notmuch-fcc-dirs \"sent-string\"))
214 From: Notmuch Test Suite <test_suite@notmuchmail.org>
217 Fcc: ${MAIL_DIR}/sent-string
218 --text follows this line--
220 test_expect_equal_file OUTPUT EXPECTED
222 # Make more FCC maildirs specific for the next test
223 mkdir -p mail/sent-list-match/cur
224 mkdir -p mail/sent-list-match/new
225 mkdir -p mail/sent-list-match/tmp
226 mkdir -p mail/failure/cur
227 mkdir -p mail/failure/new
228 mkdir -p mail/failure/tmp
230 test_begin_subtest "notmuch-fcc-dirs set to a list (with match)"
231 test_emacs "(let ((notmuch-fcc-dirs
232 '((\"notmuchmail.org\" . \"sent-list-match\")
233 (\".*\" . \"failure\"))))
237 From: Notmuch Test Suite <test_suite@notmuchmail.org>
240 Fcc: ${MAIL_DIR}/sent-list-match
241 --text follows this line--
243 test_expect_equal_file OUTPUT EXPECTED
245 # Make another FCC maildir specific for the next test
246 mkdir -p mail/sent-list-catch-all/cur
247 mkdir -p mail/sent-list-catch-all/new
248 mkdir -p mail/sent-list-catch-all/tmp
250 test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
251 test_emacs "(let ((notmuch-fcc-dirs
252 '((\"example.com\" . \"failure\")
253 (\".*\" . \"sent-list-catch-all\"))))
257 From: Notmuch Test Suite <test_suite@notmuchmail.org>
260 Fcc: ${MAIL_DIR}/sent-list-catch-all
261 --text follows this line--
263 test_expect_equal_file OUTPUT EXPECTED
265 test_begin_subtest "notmuch-fcc-dirs set to a list (no match)"
266 test_emacs "(let ((notmuch-fcc-dirs
267 '((\"example.com\" . \"failure\")
268 (\"nomatchhere.net\" . \"failure\"))))
272 From: Notmuch Test Suite <test_suite@notmuchmail.org>
275 --text follows this line--
277 test_expect_equal_file OUTPUT EXPECTED
279 test_begin_subtest "Reply within emacs"
280 test_emacs '(let ((message-hidden-headers ''()))
281 (notmuch-search "subject:\"testing message sent via SMTP\"")
283 (notmuch-search-reply-to-thread)
285 sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
286 sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
287 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
289 From: Notmuch Test Suite <test_suite@notmuchmail.org>
291 Subject: Re: Testing message sent via SMTP
293 Fcc: ${MAIL_DIR}/sent
295 User-Agent: Notmuch/XXX Emacs/XXX
296 --text follows this line--
297 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
299 > This is a test that messages are sent via SMTP
301 test_expect_equal_file OUTPUT EXPECTED
303 test_begin_subtest "Reply from alternate address within emacs"
304 add_message '[from]="Sender <sender@example.com>"' \
305 [to]=test_suite_other@notmuchmail.org
307 test_emacs "(let ((message-hidden-headers '()))
308 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
310 (notmuch-search-reply-to-thread)
312 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
314 From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
315 To: Sender <sender@example.com>
316 Subject: Re: ${test_subtest_name}
317 In-Reply-To: <${gen_msg_id}>
318 Fcc: ${MAIL_DIR}/sent
319 References: <${gen_msg_id}>
320 User-Agent: Notmuch/XXX Emacs/XXX
321 --text follows this line--
322 Sender <sender@example.com> writes:
324 > This is just a test message (#${gen_msg_cnt})
326 test_expect_equal_file OUTPUT EXPECTED
328 test_begin_subtest "Reply from address in named group list within emacs"
329 add_message '[from]="Sender <sender@example.com>"' \
330 '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
331 [cc]=test_suite_other@notmuchmail.org
333 test_emacs "(let ((message-hidden-headers '()))
334 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
336 (notmuch-search-reply-to-thread)
338 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
340 From: Notmuch Test Suite <test_suite@notmuchmail.org>
341 To: Sender <sender@example.com>, someone@example.com
342 Subject: Re: ${test_subtest_name}
343 In-Reply-To: <${gen_msg_id}>
344 Fcc: ${MAIL_DIR}/sent
345 References: <${gen_msg_id}>
346 User-Agent: Notmuch/XXX Emacs/XXX
347 --text follows this line--
348 Sender <sender@example.com> writes:
350 > This is just a test message (#${gen_msg_cnt})
352 test_expect_equal_file OUTPUT EXPECTED
354 test_begin_subtest "Reply within emacs to a multipart/mixed message"
355 test_emacs '(let ((message-hidden-headers ''()))
356 (notmuch-show "id:20091118002059.067214ed@hikari")
359 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
361 From: Notmuch Test Suite <test_suite@notmuchmail.org>
362 To: Adrian Perez de Castro <aperez@igalia.com>, notmuch@notmuchmail.org
363 Subject: Re: [notmuch] Introducing myself
364 In-Reply-To: <20091118002059.067214ed@hikari>
365 Fcc: ${MAIL_DIR}/sent
366 References: <20091118002059.067214ed@hikari>
367 User-Agent: Notmuch/XXX Emacs/XXX
368 --text follows this line--
369 Adrian Perez de Castro <aperez@igalia.com> writes:
373 > I have just heard about Not Much today in some random Linux-related news
374 > site (LWN?), my name is Adrian Perez and I work as systems administrator
375 > (although I can do some code as well :P). I have always thought that the
376 > ideas behind Sup were great, but after some time using it, I got tired of
377 > the oddities that it has. I also do not like doing things like having to
378 > install Ruby just for reading and sorting mails. Some time ago I thought
379 > about doing something like Not Much and in fact I played a bit with the
380 > Python+Xapian and the Python+Whoosh combinations, because I find relaxing
381 > to code things in Python when I am not working and also it is installed
382 > by default on most distribution. I got to have some mailboxes indexed and
383 > basic searching working a couple of months ago. Lately I have been very
384 > busy and had no time for coding, and them... boom! Not Much appears -- and
385 > it is almost exactly what I was trying to do, but faster. I have been
386 > playing a bit with Not Much today, and I think it has potential.
388 > Also, I would like to share one idea I had in mind, that you might find
389 > interesting: One thing I have found very annoying is having to re-tag my
390 > mail when the indexes get b0rked (it happened a couple of times to me while
391 > using Sup), so I was planning to mails as read/unread and adding the tags
392 > not just to the index, but to the mail text itself, e.g. by adding a
393 > "X-Tags" header field or by reusing the "Keywords" one. This way, the index
394 > could be totally recreated by re-reading the mail directories, and this
395 > would also allow to a tools like OfflineIMAP [1] to get the mails into a
396 > local maildir, tagging and indexing the mails with the e-mail reader and
397 > then syncing back the messages with the "X-Tags" header to the IMAP server.
398 > This would allow to use the mail reader from a different computer and still
399 > have everything tagged finely.
405 > [1] http://software.complete.org/software/projects/show/offlineimap
408 > Adrian Perez de Castro <aperez@igalia.com>
409 > Igalia - Free Software Engineering
410 > _______________________________________________
411 > notmuch mailing list
412 > notmuch@notmuchmail.org
413 > http://notmuchmail.org/mailman/listinfo/notmuch
415 test_expect_equal_file OUTPUT EXPECTED
417 test_begin_subtest "Reply within emacs to a multipart/alternative message"
418 test_emacs '(let ((message-hidden-headers ''()))
419 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
422 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
424 From: Notmuch Test Suite <test_suite@notmuchmail.org>
425 To: Alex Botero-Lowry <alex.boterolowry@gmail.com>, notmuch@notmuchmail.org
426 Subject: Re: [notmuch] preliminary FreeBSD support
427 In-Reply-To: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
428 Fcc: ${MAIL_DIR}/sent
429 References: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
430 User-Agent: Notmuch/XXX Emacs/XXX
431 --text follows this line--
432 Alex Botero-Lowry <alex.boterolowry@gmail.com> writes:
434 > I saw the announcement this morning, and was very excited, as I had been
435 > hoping sup would be turned into a library,
436 > since I like the concept more than the UI (I'd rather an emacs interface).
438 > I did a preliminary compile which worked out fine, but
439 > sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on
440 > FreeBSD, so notmuch_config_open segfaulted.
442 > Attached is a patch that supplies a default buffer size of 64 in cases where
445 > http://www.opengroup.org/austin/docs/austin_328.txt - seems to indicate this
446 > is acceptable behavior,
447 > and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically
450 > _______________________________________________
451 > notmuch mailing list
452 > notmuch@notmuchmail.org
453 > http://notmuchmail.org/mailman/listinfo/notmuch
455 test_expect_equal_file OUTPUT EXPECTED
457 test_begin_subtest "Reply within emacs to an html-only message"
458 add_message '[content-type]="text/html"' \
459 '[body]="Hi,<br />This is an <b>HTML</b> test message.<br /><br />OK?"'
460 test_emacs "(let ((message-hidden-headers '()) (mm-text-html-renderer 'html2text))
461 (notmuch-show \"id:${gen_msg_id}\")
464 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
466 From: Notmuch Test Suite <test_suite@notmuchmail.org>
468 Subject: Re: Reply within emacs to an html-only message
469 In-Reply-To: <${gen_msg_id}>
470 Fcc: ${MAIL_DIR}/sent
471 References: <${gen_msg_id}>
472 User-Agent: Notmuch/XXX Emacs/XXX
473 --text follows this line--
474 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
476 > Hi,This is an HTML test message.OK?
478 test_expect_equal_file OUTPUT EXPECTED
480 test_begin_subtest "Quote MML tags in reply"
481 message_id='test-emacs-mml-quoting@message.id'
482 add_message [id]="$message_id" \
483 "[subject]='$test_subtest_name'" \
484 '[body]="<#part disposition=inline>"'
485 test_emacs "(let ((message-hidden-headers '()))
486 (notmuch-show \"id:$message_id\")
489 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
491 From: Notmuch Test Suite <test_suite@notmuchmail.org>
493 Subject: Re: Quote MML tags in reply
494 In-Reply-To: <test-emacs-mml-quoting@message.id>
495 Fcc: ${MAIL_DIR}/sent
496 References: <test-emacs-mml-quoting@message.id>
497 User-Agent: Notmuch/XXX Emacs/XXX
498 --text follows this line--
499 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
501 > <#!part disposition=inline>
503 test_expect_equal_file OUTPUT EXPECTED
505 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments"
506 # save as archive to test that Emacs does not re-compress .gz
507 test_emacs '(let ((standard-input "\"attachment1.gz\""))
508 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
509 (notmuch-show-save-attachments))'
510 test_expect_equal_file attachment1.gz "$EXPECTED/attachment"
512 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
513 # save as archive to test that Emacs does not re-compress .gz
514 test_emacs '(let ((standard-input "\"attachment2.gz\""))
515 (notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5))'
516 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
518 test_begin_subtest "View raw message within emacs"
519 test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
520 (notmuch-show-view-raw-message)
522 test_expect_equal_file OUTPUT $EXPECTED/raw-message-cf0c4d-52ad0a
524 test_begin_subtest "Hiding/showing signature in notmuch-show view"
525 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
526 test_emacs "(notmuch-show \"$maildir_storage_thread\")
527 (search-forward \"Click/Enter to show.\")
528 (button-activate (button-at (point)))
529 (search-backward \"Click/Enter to hide.\")
530 (button-activate (button-at (point)))
532 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
534 test_begin_subtest "Detection and hiding of top-post quoting of message"
535 add_message '[subject]="The problem with top-posting"' \
536 [id]=top-post-target \
537 '[body]="A: Because it messes up the order in which people normally read text.
538 Q: Why is top-posting such a bad thing?
540 Q: What is the most annoying thing in e-mail?"'
541 add_message '[from]="Top Poster <top@poster.com>"' \
542 [in-reply-to]=top-post-target \
543 [references]=top-post-target \
544 '[subject]="Re: The problem with top-posting"' \
545 '[body]="Thanks for the advice! I will be sure to put it to good use.
549 ----- Original Message -----
550 From: Notmuch Test Suite <test_suite@notmuchmail.org>
551 To: Notmuch Test Suite <test_suite@notmuchmai.org>
552 Sent: Fri, 05 Jan 2001 15:43:57 +0000
553 Subject: The problem with top-posting
555 Q: Why is top-posting such a bad thing?
557 Q: What is the most annoying thing in e-mail?"'
558 test_emacs "(notmuch-show \"top-posting\")
559 (test-visible-output)"
560 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
561 Subject: The problem with top-posting
562 To: Notmuch Test Suite <test_suite@notmuchmail.org>
563 Date: Fri, 05 Jan 2001 15:43:57 +0000
565 A: Because it messes up the order in which people normally read text.
566 Q: Why is top-posting such a bad thing?
568 Q: What is the most annoying thing in e-mail?
569 Top Poster <top@poster.com> (2001-01-05) (inbox unread)
570 Subject: Re: The problem with top-posting
571 To: Notmuch Test Suite <test_suite@notmuchmail.org>
572 Date: Fri, 05 Jan 2001 15:43:57 +0000
574 Thanks for the advice! I will be sure to put it to good use.
578 [ 9-line hidden original message. Click/Enter to show. ]" > EXPECTED
579 test_expect_equal_file OUTPUT EXPECTED
581 test_begin_subtest "Hiding message in notmuch-show view"
582 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
583 (notmuch-show-toggle-message)
584 (test-visible-output)'
585 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
587 test_begin_subtest "Hiding message with visible citation in notmuch-show view"
588 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
589 (search-forward "Click/Enter to show.")
590 (button-activate (button-at (point)))
591 (notmuch-show-toggle-message)
592 (test-visible-output)'
593 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
595 test_begin_subtest "Stashing in notmuch-show"
596 add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
597 '[from]="Some One <someone@somewhere.org>"' \
598 '[to]="Some One Else <notsomeone@somewhere.org>"' \
599 '[cc]="Notmuch <notmuch@notmuchmail.org>"' \
600 '[subject]="Stash my stashables"' \
602 '[body]="Unable to stash body. Where did you get it in the first place?!?"'
603 notmuch tag +stashtest id:${gen_msg_id}
604 test_emacs '(notmuch-show "id:\"bought\"")
605 (notmuch-show-stash-date)
606 (notmuch-show-stash-from)
607 (notmuch-show-stash-to)
608 (notmuch-show-stash-cc)
609 (notmuch-show-stash-subject)
610 (notmuch-show-stash-message-id)
611 (notmuch-show-stash-message-id-stripped)
612 (notmuch-show-stash-tags)
613 (notmuch-show-stash-filename)
614 (notmuch-show-stash-mlarchive-link "Gmane")
615 (notmuch-show-stash-mlarchive-link "MARC")
616 (notmuch-show-stash-mlarchive-link "Mail Archive, The")
618 (generate-new-buffer "*test-stashing*"))
622 (rotate-yank-pointer 1))
623 (reverse-region (point-min) (point-max))
626 Sat, 01 Jan 2000 12:00:00 +0000
627 Some One <someone@somewhere.org>
628 Some One Else <notsomeone@somewhere.org>
629 Notmuch <notmuch@notmuchmail.org>
635 http://mid.gmane.org/bought
636 http://marc.info/?i=bought
637 http://mail-archive.com/search?l=mid&q=bought
639 test_expect_equal_file OUTPUT EXPECTED
641 test_begin_subtest "Stashing in notmuch-search"
642 test_emacs '(notmuch-search "id:\"bought\"")
644 (notmuch-search-stash-thread-id)
646 (generate-new-buffer "*test-stashing*"))
649 sed -i -e 's/^thread:.*$/thread:XXX/' OUTPUT
650 test_expect_equal "$(cat OUTPUT)" "thread:XXX"
652 test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
653 message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
654 message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
655 test_emacs "(notmuch-search \"$message1 or $message2\")
657 (notmuch-search-show-thread)
658 (goto-char (point-max))
660 (notmuch-show-advance-and-archive)
662 test_emacs "(notmuch-show \"$message2\")
663 (test-output \"EXPECTED\")"
664 test_expect_equal_file OUTPUT EXPECTED
666 test_begin_subtest "Refresh show buffer"
667 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
668 (test-visible-output "EXPECTED")
669 (notmuch-show-refresh-view)
670 (test-visible-output)'
671 test_expect_equal_file OUTPUT EXPECTED
673 test_begin_subtest "Refresh modified show buffer"
674 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
675 (notmuch-show-toggle-message)
676 (notmuch-show-next-message)
677 (notmuch-show-toggle-message)
678 (test-visible-output "EXPECTED")
679 (notmuch-show-refresh-view)
680 (test-visible-output)'
681 test_expect_equal_file OUTPUT EXPECTED
683 test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts"
684 id='message-with-application/mpeg-attachment@notmuchmail.org'
685 emacs_deliver_message \
686 'Message with application/mpeg attachment' \
689 (insert \"Message-ID: <$id>\n\")
691 (mml-insert-part \"application/mpeg\")
692 (insert \"a fake mp3 file\")"
693 notmuch_counter_reset
694 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
695 (notmuch-show \"id:$id\"))"
696 test_expect_equal $(notmuch_counter_value) 1
698 test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"
699 id='message-with-audio/mpeg-attachment@notmuchmail.org'
700 emacs_deliver_message \
701 'Message with audio/mpeg attachment' \
704 (insert \"Message-ID: <$id>\n\")
706 (mml-insert-part \"audio/mpeg\")
707 (insert \"a fake mp3 file\")"
708 notmuch_counter_reset
709 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
710 (notmuch-show \"id:$id\"))"
711 test_expect_equal $(notmuch_counter_value) 1
713 test_begin_subtest "notmuch-hello-mode hook is called"
714 counter=$(test_emacs \
715 '(let ((notmuch-hello-mode-hook-counter 0))
716 (kill-buffer "*notmuch-hello*")
718 notmuch-hello-mode-hook-counter)'
720 test_expect_equal "$counter" 1
722 test_begin_subtest "notmuch-hello-mode hook is not called on updates"
723 counter=$(test_emacs \
724 '(let ((notmuch-hello-mode-hook-counter 0))
725 (kill-buffer "*notmuch-hello*")
727 (notmuch-hello-update)
728 notmuch-hello-mode-hook-counter)'
730 test_expect_equal "$counter" 1
732 test_begin_subtest "notmuch-hello-refresh hook is called"
733 counter=$(test_emacs \
734 '(let ((notmuch-hello-refresh-hook-counter 0))
735 (kill-buffer "*notmuch-hello*")
737 notmuch-hello-refresh-hook-counter)'
739 test_expect_equal "$counter" 1
741 test_begin_subtest "notmuch-hello-refresh hook is called on updates"
742 counter=$(test_emacs \
743 '(let ((notmuch-hello-refresh-hook-counter 0))
744 (kill-buffer "*notmuch-hello*")
746 (notmuch-hello-update)
747 notmuch-hello-refresh-hook-counter)'
749 test_expect_equal "$counter" 2