From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MFpZJue03WKmSQEAbAwnHQ (envelope-from ) for ; Sun, 24 Jul 2022 23:08:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QDpQJue03WKsNwAA9RJhRA (envelope-from ) for ; Sun, 24 Jul 2022 23:08:55 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DAD8F28397 for ; Sun, 24 Jul 2022 23:08:54 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id D6F085E025; Sun, 24 Jul 2022 21:08:48 +0000 (UTC) X-Greylist: delayed 553 seconds by postgrey-1.36 at yantan; Sun, 24 Jul 2022 21:08:45 UTC Received: from mail.kisara.moe (119.ip-51-38-65.eu [51.38.65.119]) by mail.notmuchmail.org (Postfix) with ESMTPS id E6B525DC08 for ; Sun, 24 Jul 2022 21:08:45 +0000 (UTC) Received: from mk-macbook (unknown [146.70.132.43]) by mail.kisara.moe (Postfix) with ESMTPSA id 87B52A0B37; Sun, 24 Jul 2022 22:59:31 +0200 (CEST) From: Mohsin Kaleem To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: add new option notmuch-search-exclude In-Reply-To: <87pmm9n7sd.fsf@tethera.net> References: <20211128200207.3455217-1-mohkale@kisara.moe> <8735mij0yo.fsf@tethera.net> <87pmme86cm.fsf@kisara.moe> <8735j9aj4u.fsf@tethera.net> <87wngl4w2n.fsf@kisara.moe> <87zglh92ry.fsf@tethera.net> <87o81xhhto.fsf@kisara.moe> <87v8w591v2.fsf@tethera.net> <87k0clhgw6.fsf@kisara.moe> <87pmm9n7sd.fsf@tethera.net> Date: Sun, 24 Jul 2022 21:59:28 +0100 Message-ID: <87ilnmw7kf.fsf@kisara.moe> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Message-ID-Hash: 2KTJSFWJTTMPPSOXGJ7R6DPH42PAJIFW X-Message-ID-Hash: 2KTJSFWJTTMPPSOXGJ7R6DPH42PAJIFW X-MailFrom: mohkale@kisara.moe X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1658696935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=Vsu9gqsRg54uJMn/priI+gvFAbXwmcxfbny2eAnF6Ys=; b=qTdJ4kX3k7j3m8YGVOqf8//YyJidupfz0RGxISrRkCW/5Qc94KfiJfxioiQsb3Av023apy +iIqzdlpM4dh7kz0+4gcS8vcXiQYGItWMgXyqidxu/WGVzAZcT1vKLOB9KxBA4/pDekcgS VeOCEP+iKb+06Sret2we8dSLTdWIJdFkg7ErJoitCJWApCkHEV3OfdV1+IWoIrfD1SIvTV CWlK8QyPYC27A/VHo40THerC4jeU6ZJEgJZwE7VSz7bZxGVAXMs/QRws0uK/BpmNl8+rSn ddCBixgDo9nmiTc0DLDTGB/lhQvu1ejMZ7+0Ls3+EPdvRx+uQmwAcRnb3IN/bg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658696935; a=rsa-sha256; cv=none; b=rfmArJwJaijYkmEHVcbzdjwwEp9FgCpzs93B36LsfpNW4JDNnZhrfxxTjs6DdWEGpT8n3r 54Pv7uq8BiGhNEd05PS7BewZK5cXFkHyiSNxO2UaZK6WjXQWSFVKEsJOLNzZTcJX2/fSn0 LAQFsaZLs9duAPA1Nt2UmJmpHd6rLEqtmOu/axwU/vfDGFqmrbxSv8D47dNaq1YgCmrjMV ekFLNZKXJlS79R5zP1vXAlEl7e+rk5RBPeqM44ENWcMEHyTwlN6nNFl2oKOzYNCTRZEdb/ JT1FLRtjgbN5kbgzJ0aPwvaXiFmmyCHEoID/OAjm3Ht6PfHUOm1aCrQNuNrMgQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kisara.moe (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 2.37 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kisara.moe (policy=none); spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: DAD8F28397 X-Spam-Score: 2.37 X-Migadu-Scanner: scn0.migadu.com X-TUID: PhP/Lk6587C4 --=-=-= Content-Type: text/plain David Bremner writes: Hi, firstly sorry for taking so long to come back to this. I honestly have tried to fix this multiple times since my last message but kept getting confused or misdirected by how the tests are setup so I gave up and decided to come back to it later. Today I finally just sped through everything and think I have everything ready. > So does "python3 -m pytest" work for you? Assuming yes, is there some > special environment needed? We don't explicitly unset PYTHONPATH in > T391, so in if you need PYTHONPATH to locate pytest, that should work > here as well. What output do you get from "python3 -c 'import pytest; > print(pytest.__file__)'" I ended up just installing pytest with my system package manager. I have no idea why but notmuch could not use the pytest installation under my home directory. To briefly summarize the changes since my last message: * I've added notmuch-hello support as well. Basically just added a new configurable option to `notmuch-saved-searches` for configuring the exclude value. This involved some mild refactoring of notmuch-hello-widget-search. * Updated the interactive spec of `notmuch-tree` and `notmuch-unthreaded` so it sources the default value of `notmuch-search-oldest-first` and `notmuch-search-exclude`. The `notmuch-search` command respected these variables already but these commands didn't (not sure why). * I fixed 2 broken test-cases. These were T310-emacs.60 and T460-emacs-tree.11. The former just didn't include the new option in the expected argv list. The later was because we now persist the value of notmuch-search-oldest-first where previously we defaulted it to nil when switching from a search to tree buffer. The ordering of the messages has changes so the test failed. I added a new expected-output file with the new ordering and everything is fixed now. * I added a new test suite test/T461-emacs-search-exclude.sh which contains test cases for the new features. Note this only extends to the exclude option and it persisting between switches between the different view types. I initially wanted to keep the existing suites like T310 and add some deleted messages to the corpora but because of the way the existing tests were setup they could or could not ended up outputting the deleted messages and having to recalculate the expected-output for them proved too much of a hassle. The new test suite is designed from the outset with some deleted and non-deleted messages and covers how their inclusion in the output changes in a few different scenarios. Note: this suite isn't fully comprehensive. It doesn't cover any of the unthreaded commands, or configuring notmuch-hello with entries deviating from the default. It does cover the core functionality of not showing excluded mail, toggling the inclusion of such mail and switching between notmuch-search and notmuch-tree buffers (and vice versa). I've left the remaining tests as something to come back to later but would prefer leaving them as something to add in a follow up PR if possible. Note: Some of the test cases are still failing: Specifically 4 of them, but their failing on the master branch as well so I believe their unrelated to this PR. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-emacs-add-new-option-notmuch-search-exclude.patch >From 1872120821ccad5d23ab48d128d8d77efd85055d Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sat, 27 Nov 2021 18:58:43 +0000 Subject: [PATCH 01/11] emacs: add new option notmuch-search-exclude The new notmuch-search-exclude option allows users to configure whether to show or hide excluded messages (as determined by search.exclude_tags in the local config file). It defaults to true for now to maintain backwards-compatibility with how notmuch-{search,tree} already worked. New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude have also been added that toggle the value of notmuch-search-exclude 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 If there was a reasoning behind these not persisting the value of these variables then we should revert it before merging and discuss whether it's worth persisting notmuch-search-exclude. [1]: id:87ilxlxsng.fsf@kisara.moe --- emacs/notmuch-jump.el | 11 ++++++---- emacs/notmuch-lib.el | 10 +++++++++ emacs/notmuch-tree.el | 40 ++++++++++++++++++++++++--------- emacs/notmuch.el | 51 +++++++++++++++++++++++++++++++++---------- 4 files changed, 87 insertions(+), 25 deletions(-) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 6a276928..e98c9c1d 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch." (cl-case (plist-get saved-search :sort-order) (newest-first nil) (oldest-first t) - (otherwise (default-value 'notmuch-search-oldest-first))))) + (otherwise (default-value 'notmuch-search-oldest-first)))) + (exclude (default-value 'notmuch-search-exclude))) (push (list key name (cond ((eq (plist-get saved-search :search-type) 'tree) - (lambda () (notmuch-tree query))) + (lambda () (notmuch-tree query nil nil nil nil nil nil + oldest-first exclude))) ((eq (plist-get saved-search :search-type) 'unthreaded) - (lambda () (notmuch-unthreaded query))) + (lambda () (notmuch-unthreaded query nil nil nil nil + oldest-first exclude))) (t - (lambda () (notmuch-search query oldest-first))))) + (lambda () (notmuch-search query oldest-first exclude))))) action-map))))) (setq action-map (nreverse action-map)) (if action-map diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 6fc71cc7..9a0e470e 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -105,6 +105,16 @@ search." :group 'notmuch-search) (make-variable-buffer-local 'notmuch-search-oldest-first) +(defcustom notmuch-search-exclude t + "Hide mail tagged with a excluded tag. + +Excluded tags are defined in the users configuration file under +the search section. When this variable is true, any mail with +such a tag will not be shown in the search output." + :type 'boolean + :group 'notmuch-search) +(make-variable-buffer-local 'notmuch-search-exclude) + (defcustom notmuch-poll-script nil "[Deprecated] Command to run to incorporate new mail into the notmuch database. diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 303c6fad..e4d9ae44 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -363,6 +363,7 @@ then NAME behaves like CMD." (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) (define-key map "o" 'notmuch-tree-toggle-order) + (define-key map "i" 'notmuch-tree-toggle-exclude) (define-key map "S" 'notmuch-search-from-tree-current-query) (define-key map "U" 'notmuch-unthreaded-from-tree-current-query) (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query) @@ -578,7 +579,9 @@ NOT change the database." "Call notmuch search with the current query." (interactive) (notmuch-tree-close-message-window) - (notmuch-search (notmuch-tree-get-query))) + (notmuch-search (notmuch-tree-get-query) + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-tree-message-window-kill-hook () "Close the message pane when exiting the show buffer." @@ -791,7 +794,8 @@ nil otherwise." target nil unthreaded - notmuch-search-oldest-first))) + notmuch-search-oldest-first + notmuch-search-exclude))) (defun notmuch-tree-thread-top () (when (notmuch-tree-get-message-properties) @@ -1108,7 +1112,8 @@ Complete list of currently available key bindings: results-buf))))) (defun notmuch-tree-worker (basic-query &optional query-context target - open-target unthreaded oldest-first) + open-target unthreaded oldest-first + exclude) "Insert the tree view of the search in the current buffer. This is is a helper function for notmuch-tree. The arguments are @@ -1117,6 +1122,7 @@ the same as for the function notmuch-tree." (notmuch-tree-mode) (add-hook 'post-command-hook #'notmuch-tree-command-hook t t) (setq notmuch-search-oldest-first oldest-first) + (setq notmuch-search-exclude exclude) (setq notmuch-tree-unthreaded unthreaded) (setq notmuch-tree-basic-query basic-query) (setq notmuch-tree-query-context (if (or (string= query-context "") @@ -1136,14 +1142,15 @@ the same as for the function notmuch-tree." (and query-context (concat " and (" query-context ")")))) (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first")) - (message-arg (if unthreaded "--unthreaded" "--entire-thread"))) + (message-arg (if unthreaded "--unthreaded" "--entire-thread")) + (exclude-arg (if exclude "--exclude=true" "--exclude=false"))) (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0") (setq search-args basic-query)) (notmuch-tag-clear-cache) (let ((proc (notmuch-start-notmuch "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel "show" "--body=false" "--format=sexp" "--format-version=5" - sort-arg message-arg search-args)) + sort-arg message-arg exclude-arg search-args)) ;; Use a scratch buffer to accumulate partial output. ;; This buffer will be killed by the sentinel, which ;; should be called no matter how the process dies. @@ -1170,8 +1177,18 @@ default sort order is defined by `notmuch-search-oldest-first'." (setq notmuch-search-oldest-first (not notmuch-search-oldest-first)) (notmuch-tree-refresh-view)) +(defun notmuch-tree-toggle-exclude () + "Toggle whether to hide excluded messages. + +This command toggles whether to hide excluded messages for the current +search. The default value for this is defined by `notmuch-search-exclude'." + (interactive) + (setq notmuch-search-exclude (not notmuch-search-exclude)) + (notmuch-tree-refresh-view)) + (defun notmuch-tree (&optional query query-context target buffer-name - open-target unthreaded parent-buffer oldest-first) + open-target unthreaded parent-buffer + oldest-first exclude) "Display threads matching QUERY in tree view. The arguments are: @@ -1200,17 +1217,19 @@ The arguments are: (pop-to-buffer-same-window buffer)) ;; Don't track undo information for this buffer (setq buffer-undo-list t) - (notmuch-tree-worker query query-context target open-target unthreaded oldest-first) + (notmuch-tree-worker query query-context target open-target + unthreaded oldest-first exclude) (setq notmuch-tree-parent-buffer parent-buffer) (setq truncate-lines t)) (defun notmuch-unthreaded (&optional query query-context target buffer-name - open-target) + open-target oldest-first exclude) "Display threads matching QUERY in unthreaded view. See function NOTMUCH-TREE for documentation of the arguments" (interactive) - (notmuch-tree query query-context target buffer-name open-target t)) + (notmuch-tree query query-context target buffer-name open-target + t nil oldest-first exclude)) (defun notmuch-tree-filter (query) "Filter or LIMIT the current search results based on an additional query string. @@ -1244,7 +1263,8 @@ search results and that are also tagged with the given TAG." nil notmuch-tree-unthreaded nil - notmuch-search-oldest-first))) + notmuch-search-oldest-first + notmuch-search-exclude))) ;;; _ diff --git a/emacs/notmuch.el b/emacs/notmuch.el index c9cf80dc..a42cb576 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -178,6 +178,7 @@ there will be called at other points of notmuch execution." (define-key map "r" 'notmuch-search-reply-to-thread-sender) (define-key map "R" 'notmuch-search-reply-to-thread) (define-key map "o" 'notmuch-search-toggle-order) + (define-key map "i" 'notmuch-search-toggle-exclude) (define-key map "c" 'notmuch-search-stash-map) (define-key map "t" 'notmuch-search-filter-by-tag) (define-key map "l" 'notmuch-search-filter) @@ -537,12 +538,18 @@ thread." (defun notmuch-tree-from-search-current-query () "Tree view of current query." (interactive) - (notmuch-tree notmuch-search-query-string)) + (notmuch-tree notmuch-search-query-string + nil nil nil nil nil nil + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-unthreaded-from-search-current-query () "Unthreaded view of current query." (interactive) - (notmuch-unthreaded notmuch-search-query-string)) + (notmuch-unthreaded notmuch-search-query-string + nil nil nil nil + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-tree-from-search-thread () "Show the selected thread with notmuch-tree." @@ -551,7 +558,9 @@ thread." notmuch-search-query-string nil (notmuch-prettify-subject (notmuch-search-find-subject)) - t nil (current-buffer))) + t nil (current-buffer) + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-search-reply-to-thread (&optional prompt-for-sender) "Begin composing a reply-all to the entire current thread in a new buffer." @@ -1021,14 +1030,15 @@ PROMPT is the string to prompt with." (put 'notmuch-search 'notmuch-doc "Search for messages.") ;;;###autoload -(defun notmuch-search (&optional query oldest-first target-thread target-line - no-display) +(defun notmuch-search (&optional query oldest-first exclude target-thread + target-line no-display) "Display threads matching QUERY in a notmuch-search buffer. If QUERY is nil, it is read interactively from the minibuffer. Other optional parameters are used as follows: OLDEST-FIRST: A Boolean controlling the sort order of returned threads + EXCLUDE: A boolean controlling whether to omit threads with excluded tags. TARGET-THREAD: A thread ID (without the thread: prefix) that will be made current if it appears in the search results. TARGET-LINE: The line number to move to if the target thread does not @@ -1043,9 +1053,10 @@ the configured default sort order." (list ;; Prompt for a query nil - ;; Use the default search order (if we're doing a search from a - ;; search buffer, ignore any buffer-local overrides) - (default-value 'notmuch-search-oldest-first))) + ;; Use the default search order and exclude value (if we're doing a + ;; search from a search buffer, ignore any buffer-local overrides) + (default-value 'notmuch-search-oldest-first) + (default-value 'notmuch-search-exclude))) (let* ((query (or query (notmuch-read-query "Notmuch search: "))) (buffer (get-buffer-create (notmuch-search-buffer-title query)))) @@ -1059,6 +1070,7 @@ the configured default sort order." (setq notmuch-search-oldest-first oldest-first) (setq notmuch-search-target-thread target-thread) (setq notmuch-search-target-line target-line) + (setq notmuch-search-exclude exclude) (notmuch-tag-clear-cache) (when (get-buffer-process buffer) (error "notmuch search process already running for query `%s'" query)) @@ -1072,6 +1084,9 @@ the configured default sort order." (if oldest-first "--sort=oldest-first" "--sort=newest-first") + (if exclude + "--exclude=true" + "--exclude=false") query))) ;; Use a scratch buffer to accumulate partial output. ;; This buffer will be killed by the sentinel, which @@ -1092,11 +1107,21 @@ same relative position within the new buffer." (interactive) (notmuch-search notmuch-search-query-string notmuch-search-oldest-first + notmuch-search-exclude (notmuch-search-find-thread-id 'bare) (line-number-at-pos) t) (goto-char (point-min))) +(defun notmuch-search-toggle-exclude () + "Toggle whether to hide excluded messages. + +This command toggles whether to hide excluded messages for the current +search. The default value for this is defined by `notmuch-search-exclude'." + (interactive) + (setq notmuch-search-exclude (not notmuch-search-exclude)) + (notmuch-search-refresh-view)) + (defun notmuch-search-toggle-order () "Toggle the current search order. @@ -1125,7 +1150,8 @@ current search results AND the additional query string provided." (notmuch-search (if (string= grouped-original-query "*") grouped-query (concat grouped-original-query " and " grouped-query)) - notmuch-search-oldest-first))) + notmuch-search-oldest-first + notmuch-search-exclude))) (defun notmuch-search-filter-by-tag (tag) "Filter the current search results based on a single TAG. @@ -1136,13 +1162,16 @@ search results and that are also tagged with the given TAG." (list (notmuch-select-tag-with-completion "Filter by tag: " notmuch-search-query-string))) (notmuch-search (concat notmuch-search-query-string " and tag:" tag) - notmuch-search-oldest-first)) + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-search-by-tag (tag) "Display threads matching TAG in a notmuch-search buffer." (interactive (list (notmuch-select-tag-with-completion "Notmuch search tag: "))) - (notmuch-search (concat "tag:" tag))) + (notmuch-search (concat "tag:" tag) + (default-value 'notmuch-search-oldest-first) + (default-value 'notmuch-search-exclude))) ;;;###autoload (defun notmuch () -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-docs-Update-with-notmuch-toggle-exclude.patch >From 57c13040b305d26f80321c2b435b950ee5a16a4a Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Tue, 22 Mar 2022 13:04:14 +0000 Subject: [PATCH 02/11] docs: Update with notmuch-*-toggle-exclude --- devel/emacs-keybindings.org | 2 +- doc/notmuch-emacs.rst | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org index 00977bc3..d0ec2633 100644 --- a/devel/emacs-keybindings.org +++ b/devel/emacs-keybindings.org @@ -9,7 +9,7 @@ | f | | notmuch-show-forward-message | notmuch-show-forward-message | | g | | | | | h | | notmuch-show-toggle-visibility-headers | | -| i | | | | +| i | notmuch-search-toggle-exclude | | notmuch-tree-toggle-exclude | | j | notmuch-jump-search | notmuch-jump-search | notmuch-jump-search | | k | notmuch-tag-jump | notmuch-tag-jump | notmuch-tag-jump | | l | notmuch-search-filter | notmuch-show-filter-thread | notmuch-tree-filter | diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst index 41f62390..dacc5b60 100644 --- a/doc/notmuch-emacs.rst +++ b/doc/notmuch-emacs.rst @@ -162,6 +162,9 @@ menu of results that the user can explore further by pressing ``g`` ``=`` Refresh the buffer +``i`` + Toggle whether to show messages with excluded tags in search results. + ``?`` Display full set of key bindings @@ -321,6 +324,8 @@ tags. ``t`` ``notmuch-tree-filter-by-tag`` Filter the current search results based on an additional tag +``i`` + Toggle whether to show messages with excluded tags in search results. ``g`` ``=`` Refresh the buffer -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-emacs-add-new-option-notmuch-search-exclude.patch >From 9eb028463bfd6000f3e9da2d46f7a2118bea6f93 Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sat, 27 Nov 2021 18:58:43 +0000 Subject: [PATCH 03/11] emacs: add new option notmuch-search-exclude The new notmuch-search-exclude option allows users to configure whether to show or hide excluded messages (as determined by search.exclude_tags in the local config file). It defaults to true for now to maintain backwards-compatibility with how notmuch-{search,tree} already worked. New commands notmuch-search-toggle-exclude and notmuch-tree-toggle-exclude have also been added that toggle the value of notmuch-search-exclude 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 If there was a reasoning behind these not persisting the value of these variables then we should revert it before merging and discuss whether it's worth persisting notmuch-search-exclude. [1]: id:87ilxlxsng.fsf@kisara.moe --- emacs/notmuch-jump.el | 11 ++++++---- emacs/notmuch-lib.el | 10 +++++++++ emacs/notmuch-tree.el | 40 ++++++++++++++++++++++++--------- emacs/notmuch.el | 51 +++++++++++++++++++++++++++++++++---------- 4 files changed, 87 insertions(+), 25 deletions(-) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 6a276928..e98c9c1d 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -50,15 +50,18 @@ fast way to jump to a saved search from anywhere in Notmuch." (cl-case (plist-get saved-search :sort-order) (newest-first nil) (oldest-first t) - (otherwise (default-value 'notmuch-search-oldest-first))))) + (otherwise (default-value 'notmuch-search-oldest-first)))) + (exclude (default-value 'notmuch-search-exclude))) (push (list key name (cond ((eq (plist-get saved-search :search-type) 'tree) - (lambda () (notmuch-tree query))) + (lambda () (notmuch-tree query nil nil nil nil nil nil + oldest-first exclude))) ((eq (plist-get saved-search :search-type) 'unthreaded) - (lambda () (notmuch-unthreaded query))) + (lambda () (notmuch-unthreaded query nil nil nil nil + oldest-first exclude))) (t - (lambda () (notmuch-search query oldest-first))))) + (lambda () (notmuch-search query oldest-first exclude))))) action-map))))) (setq action-map (nreverse action-map)) (if action-map diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 1e631d0e..d5682ebe 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -105,6 +105,16 @@ search." :group 'notmuch-search) (make-variable-buffer-local 'notmuch-search-oldest-first) +(defcustom notmuch-search-exclude t + "Hide mail tagged with a excluded tag. + +Excluded tags are defined in the users configuration file under +the search section. When this variable is true, any mail with +such a tag will not be shown in the search output." + :type 'boolean + :group 'notmuch-search) +(make-variable-buffer-local 'notmuch-search-exclude) + (defcustom notmuch-poll-script nil "[Deprecated] Command to run to incorporate new mail into the notmuch database. diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 303c6fad..e4d9ae44 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -363,6 +363,7 @@ then NAME behaves like CMD." (define-key map [remap notmuch-jump-search] 'notmuch-tree-jump-search) (define-key map "o" 'notmuch-tree-toggle-order) + (define-key map "i" 'notmuch-tree-toggle-exclude) (define-key map "S" 'notmuch-search-from-tree-current-query) (define-key map "U" 'notmuch-unthreaded-from-tree-current-query) (define-key map "Z" 'notmuch-tree-from-unthreaded-current-query) @@ -578,7 +579,9 @@ NOT change the database." "Call notmuch search with the current query." (interactive) (notmuch-tree-close-message-window) - (notmuch-search (notmuch-tree-get-query))) + (notmuch-search (notmuch-tree-get-query) + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-tree-message-window-kill-hook () "Close the message pane when exiting the show buffer." @@ -791,7 +794,8 @@ nil otherwise." target nil unthreaded - notmuch-search-oldest-first))) + notmuch-search-oldest-first + notmuch-search-exclude))) (defun notmuch-tree-thread-top () (when (notmuch-tree-get-message-properties) @@ -1108,7 +1112,8 @@ Complete list of currently available key bindings: results-buf))))) (defun notmuch-tree-worker (basic-query &optional query-context target - open-target unthreaded oldest-first) + open-target unthreaded oldest-first + exclude) "Insert the tree view of the search in the current buffer. This is is a helper function for notmuch-tree. The arguments are @@ -1117,6 +1122,7 @@ the same as for the function notmuch-tree." (notmuch-tree-mode) (add-hook 'post-command-hook #'notmuch-tree-command-hook t t) (setq notmuch-search-oldest-first oldest-first) + (setq notmuch-search-exclude exclude) (setq notmuch-tree-unthreaded unthreaded) (setq notmuch-tree-basic-query basic-query) (setq notmuch-tree-query-context (if (or (string= query-context "") @@ -1136,14 +1142,15 @@ the same as for the function notmuch-tree." (and query-context (concat " and (" query-context ")")))) (sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first")) - (message-arg (if unthreaded "--unthreaded" "--entire-thread"))) + (message-arg (if unthreaded "--unthreaded" "--entire-thread")) + (exclude-arg (if exclude "--exclude=true" "--exclude=false"))) (when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0") (setq search-args basic-query)) (notmuch-tag-clear-cache) (let ((proc (notmuch-start-notmuch "notmuch-tree" (current-buffer) #'notmuch-tree-process-sentinel "show" "--body=false" "--format=sexp" "--format-version=5" - sort-arg message-arg search-args)) + sort-arg message-arg exclude-arg search-args)) ;; Use a scratch buffer to accumulate partial output. ;; This buffer will be killed by the sentinel, which ;; should be called no matter how the process dies. @@ -1170,8 +1177,18 @@ default sort order is defined by `notmuch-search-oldest-first'." (setq notmuch-search-oldest-first (not notmuch-search-oldest-first)) (notmuch-tree-refresh-view)) +(defun notmuch-tree-toggle-exclude () + "Toggle whether to hide excluded messages. + +This command toggles whether to hide excluded messages for the current +search. The default value for this is defined by `notmuch-search-exclude'." + (interactive) + (setq notmuch-search-exclude (not notmuch-search-exclude)) + (notmuch-tree-refresh-view)) + (defun notmuch-tree (&optional query query-context target buffer-name - open-target unthreaded parent-buffer oldest-first) + open-target unthreaded parent-buffer + oldest-first exclude) "Display threads matching QUERY in tree view. The arguments are: @@ -1200,17 +1217,19 @@ The arguments are: (pop-to-buffer-same-window buffer)) ;; Don't track undo information for this buffer (setq buffer-undo-list t) - (notmuch-tree-worker query query-context target open-target unthreaded oldest-first) + (notmuch-tree-worker query query-context target open-target + unthreaded oldest-first exclude) (setq notmuch-tree-parent-buffer parent-buffer) (setq truncate-lines t)) (defun notmuch-unthreaded (&optional query query-context target buffer-name - open-target) + open-target oldest-first exclude) "Display threads matching QUERY in unthreaded view. See function NOTMUCH-TREE for documentation of the arguments" (interactive) - (notmuch-tree query query-context target buffer-name open-target t)) + (notmuch-tree query query-context target buffer-name open-target + t nil oldest-first exclude)) (defun notmuch-tree-filter (query) "Filter or LIMIT the current search results based on an additional query string. @@ -1244,7 +1263,8 @@ search results and that are also tagged with the given TAG." nil notmuch-tree-unthreaded nil - notmuch-search-oldest-first))) + notmuch-search-oldest-first + notmuch-search-exclude))) ;;; _ diff --git a/emacs/notmuch.el b/emacs/notmuch.el index c9cf80dc..a42cb576 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -178,6 +178,7 @@ there will be called at other points of notmuch execution." (define-key map "r" 'notmuch-search-reply-to-thread-sender) (define-key map "R" 'notmuch-search-reply-to-thread) (define-key map "o" 'notmuch-search-toggle-order) + (define-key map "i" 'notmuch-search-toggle-exclude) (define-key map "c" 'notmuch-search-stash-map) (define-key map "t" 'notmuch-search-filter-by-tag) (define-key map "l" 'notmuch-search-filter) @@ -537,12 +538,18 @@ thread." (defun notmuch-tree-from-search-current-query () "Tree view of current query." (interactive) - (notmuch-tree notmuch-search-query-string)) + (notmuch-tree notmuch-search-query-string + nil nil nil nil nil nil + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-unthreaded-from-search-current-query () "Unthreaded view of current query." (interactive) - (notmuch-unthreaded notmuch-search-query-string)) + (notmuch-unthreaded notmuch-search-query-string + nil nil nil nil + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-tree-from-search-thread () "Show the selected thread with notmuch-tree." @@ -551,7 +558,9 @@ thread." notmuch-search-query-string nil (notmuch-prettify-subject (notmuch-search-find-subject)) - t nil (current-buffer))) + t nil (current-buffer) + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-search-reply-to-thread (&optional prompt-for-sender) "Begin composing a reply-all to the entire current thread in a new buffer." @@ -1021,14 +1030,15 @@ PROMPT is the string to prompt with." (put 'notmuch-search 'notmuch-doc "Search for messages.") ;;;###autoload -(defun notmuch-search (&optional query oldest-first target-thread target-line - no-display) +(defun notmuch-search (&optional query oldest-first exclude target-thread + target-line no-display) "Display threads matching QUERY in a notmuch-search buffer. If QUERY is nil, it is read interactively from the minibuffer. Other optional parameters are used as follows: OLDEST-FIRST: A Boolean controlling the sort order of returned threads + EXCLUDE: A boolean controlling whether to omit threads with excluded tags. TARGET-THREAD: A thread ID (without the thread: prefix) that will be made current if it appears in the search results. TARGET-LINE: The line number to move to if the target thread does not @@ -1043,9 +1053,10 @@ the configured default sort order." (list ;; Prompt for a query nil - ;; Use the default search order (if we're doing a search from a - ;; search buffer, ignore any buffer-local overrides) - (default-value 'notmuch-search-oldest-first))) + ;; Use the default search order and exclude value (if we're doing a + ;; search from a search buffer, ignore any buffer-local overrides) + (default-value 'notmuch-search-oldest-first) + (default-value 'notmuch-search-exclude))) (let* ((query (or query (notmuch-read-query "Notmuch search: "))) (buffer (get-buffer-create (notmuch-search-buffer-title query)))) @@ -1059,6 +1070,7 @@ the configured default sort order." (setq notmuch-search-oldest-first oldest-first) (setq notmuch-search-target-thread target-thread) (setq notmuch-search-target-line target-line) + (setq notmuch-search-exclude exclude) (notmuch-tag-clear-cache) (when (get-buffer-process buffer) (error "notmuch search process already running for query `%s'" query)) @@ -1072,6 +1084,9 @@ the configured default sort order." (if oldest-first "--sort=oldest-first" "--sort=newest-first") + (if exclude + "--exclude=true" + "--exclude=false") query))) ;; Use a scratch buffer to accumulate partial output. ;; This buffer will be killed by the sentinel, which @@ -1092,11 +1107,21 @@ same relative position within the new buffer." (interactive) (notmuch-search notmuch-search-query-string notmuch-search-oldest-first + notmuch-search-exclude (notmuch-search-find-thread-id 'bare) (line-number-at-pos) t) (goto-char (point-min))) +(defun notmuch-search-toggle-exclude () + "Toggle whether to hide excluded messages. + +This command toggles whether to hide excluded messages for the current +search. The default value for this is defined by `notmuch-search-exclude'." + (interactive) + (setq notmuch-search-exclude (not notmuch-search-exclude)) + (notmuch-search-refresh-view)) + (defun notmuch-search-toggle-order () "Toggle the current search order. @@ -1125,7 +1150,8 @@ current search results AND the additional query string provided." (notmuch-search (if (string= grouped-original-query "*") grouped-query (concat grouped-original-query " and " grouped-query)) - notmuch-search-oldest-first))) + notmuch-search-oldest-first + notmuch-search-exclude))) (defun notmuch-search-filter-by-tag (tag) "Filter the current search results based on a single TAG. @@ -1136,13 +1162,16 @@ search results and that are also tagged with the given TAG." (list (notmuch-select-tag-with-completion "Filter by tag: " notmuch-search-query-string))) (notmuch-search (concat notmuch-search-query-string " and tag:" tag) - notmuch-search-oldest-first)) + notmuch-search-oldest-first + notmuch-search-exclude)) (defun notmuch-search-by-tag (tag) "Display threads matching TAG in a notmuch-search buffer." (interactive (list (notmuch-select-tag-with-completion "Notmuch search tag: "))) - (notmuch-search (concat "tag:" tag))) + (notmuch-search (concat "tag:" tag) + (default-value 'notmuch-search-oldest-first) + (default-value 'notmuch-search-exclude))) ;;;###autoload (defun notmuch () -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-docs-Update-with-notmuch-toggle-exclude.patch >From c957b208612beb54a3b4225f990729b4cdb7ca6e Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Tue, 22 Mar 2022 13:04:14 +0000 Subject: [PATCH 04/11] docs: Update with notmuch-*-toggle-exclude --- devel/emacs-keybindings.org | 2 +- doc/notmuch-emacs.rst | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org index 00977bc3..d0ec2633 100644 --- a/devel/emacs-keybindings.org +++ b/devel/emacs-keybindings.org @@ -9,7 +9,7 @@ | f | | notmuch-show-forward-message | notmuch-show-forward-message | | g | | | | | h | | notmuch-show-toggle-visibility-headers | | -| i | | | | +| i | notmuch-search-toggle-exclude | | notmuch-tree-toggle-exclude | | j | notmuch-jump-search | notmuch-jump-search | notmuch-jump-search | | k | notmuch-tag-jump | notmuch-tag-jump | notmuch-tag-jump | | l | notmuch-search-filter | notmuch-show-filter-thread | notmuch-tree-filter | diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst index 78528785..0323b56b 100644 --- a/doc/notmuch-emacs.rst +++ b/doc/notmuch-emacs.rst @@ -201,6 +201,9 @@ menu of results that the user can explore further by pressing ``g`` ``=`` Refresh the buffer +``i`` + Toggle whether to show messages with excluded tags in search results. + ``?`` Display full set of key bindings @@ -384,6 +387,8 @@ tags. ``t`` ``notmuch-tree-filter-by-tag`` Filter the current search results based on an additional tag +``i`` + Toggle whether to show messages with excluded tags in search results. ``g`` ``=`` Refresh the buffer -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0005-test-Fix-Search-handles-subprocess-error-exit-codes.patch >From e9ce2bf2eaf2aabba3faee2e128bbf95329eb602 Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sun, 24 Jul 2022 16:30:58 +0100 Subject: [PATCH 05/11] test: Fix Search handles subprocess error exit codes Add in a new option --exclude which wasn't previously passed to the subprocess. --- test/T310-emacs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 9d0df187..b89a100e 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -1030,7 +1030,7 @@ End of search results. YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details) === ERROR === YYY/notmuch_fail exited with status 1 -command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox +command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first --exclude\=false tag\:inbox exit status: 1" test_begin_subtest "Search handles subprocess warnings" -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0006-test-Fix-Navigation-of-notmuch-hello-to-search-resul.patch >From dbccbadc5ebed5e990aeae11a3efeea5e4017273 Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sun, 24 Jul 2022 16:55:49 +0100 Subject: [PATCH 06/11] test: Fix Navigation of notmuch-hello to search results Using the widget properly applies the notmuch-search-exclude and notmuch-search-oldest-first options. Since the latter is now passed when switching between notmuch-search and notmuch-tree buffers it broke the ordering of output this test expected. I did consider just updating the output file to match what's being outputted but for some reason it wasn't being very deterministic (changed after every test-run) so I instead opted to use a search method which didn't populate either of the previous options. --- test/T460-emacs-tree.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh index 0f23b418..6958073e 100755 --- a/test/T460-emacs-tree.sh +++ b/test/T460-emacs-tree.sh @@ -91,10 +91,7 @@ output=$(notmuch search --output=messages 'tag:test_thread_tag') test_expect_equal "$output" "" test_begin_subtest "Navigation of notmuch-hello to search results" -test_emacs '(notmuch-hello) - (goto-char (point-min)) - (re-search-forward "inbox") - (widget-button-press (1- (point))) +test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) (notmuch-tree-from-search-current-query) (notmuch-test-wait) -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0007-feat-Allow-exclude-configuration-in-notmuch-hello.patch >From 723d9f217ad10206470f3b0a06572438f92af982 Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sun, 24 Jul 2022 19:18:08 +0100 Subject: [PATCH 07/11] feat: Allow :exclude configuration in notmuch-hello --- emacs/notmuch-hello.el | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 4662e704..810f094e 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -143,6 +143,10 @@ a plist. Supported properties are :sort-order Specify the sort order to be used for the search. Possible values are `oldest-first', `newest-first' or nil. Nil means use the default sort order. + :excluded Whether to include mail with excluded tags in the + search. Possible values are `include', `exclude', + or nil. Nil means use the default value of + `notmuch-search-exclude'. :search-type Specify whether to run the search in search-mode, tree mode or unthreaded mode. Set to `tree' to specify tree mode, 'unthreaded to specify @@ -484,19 +488,19 @@ diagonal." append (notmuch-hello-reflect-generate-row ncols nrows row list)))) (defun notmuch-hello-widget-search (widget &rest _ignore) - (cl-case (widget-get widget :notmuch-search-type) - (tree - (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t))) - (notmuch-tree (widget-get widget :notmuch-search-terms) - nil nil n nil nil nil - (widget-get widget :notmuch-search-oldest-first)))) - (unthreaded - (let ((n (notmuch-search-format-buffer-name (widget-value widget) - "unthreaded" t))) - (notmuch-unthreaded (widget-get widget :notmuch-search-terms) nil nil n))) - (t - (notmuch-search (widget-get widget :notmuch-search-terms) - (widget-get widget :notmuch-search-oldest-first))))) + (let ((search-terms (widget-get widget :notmuch-search-terms)) + (oldest-first (widget-get widget :notmuch-search-oldest-first)) + (exclude (widget-get widget :notmuch-search-exclude))) + (cl-case (widget-get widget :notmuch-search-type) + (tree + (let ((n (notmuch-search-format-buffer-name (widget-value widget) "tree" t))) + (notmuch-tree search-terms nil nil n nil nil nil oldest-first exclude))) + (unthreaded + (let ((n (notmuch-search-format-buffer-name (widget-value widget) + "unthreaded" t))) + (notmuch-unthreaded search-terms nil nil n nil oldest-first search-exclude))) + (t + (notmuch-search search-terms oldest-first exclude))))) (defun notmuch-saved-search-count (search) (car (notmuch--process-lines notmuch-command "count" search))) @@ -643,6 +647,10 @@ with `notmuch-hello-query-counts'." (newest-first nil) (oldest-first t) (otherwise notmuch-search-oldest-first))) + (exclude (cl-case (plist-get elem :excluded) + (exclude t) + (include nil) + (otherwise notmuch-search-exclude))) (search-type (plist-get elem :search-type)) (msg-count (plist-get elem :count))) (widget-insert (format "%8s " @@ -652,6 +660,7 @@ with `notmuch-hello-query-counts'." :notmuch-search-terms query :notmuch-search-oldest-first oldest-first :notmuch-search-type search-type + :notmuch-search-exclude exclude name) (setq column-indent (1+ (max 0 (- column-width (length name))))))) -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0008-Revert-test-Fix-Navigation-of-notmuch-hello-to-searc.patch >From ef6b6553334eb06c25e2c0b9a7aa5d733a97aa2c Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sun, 24 Jul 2022 19:55:18 +0100 Subject: [PATCH 08/11] Revert "test: Fix Navigation of notmuch-hello to search results" This reverts commit dbccbadc5ebed5e990aeae11a3efeea5e4017273. --- test/T460-emacs-tree.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh index 6958073e..0f23b418 100755 --- a/test/T460-emacs-tree.sh +++ b/test/T460-emacs-tree.sh @@ -91,7 +91,10 @@ output=$(notmuch search --output=messages 'tag:test_thread_tag') test_expect_equal "$output" "" test_begin_subtest "Navigation of notmuch-hello to search results" -test_emacs '(notmuch-search "tag:inbox") +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) -- 2.37.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0009-feat-Add-more-interactive-specs.patch >From ad6bb0fbb18bb8be59e242842ccd7ea85e8c9a3e Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sun, 24 Jul 2022 20:18:10 +0100 Subject: [PATCH 09/11] feat: Add more interactive specs --- emacs/notmuch-tree.el | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el index 50b9645e..6c8b7bc0 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -1202,7 +1202,15 @@ The arguments are: it is nil \"*notmuch-tree\" followed by QUERY is used. OPEN-TARGET: If TRUE open the target message in the message pane. UNTHREADED: If TRUE only show matching messages in an unthreaded view." - (interactive) + (interactive + (list + ;; Prompt for a query + nil + ;; Fill other args with nil. + nil nil nil nil nil nil + ;; Populate these from the default value of these options. + (default-value 'notmuch-search-oldest-first) + (default-value 'notmuch-search-exclude))) (unless query (setq query (notmuch-read-query (concat "Notmuch " (if unthreaded "unthreaded " "tree ") @@ -1226,7 +1234,15 @@ The arguments are: "Display threads matching QUERY in unthreaded view. See function NOTMUCH-TREE for documentation of the arguments" - (interactive) + (interactive + (list + ;; Prompt for a query + nil + ;; Fill other args with nil. + nil nil nil nil + ;; Populate these from the default value of these options. + (default-value 'notmuch-search-oldest-first) + (default-value 'notmuch-search-exclude))) (notmuch-tree query query-context target buffer-name open-target t nil oldest-first exclude)) -- 2.37.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0010-test-Add-test-cases-for-new-exclude-option.patch Content-Transfer-Encoding: quoted-printable >From 34fdf187e24ac9e1b39db277ec261ab2a4ee82f0 Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sun, 24 Jul 2022 20:20:23 +0100 Subject: [PATCH 10/11] test: Add test cases for new exclude option --- test/T461-emacs-search-exclude.sh | 99 +++++++++++++++++++ .../notmuch-search-tag-inbox-with-excluded | 25 +++++ .../notmuch-search-tag-inbox-without-excluded | 21 ++++ .../notmuch-tree-tag-inbox-with-excluded | 53 ++++++++++ .../notmuch-tree-tag-inbox-without-excluded | 49 +++++++++ 5 files changed, 247 insertions(+) create mode 100755 test/T461-emacs-search-exclude.sh create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-i= nbox-with-excluded create mode 100644 test/emacs-exclude.expected-output/notmuch-search-tag-i= nbox-without-excluded create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inb= ox-with-excluded create mode 100644 test/emacs-exclude.expected-output/notmuch-tree-tag-inb= ox-without-excluded diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exc= lude.sh new file mode 100755 index 00000000..bf558847 --- /dev/null +++ b/test/T461-emacs-search-exclude.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +test_description=3D"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=3D$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-exclude) + (notmuch-test-wait) + (test-output) + (delete-other-windows)' +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OU= TPUT + +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 O= UTPUT + +test_begin_subtest "Toggling exclude in tree search will show excluded mai= l" +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-exclude) + (notmuch-test-wait) + (test-output) + (delete-other-windows)' +test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTP= UT + +# Choice of showing excluded mail persists when switching between tree and= search +# buffers. + +test_begin_subtest "Value of exclude 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-exclude) + (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 OUTP= UT + +test_begin_subtest "Value of exclude from tree persists into search 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-exclude) + (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 OU= TPUT + +# TODO: Add test cases for unthreaded conversions as well. + +test_done diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-wi= th-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-w= ith-excluded new file mode 100644 index 00000000..ce1d7118 --- /dev/null +++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excl= uded @@ -0,0 +1,25 @@ + 2009-11-17 [5/5] Mikhail Gusarov, Carl Worth, Keith Packard [notmuch]= [PATCH 1/2] Close message file after parsing message headers (inbox unread) + 2009-11-17 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard,= Carl Worth [notmuch] Working with Maildir storage? (inbox signed unread) + 2009-11-17 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] preliminary = FreeBSD support (attachment inbox unread) + 2009-11-17 [1/1] Mikhail Gusarov [notmuch] [PATCH] Handle rename = of message file (inbox unread) + 2009-11-17 [2/2] Keith Packard, Carl Worth [notmuch] [PATCH] Make n= otmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox un= read) + 2009-11-17 [2/2] Jan Janak, Carl Worth [notmuch] [PATCH] Older = versions of install do not support -C. (inbox unread) + 2009-11-17 [3/3] Jan Janak, Carl Worth [notmuch] What a great i= dea! (inbox unread) + 2009-11-17 [3/3] Israel Herraiz, Keith Packard, Carl Worth [notmuch]= New to the list (inbox unread) + 2009-11-17 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth [n= otmuch] Introducing myself (inbox signed unread) + 2009-11-17 [3/3] Aron Griffis, Keith Packard, Carl Worth [notmuch]= archive (inbox unread) + 2009-11-17 [2/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typso= s (inbox unread) + 2009-11-18 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] [PATCH] Erro= r out if no query is supplied to search instead of going into an infinite l= oop (attachment inbox unread) + 2009-11-18 [2/2] Lars Kellogg-Stedman [notmuch] "notmuch help" outputs= to stderr? (attachment inbox signed unread) + 2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] Fix linking wi= th gcc to use g++ to link in C++ libs. (deleted inbox unread) + 2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH 2/2] Read mail = directory in inode number order (deleted inbox unread) + 2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] count_files: s= ort directory in inode order before statting (deleted inbox unread) + 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry [notmuch] Ma= c OS X/Darwin compatibility issues (inbox unread) + 2009-11-18 [1/1] Jan Janak [notmuch] [PATCH] notmuch new: S= upport for conversion of spool subdirectories into tags (inbox unread) + 2009-11-18 [1/1] Rolland Santimano [notmuch] Link to mailing list a= rchives ? (inbox unread) + 2009-11-18 [1/1] Alexander Botero-Lowry [notmuch] request for pull (i= nbox unread) + 2009-11-18 [2/2] Keith Packard, Alexander Botero-Lowry [notmuch] [P= ATCH] Create a default notmuch-show-hook that highlights URLs and uses word= -wrap (inbox unread) + 2009-11-18 [1/1] Chris Wilson [notmuch] [PATCH 1/2] Makefile: = evaluate pkg-config once (deleted inbox unread) + 2010-12-16 [1/1] Olivier Berger Essai accentu=C3=A9 (inbox unrea= d) + 2010-12-29 [1/1] Fran=C3=A7ois Boulogne [aur-general] Guidelines: c= p, mkdir vs install (inbox unread) +End of search results. diff --git a/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-wi= thout-excluded b/test/emacs-exclude.expected-output/notmuch-search-tag-inbo= x-without-excluded new file mode 100644 index 00000000..8a874320 --- /dev/null +++ b/test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-e= xcluded @@ -0,0 +1,21 @@ + 2009-11-17 [5/5] Mikhail Gusarov, Carl Worth, Keith Packard [notmuch]= [PATCH 1/2] Close message file after parsing message headers (inbox unread) + 2009-11-17 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard,= Carl Worth [notmuch] Working with Maildir storage? (inbox signed unread) + 2009-11-17 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] preliminary = FreeBSD support (attachment inbox unread) + 2009-11-17 [1/1] Mikhail Gusarov [notmuch] [PATCH] Handle rename = of message file (inbox unread) + 2009-11-17 [2/2] Keith Packard, Carl Worth [notmuch] [PATCH] Make n= otmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox un= read) + 2009-11-17 [2/2] Jan Janak, Carl Worth [notmuch] [PATCH] Older = versions of install do not support -C. (inbox unread) + 2009-11-17 [3/3] Jan Janak, Carl Worth [notmuch] What a great i= dea! (inbox unread) + 2009-11-17 [3/3] Israel Herraiz, Keith Packard, Carl Worth [notmuch]= New to the list (inbox unread) + 2009-11-17 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth [n= otmuch] Introducing myself (inbox signed unread) + 2009-11-17 [3/3] Aron Griffis, Keith Packard, Carl Worth [notmuch]= archive (inbox unread) + 2009-11-17 [2/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typso= s (inbox unread) + 2009-11-18 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] [PATCH] Erro= r out if no query is supplied to search instead of going into an infinite l= oop (attachment inbox unread) + 2009-11-18 [2/2] Lars Kellogg-Stedman [notmuch] "notmuch help" outputs= to stderr? (attachment inbox signed unread) + 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry [notmuch] Ma= c OS X/Darwin compatibility issues (inbox unread) + 2009-11-18 [1/1] Jan Janak [notmuch] [PATCH] notmuch new: S= upport for conversion of spool subdirectories into tags (inbox unread) + 2009-11-18 [1/1] Rolland Santimano [notmuch] Link to mailing list a= rchives ? (inbox unread) + 2009-11-18 [1/1] Alexander Botero-Lowry [notmuch] request for pull (i= nbox unread) + 2009-11-18 [2/2] Keith Packard, Alexander Botero-Lowry [notmuch] [P= ATCH] Create a default notmuch-show-hook that highlights URLs and uses word= -wrap (inbox unread) + 2010-12-16 [1/1] Olivier Berger Essai accentu=C3=A9 (inbox unrea= d) + 2010-12-29 [1/1] Fran=C3=A7ois Boulogne [aur-general] Guidelines: c= p, mkdir vs install (inbox unread) +End of search results. diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with= -excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-= excluded new file mode 100644 index 00000000..5c6b2d7a --- /dev/null +++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-exclud= ed @@ -0,0 +1,53 @@ + 2009-11-17 Mikhail Gusarov =E2=94=AC=E2=96=BA[notmuch] [PATCH 1/2= ] Close message file after parsing message headers (inbox unread) + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=80=E2=96=BA[notmuch] [= PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (inb= ox unread) + 2009-11-17 Carl Worth =E2=95=B0=E2=94=AC=E2=96=BA[notmuch] [= PATCH 1/2] Close message file after parsing message headers (inbox unread) + 2009-11-17 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] Working wi= th Maildir storage? (inbox signed unread) + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=AC=E2=96=BA ... = (inbox signed unread) + 2009-11-17 Lars Kellogg-Stedman =E2=94=82=E2=95=B0=E2=94=AC=E2=96=BA .= .. (inbox signed unread) + 2009-11-17 Mikhail Gusarov =E2=94=82 =E2=94=9C=E2=94=80=E2=96=BA = ... (inbox unread) + 2009-11-17 Keith Packard =E2=94=82 =E2=95=B0=E2=94=AC=E2=96=BA = ... (inbox unread) + 2009-11-18 Lars Kellogg-Stedman =E2=94=82 =E2=95=B0=E2=94=80=E2=96=BA= ... (inbox signed unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] preliminar= y FreeBSD support (attachment inbox unread) + 2009-11-17 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Mikhail Gusarov =E2=94=80=E2=96=BA[notmuch] [PATCH] Ha= ndle rename of message file (inbox unread) + 2009-11-17 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ma= ke notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbo= x unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) t= ags (inbox unread) + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ol= der versions of install do not support -C. (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] What a gre= at idea! (inbox unread) + 2009-11-17 Jan Janak =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Israel Herraiz =E2=94=AC=E2=96=BA[notmuch] New to the= list (inbox unread) + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Adrian Perez de Cast =E2=94=AC=E2=96=BA[notmuch] Introducin= g myself (inbox signed unread) + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Aron Griffis =E2=94=AC=E2=96=BA[notmuch] archive = (inbox unread) + 2009-11-18 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Ingmar Vanhassel =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ty= psos (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] [PATCH] Er= ror out if no query is supplied to search instead of going into an infinite= loop (attachment inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Error out if no query is supplied to search instead of going into an= infinite loop (inbox unread) + 2009-11-18 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] "notmuch h= elp" outputs to stderr? (attachment inbox signed unread) + 2009-11-18 Lars Kellogg-Stedman =E2=95=B0=E2=94=80=E2=96=BA ... = (attachment inbox signed unread) + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH] Fi= x linking with gcc to use g++ to link in C++ libs. (deleted inbox unread) + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH 2/2= ] Read mail directory in inode number order (deleted inbox unread) + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH] co= unt_files: sort directory in inode order before statting (deleted inbox unr= ead) + 2009-11-18 Jjgod Jiang =E2=94=AC=E2=96=BA[notmuch] Mac OS X/D= arwin compatibility issues (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Jjgod Jiang =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Jan Janak =E2=94=80=E2=96=BA[notmuch] [PATCH] no= tmuch new: Support for conversion of spool subdirectories into tags (inbox = unread) + 2009-11-18 Rolland Santimano =E2=94=80=E2=96=BA[notmuch] Link to ma= iling list archives ? (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=94=80=E2=96=BA[notmuch] request fo= r pull (inbox unread) + 2009-11-18 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] Cr= eate a default notmuch-show-hook that highlights URLs and uses word-wrap (i= nbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Create a default notmuch-show-hook that highlights URLs and uses wor= d-wrap (inbox unread) + 2009-11-18 Chris Wilson =E2=94=80=E2=96=BA[notmuch] [PATCH 1/2= ] Makefile: evaluate pkg-config once (deleted inbox unread) + 2010-12-16 Olivier Berger =E2=94=80=E2=96=BAEssai accentu=C3=A9 = (inbox unread) + 2010-12-29 Fran=C3=A7ois Boulogne =E2=94=80=E2=96=BA[aur-general] G= uidelines: cp, mkdir vs install (inbox unread) +End of search results. diff --git a/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with= out-excluded b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-wi= thout-excluded new file mode 100644 index 00000000..55806d18 --- /dev/null +++ b/test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-exc= luded @@ -0,0 +1,49 @@ + 2009-11-17 Mikhail Gusarov =E2=94=AC=E2=96=BA[notmuch] [PATCH 1/2= ] Close message file after parsing message headers (inbox unread) + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=80=E2=96=BA[notmuch] [= PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (inb= ox unread) + 2009-11-17 Carl Worth =E2=95=B0=E2=94=AC=E2=96=BA[notmuch] [= PATCH 1/2] Close message file after parsing message headers (inbox unread) + 2009-11-17 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] Working wi= th Maildir storage? (inbox signed unread) + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=AC=E2=96=BA ... = (inbox signed unread) + 2009-11-17 Lars Kellogg-Stedman =E2=94=82=E2=95=B0=E2=94=AC=E2=96=BA .= .. (inbox signed unread) + 2009-11-17 Mikhail Gusarov =E2=94=82 =E2=94=9C=E2=94=80=E2=96=BA = ... (inbox unread) + 2009-11-17 Keith Packard =E2=94=82 =E2=95=B0=E2=94=AC=E2=96=BA = ... (inbox unread) + 2009-11-18 Lars Kellogg-Stedman =E2=94=82 =E2=95=B0=E2=94=80=E2=96=BA= ... (inbox signed unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] preliminar= y FreeBSD support (attachment inbox unread) + 2009-11-17 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Mikhail Gusarov =E2=94=80=E2=96=BA[notmuch] [PATCH] Ha= ndle rename of message file (inbox unread) + 2009-11-17 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ma= ke notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbo= x unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) t= ags (inbox unread) + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ol= der versions of install do not support -C. (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] What a gre= at idea! (inbox unread) + 2009-11-17 Jan Janak =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Israel Herraiz =E2=94=AC=E2=96=BA[notmuch] New to the= list (inbox unread) + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Adrian Perez de Cast =E2=94=AC=E2=96=BA[notmuch] Introducin= g myself (inbox signed unread) + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Aron Griffis =E2=94=AC=E2=96=BA[notmuch] archive = (inbox unread) + 2009-11-18 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Ingmar Vanhassel =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ty= psos (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] [PATCH] Er= ror out if no query is supplied to search instead of going into an infinite= loop (attachment inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Error out if no query is supplied to search instead of going into an= infinite loop (inbox unread) + 2009-11-18 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] "notmuch h= elp" outputs to stderr? (attachment inbox signed unread) + 2009-11-18 Lars Kellogg-Stedman =E2=95=B0=E2=94=80=E2=96=BA ... = (attachment inbox signed unread) + 2009-11-18 Jjgod Jiang =E2=94=AC=E2=96=BA[notmuch] Mac OS X/D= arwin compatibility issues (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Jjgod Jiang =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Jan Janak =E2=94=80=E2=96=BA[notmuch] [PATCH] no= tmuch new: Support for conversion of spool subdirectories into tags (inbox = unread) + 2009-11-18 Rolland Santimano =E2=94=80=E2=96=BA[notmuch] Link to ma= iling list archives ? (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=94=80=E2=96=BA[notmuch] request fo= r pull (inbox unread) + 2009-11-18 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] Cr= eate a default notmuch-show-hook that highlights URLs and uses word-wrap (i= nbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Create a default notmuch-show-hook that highlights URLs and uses wor= d-wrap (inbox unread) + 2010-12-16 Olivier Berger =E2=94=80=E2=96=BAEssai accentu=C3=A9 = (inbox unread) + 2010-12-29 Fran=C3=A7ois Boulogne =E2=94=80=E2=96=BA[aur-general] G= uidelines: cp, mkdir vs install (inbox unread) +End of search results. --=20 2.37.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0011-test-Fix-Navigation-of-notmuch-hello-to-search-resul.patch Content-Transfer-Encoding: quoted-printable >From 62da435dd021f74c2f7e5b87239c8bb8e8f92feb Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sun, 24 Jul 2022 20:41:06 +0100 Subject: [PATCH 11/11] test: Fix Navigation of notmuch-hello to search resu= lts The default value of oldest-first is true so the oldest mail is shown first by default. This test case used the tree-from-search function which now persists this value of true (previously always defaulting to nil in its place) which produced a different tree output where the oldest-mail is sorted first despite previously being sorted last. Fixed by adding in this output as a separate file and comparing against it instead. --- test/T460-emacs-tree.sh | 2 +- .../notmuch-tree-tag-inbox-oldest-first | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 test/emacs-tree.expected-output/notmuch-tree-tag-inbox-= oldest-first diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh index 0f23b418..00812407 100755 --- a/test/T460-emacs-tree.sh +++ b/test/T460-emacs-tree.sh @@ -100,7 +100,7 @@ test_emacs '(notmuch-hello) (notmuch-test-wait) (test-output) (delete-other-windows)' -test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox OUTPUT +test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-oldest-first OUTPUT =20 test_begin_subtest "Tree view of a single thread (from search)" test_emacs '(notmuch-hello) diff --git a/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-= first b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first new file mode 100644 index 00000000..588fc583 --- /dev/null +++ b/test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first @@ -0,0 +1,53 @@ + 2009-11-17 Mikhail Gusarov =E2=94=AC=E2=96=BA[notmuch] [PATCH 1/2= ] Close message file after parsing message headers (inbox unread) + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=80=E2=96=BA[notmuch] [= PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (inb= ox unread) + 2009-11-17 Carl Worth =E2=95=B0=E2=94=AC=E2=96=BA[notmuch] [= PATCH 1/2] Close message file after parsing message headers (inbox unread) + 2009-11-17 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] Working wi= th Maildir storage? (inbox signed unread) + 2009-11-17 Mikhail Gusarov =E2=94=9C=E2=94=AC=E2=96=BA ... = (inbox signed unread) + 2009-11-17 Lars Kellogg-Stedman =E2=94=82=E2=95=B0=E2=94=AC=E2=96=BA .= .. (inbox signed unread) + 2009-11-17 Mikhail Gusarov =E2=94=82 =E2=94=9C=E2=94=80=E2=96=BA = ... (inbox unread) + 2009-11-17 Keith Packard =E2=94=82 =E2=95=B0=E2=94=AC=E2=96=BA = ... (inbox unread) + 2009-11-18 Lars Kellogg-Stedman =E2=94=82 =E2=95=B0=E2=94=80=E2=96=BA= ... (inbox signed unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] preliminar= y FreeBSD support (attachment inbox unread) + 2009-11-17 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Mikhail Gusarov =E2=94=80=E2=96=BA[notmuch] [PATCH] Ha= ndle rename of message file (inbox unread) + 2009-11-17 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ma= ke notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbo= x unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) t= ags (inbox unread) + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ol= der versions of install do not support -C. (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Jan Janak =E2=94=AC=E2=96=BA[notmuch] What a gre= at idea! (inbox unread) + 2009-11-17 Jan Janak =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Israel Herraiz =E2=94=AC=E2=96=BA[notmuch] New to the= list (inbox unread) + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Adrian Perez de Cast =E2=94=AC=E2=96=BA[notmuch] Introducin= g myself (inbox signed unread) + 2009-11-18 Keith Packard =E2=94=9C=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Aron Griffis =E2=94=AC=E2=96=BA[notmuch] archive = (inbox unread) + 2009-11-18 Keith Packard =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-17 Ingmar Vanhassel =E2=94=AC=E2=96=BA[notmuch] [PATCH] Ty= psos (inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Alex Botero-Lowry =E2=94=AC=E2=96=BA[notmuch] [PATCH] Er= ror out if no query is supplied to search instead of going into an infinite= loop (attachment inbox unread) + 2009-11-18 Carl Worth =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Error out if no query is supplied to search instead of going into an= infinite loop (inbox unread) + 2009-11-18 Lars Kellogg-Stedman =E2=94=AC=E2=96=BA[notmuch] "notmuch h= elp" outputs to stderr? (attachment inbox signed unread) + 2009-11-18 Lars Kellogg-Stedman =E2=95=B0=E2=94=80=E2=96=BA ... = (attachment inbox signed unread) + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH] Fi= x linking with gcc to use g++ to link in C++ libs. (inbox unread) + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH 2/2= ] Read mail directory in inode number order (inbox unread) + 2009-11-18 Stewart Smith =E2=94=80=E2=96=BA[notmuch] [PATCH] co= unt_files: sort directory in inode order before statting (inbox unread) + 2009-11-18 Jjgod Jiang =E2=94=AC=E2=96=BA[notmuch] Mac OS X/D= arwin compatibility issues (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Jjgod Jiang =E2=95=B0=E2=94=AC=E2=96=BA ... = (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA ... = (inbox unread) + 2009-11-18 Jan Janak =E2=94=80=E2=96=BA[notmuch] [PATCH] no= tmuch new: Support for conversion of spool subdirectories into tags (inbox = unread) + 2009-11-18 Rolland Santimano =E2=94=80=E2=96=BA[notmuch] Link to ma= iling list archives ? (inbox unread) + 2009-11-18 Alexander Botero-Low =E2=94=80=E2=96=BA[notmuch] request fo= r pull (inbox unread) + 2009-11-18 Keith Packard =E2=94=AC=E2=96=BA[notmuch] [PATCH] Cr= eate a default notmuch-show-hook that highlights URLs and uses word-wrap (i= nbox unread) + 2009-11-18 Alexander Botero-Low =E2=95=B0=E2=94=80=E2=96=BA[notmuch] [= PATCH] Create a default notmuch-show-hook that highlights URLs and uses wor= d-wrap (inbox unread) + 2009-11-18 Chris Wilson =E2=94=80=E2=96=BA[notmuch] [PATCH 1/2= ] Makefile: evaluate pkg-config once (inbox unread) + 2010-12-16 Olivier Berger =E2=94=80=E2=96=BAEssai accentu=C3=A9 = (inbox unread) + 2010-12-29 Fran=C3=A7ois Boulogne =E2=94=80=E2=96=BA[aur-general] G= uidelines: cp, mkdir vs install (inbox unread) +End of search results. --=20 2.37.1 --=-=-= Content-Type: text/plain -- Mohsin Kaleem --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --=-=-=--