mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
cd89065dc3
The new notmuch-search-hide-excluded option allows users to configure whether to show or hide excluded messages (as determined by search.exclude_tags in the local notmuch config file). It defaults to true for now to maintain backwards-compatibility with how notmuch-{search,tree} already worked. New commands notmuch-search-toggle-hide-excluded and notmuch-tree-toggle-exclude have also been added. They toggle the value of notmuch-search-hide-excluded for the search in the current search or tree buffer. It's bound to "i" in the respective keymaps for these modes. Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded which didn't pass through the buffer local value of notmuch-search-oldest-first (and now notmuch-search-exclude). Examples of where I've done this include: + notmuch-jump-search + notmuch-tree-from-search-current-query + notmuch-unthreaded-from-search-current-query + notmuch-tree-from-search-thread A new test file for Emacs has been added which covers the usage of the new `notmuch-search-hide-excluded' option and interactively hiding or showing mail with excluded tags. These test cover the basic usage of the `notmuch-search-toggle-hide-excluded' command in notmuch-search, notmuch-tree and notmuch-unthreaded searches. These tests also cover the persistence of the current value of the hide-excluded mail option as a user switches from between these different search commands. [1]: id:87ilxlxsng.fsf@kisara.moe Amended-by: db, fix indentation in T461-emacs-search-exclude.sh
185 lines
6.4 KiB
Bash
Executable file
185 lines
6.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
test_description="exclude options persist between Emacs search and tree modes"
|
|
. $(dirname "$0")/test-lib.sh || exit 1
|
|
. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
|
|
|
|
EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
|
|
|
|
test_require_emacs
|
|
add_email_corpus
|
|
notmuch config set search.exclude_tags deleted
|
|
notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
|
|
|
|
# Basic test cases just asserting exclude option is working and consistent.
|
|
|
|
test_begin_subtest "Search doesn't contain excluded mail by default"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
|
|
|
|
test_begin_subtest "Toggling exclude in search will show excluded mail"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-search-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_begin_subtest "Tree search doesn't contain excluded mail by default"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
|
|
|
|
test_begin_subtest "Toggling exclude in tree search will show excluded mail"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_begin_subtest "Unthreaded search doesn't contain excluded mail by default"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-unthreaded-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-without-excluded OUTPUT
|
|
|
|
test_begin_subtest "Toggling exclude in unthreaded will show excluded mail"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-unthreaded-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
|
|
|
|
# Cycling from search to tree to unthreaded and vice versa will persist the current
|
|
# value of notmuch-search-hide-excluded.
|
|
|
|
test_begin_subtest "Value of hide-excluded from search persists into tree search"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-search-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_begin_subtest "Value of hide-excluded from search persists into unthreaded"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-search-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(notmuch-unthreaded-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_begin_subtest "Value of hide-excluded from tree persists into search"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(notmuch-search-from-tree-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_begin_subtest "Value of hide-excluded from tree persists into unthreaded"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(notmuch-unthreaded-from-tree-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_begin_subtest "Value of hide-excluded from unthreaded persists into tree"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-unthreaded-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-from-unthreaded-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_begin_subtest "Value of hide-excluded from unthreaded persists into search"
|
|
test_emacs '(notmuch-hello)
|
|
(goto-char (point-min))
|
|
(re-search-forward "inbox")
|
|
(widget-button-press (1- (point)))
|
|
(notmuch-test-wait)
|
|
(notmuch-unthreaded-from-search-current-query)
|
|
(notmuch-test-wait)
|
|
(notmuch-tree-toggle-hide-excluded)
|
|
(notmuch-test-wait)
|
|
(notmuch-search-from-tree-current-query)
|
|
(notmuch-test-wait)
|
|
(test-output)
|
|
(delete-other-windows)'
|
|
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
|
|
|
|
test_done
|