Re: [PATCH] emacs: add new option notmuch-search-exclude
David Bremner writes: > To apply patch series, you may want to try mailscripts [1]. The > description makes it sound debian-centric, but I guess the elisp > functions like notmuch-extract-thread-patches are portable. That function is one reason why it's nice to start a new thread with each version of a patch series. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
Mohsin Kaleem writes: > > I'm not sure what you mean by the first two patches occur twice, could > you clarify so I can fix the issue? I've dropped the reverted patch and > rebased on top of master so you shouldn't have any issues applying the > patch series now. > For reference, just look at the first and third attachements to your message. These (somehow) describe the same commit / patch. In any case it is fixed in the next iteration using git send-email. >> If possible, please use git send-email to send one-patch-per-message, it >> makes reviewing in notmuch-emacs much easier for me. > > I just used git send-email to send the patch series (I assume it'll be > sent separately). I'd like to ask: > + How do you manage git and email workflows like this for reference? > I haven't found any documentation about it when searching. Some general advice is at https://git-send-email.io/ > + Is there a way to do this with notmuch involved (ideally through emacs > and Magit)? I use git send-email from the command line to send patch series. To review them, I read the resulting threads and reply to individual patches / commits / messages. To apply patch series, you may want to try mailscripts [1]. The description makes it sound debian-centric, but I guess the elisp functions like notmuch-extract-thread-patches are portable. Finally I have some git aliases to apply individual patches: [alias] nmam = "!f() { notmuch extract-patch $1 | git am -; }; f" [alias] nmam8 = "!f() { notmuch extract-patch $1 | email-to-8bit | git am -; }; f" [alias] nmam3 = "!f() { notmuch extract-patch $1 | git am -3 -; }; f" These versions rely on notmuch-extract-patch, from mailscripts [1], but if you don't have that "notmuch show --format=raw" works almost as well. [1]: https://github.com/spwhitton/mailscripts ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
David Bremner writes: Hi, thanks for all the advice :-). I'm still quite unfamiliar with mailing-list based workflows so I keep developing like I'm on GitHub. > I think the patch series needs a bit of cleanup still. The first two > patches occur twice and then a later patch is reverted (so presumably > those two can be dropped as well). > > You may also want to rebase against master before resending, since I > have just a applied some changes to the emacs UI code that might collide > with yours. I'm not sure what you mean by the first two patches occur twice, could you clarify so I can fix the issue? I've dropped the reverted patch and rebased on top of master so you shouldn't have any issues applying the patch series now. > If possible, please use git send-email to send one-patch-per-message, it > makes reviewing in notmuch-emacs much easier for me. I just used git send-email to send the patch series (I assume it'll be sent separately). I'd like to ask: + How do you manage git and email workflows like this for reference? I haven't found any documentation about it when searching. + Is there a way to do this with notmuch involved (ideally through emacs and Magit)? -- Mohsin Kaleem ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
Mohsin Kaleem writes: > 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. > I think the patch series needs a bit of cleanup still. The first two patches occur twice and then a later patch is reverted (so presumably those two can be dropped as well). If possible, please use git send-email to send one-patch-per-message, it makes reviewing in notmuch-emacs much easier for me. You may also want to rebase against master before resending, since I have just a applied some changes to the emacs UI code that might collide with yours. d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
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. >From 1872120821ccad5d23ab48d128d8d77efd85055d Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sat, 27 Nov 2021 18:58:43 + 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@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
Re: [PATCH] emacs: add new option notmuch-search-exclude
Mohsin Kaleem writes: > David Bremner writes: > >> Try adding a line >> "unset XDG_DATA_HOME" >> >> after >> >> unset XDG_CONFIG_HOME >> >> on line 108 of test/test-lib.sh > > Doesn't seem to be such a line in test/test-lib.sh, but I added it to > test/test-vars.sh and we're down from 42 failing tests to 4 :-). Ah right, I was looking at an old version. > > T391-python-cffi: Testing python bindings (pytest) > FAIL python cffi tests (NOTMUCH_CONFIG set) > (cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage > && python3 -m pytest --verbose > --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output) > /usr/bin/python3: No module named pytest > FAIL python cffi tests (NOTMUCH_CONFIG unset) > (cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage > && python3 -m pytest --verbose > --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output) 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__)'" > T560-lib-error: Testing error reporting for library > FAIL Open null pointer > --- T560-lib-error.2.EXPECTED 2022-03-22 20:25:30.496475869 + > +++ T560-lib-error.2.OUTPUT 2022-03-22 20:25:30.496475869 + > @@ -1,3 +1,2 @@ >== stdout == >== stderr == > -Error: could not locate database. > test1.c: In function 'main': > test1.c:7:5: warning: 'notmuch_database_open' is deprecated: function > deprecated as of libnotmuch 5.4 [-Wdeprecated-declarations] > 7 | stat = notmuch_database_open (NULL, 0, 0); > | ^~~~ > In file included from test1.c:2: > /home/mohkale/prog/repos/notmuch/lib/notmuch.h:332:1: note: declared here > 332 | notmuch_database_open (const char *path, > | ^ > FAIL create NULL path > --- T560-lib-error.6.EXPECTED 2022-03-22 20:25:31.093160154 + > +++ T560-lib-error.6.OUTPUT 2022-03-22 20:25:31.093160154 + > @@ -1,3 +1,3 @@ >== stdout == >== stderr == > -Error: could not locate database. > +Error: Cannot open database at CWD/home/.local/share/notmuch/default: > No such file or directory. I can duplicate this if I have a setting for MAILDIR in the environment. I will send a patch clearing XDG_DATA_HOME and MAILDIR, but for now you could add "unset MAILDIR" to test/test-vars.sh ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
David Bremner writes: > Try adding a line > "unset XDG_DATA_HOME" > > after > > unset XDG_CONFIG_HOME > > on line 108 of test/test-lib.sh Doesn't seem to be such a line in test/test-lib.sh, but I added it to test/test-vars.sh and we're down from 42 failing tests to 4 :-). Missing sphinx or makeinfo, not building info pages Use "make V=1" to see the details for passing and known broken tests. INFO: using 2m timeout for tests INFO: running tests with GNU parallel T030-config: Testing "notmuch config" BROKEN Round trip config item with leading spaces BROKEN Round trip config item with leading tab T050-new: Testing "notmuch new" in several variations BROKEN RFC822 group names are indexed BROKEN Long directory names don't cause rescan add_file: A Xapian exception occurred A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zz. Note: A fatal error was encountered: A Xapian exception occurred add_file: A Xapian exception occurred A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zz. Note: A fatal error was encountered: A Xapian exception occurred Skipping due to missing sfsexp library missing prerequisites: dtach(1) SKIP Show message: json, inline attachment filename missing prerequisites: dtach(1) SKIP Show message: sexp, inline attachment filename missing prerequisites: dtach(1) SKIP all tests in T310-emacs missing prerequisites: dtach(1) SKIP all tests in T315-emacs-tagging missing prerequisites: dtach(1) SKIP all tests in T330-emacs-subject-to-filename missing prerequisites: dtach(1) SKIP all tests in T320-emacs-large-search-buffer missing prerequisites: dtach(1) SKIP all tests in T350-crypto missing prerequisites: dtach(1) SKIP all tests in T355-smime missing prerequisites: dtach(1) SKIP all tests in T357-index-decryption missing prerequisites: dtach(1) SKIP all tests in T358-emacs-protected-headers T391-python-cffi: Testing python bindings (pytest) FAIL python cffi tests (NOTMUCH_CONFIG set) (cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output) /usr/bin/python3: No module named pytest FAIL python cffi tests (NOTMUCH_CONFIG unset) (cd /home/mohkale/prog/repos/notmuch/bindings/python-cffi/build/stage && python3 -m pytest --verbose --log-file=/home/mohkale/prog/repos/notmuch/test/tmp.T391-python-cffi/test.output) /usr/bin/python3: No module named pytest missing prerequisites: dtach(1) SKIP emacs test function sanity missing prerequisites: dtach(1) SKIP all tests in T430-emacs-address-cleaning missing prerequisites: dtach(1) SKIP all tests in T440-emacs-hello missing prerequisites: dtach(1) SKIP all tests in T450-emacs-show missing prerequisites: dtach(1) SKIP all tests in T455-emacs-charsets missing prerequisites: dtach(1) SKIP all tests in T460-emacs-tree missing prerequisites: dtach(1) SKIP all tests in T465-emacs-unthreaded missing prerequisites: dtach(1) SKIP reply to ghost (tree view) missing prerequisites: dtach(1) SKIP reply to ghost (RT/tree view) missing prerequisites: dtach(1) SKIP trusting reply-to (tree view) T560-lib-error: Testing error reporting for library FAIL Open null pointer --- T560-lib-error.2.EXPECTED 2022-03-22 20:25:30.496475869 + +++ T560-lib-error.2.OUTPUT 2022-03-22 20:25:30.496475869 + @@ -1,3 +1,2 @@ == stdout == == stderr == -Error: could not locate database. test1.c: In function 'main': test1.c:7:5: warning: 'notmuch_database_open' is deprecated: function deprecated as of libnotmuch 5.4 [-Wdeprecated-declarations] 7 | stat = notmuch_database_open (NULL, 0, 0); | ^~~~ In file included from test1.c:2: /home/mohkale/prog/repos/notmuch/lib/notmuch.h:332:1: note: declared here 332 | notmuch_database_open (const char *path, | ^ FAIL create NULL path --- T560-lib-error.6.EXPECTED 2022-03-22 20:25:31.093160154 + +++ T560-lib-error.6.OUTPUT 2022-03-22 20:25:31.093160154 + @@ -1,3 +1,3 @@ == stdout == == stderr == -Error: could not locate database. +Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such file or directory. T592-thread-breakage: Testing thread breakage during reindexing BROKEN
Re: [PATCH] emacs: add new option notmuch-search-exclude
Mohsin Kaleem writes: > David Bremner writes: > >> It's just a guess, but do you by chance override XDG_DATA_HOME? I can >> imagine that causing problems for the test suite. > > I do export an environment variable $XDG_DATA_HOME, but it points to the > default location "/home/mohkale/.local/share" so I'm not sure why that > would be causing this to fail. > > I tried running `XDG_DATA_HOME= make test` and it's still failing. I > also tried moving my notmuch repository copy outside of any XDG* > directories but the tests are still failing :-(. > > -- > Mohsin Kaleem Try adding a line "unset XDG_DATA_HOME" after unset XDG_CONFIG_HOME on line 108 of test/test-lib.sh ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
David Bremner writes: > It's just a guess, but do you by chance override XDG_DATA_HOME? I can > imagine that causing problems for the test suite. I do export an environment variable $XDG_DATA_HOME, but it points to the default location "/home/mohkale/.local/share" so I'm not sure why that would be causing this to fail. I tried running `XDG_DATA_HOME= make test` and it's still failing. I also tried moving my notmuch repository copy outside of any XDG* directories but the tests are still failing :-(. -- Mohsin Kaleem ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
Mohsin Kaleem writes: > David Bremner writes: > >> Can you be more specific about what tests are failing? > > Pretty much all of them, although I'm beginning to suspect it may be an > environment issue on my part. > > I've attached the output of running `make test` in the root of the > project from master, do you have any idea why so much seems to be > failing. Some python tests fail with no module named pytest but I do > have it installed, others seem to be failing because they cannot find > (or maybe create) a database file. I thought it might be because the > directory for the database doesn't exist so I made it manually yet the > tests are still failing :/. The test suite creates many databases, so manual creation should not be needed.q Running the tests under .cache is a bit unusual, but it seems to work ok for me. This makes me think the problem is some environment variable. It's just a guess, but do you by chance override XDG_DATA_HOME? I can imagine that causing problems for the test suite. d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
David Bremner writes: > Can you be more specific about what tests are failing? Pretty much all of them, although I'm beginning to suspect it may be an environment issue on my part. I've attached the output of running `make test` in the root of the project from master, do you have any idea why so much seems to be failing. Some python tests fail with no module named pytest but I do have it installed, others seem to be failing because they cannot find (or maybe create) a database file. I thought it might be because the directory for the database doesn't exist so I made it manually yet the tests are still failing :/. Missing sphinx or makeinfo, not building info pages Use "make V=1" to see the details for passing and known broken tests. INFO: using 2m timeout for tests INFO: running tests with GNU parallel T030-config: Testing "notmuch config" BROKEN Round trip config item with leading spaces BROKEN Round trip config item with leading tab T050-new: Testing "notmuch new" in several variations BROKEN RFC822 group names are indexed BROKEN Long directory names don't cause rescan add_file: A Xapian exception occurred A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zz. Note: A fatal error was encountered: A Xapian exception occurred add_file: A Xapian exception occurred A Xapian exception occurred finding/creating a directory: Term too long (> 245): XDDIRENTRY2:zz. Note: A fatal error was encountered: A Xapian exception occurred Skipping due to missing sfsexp library missing prerequisites: dtach(1) SKIP Show message: json, inline attachment filename missing prerequisites: dtach(1) SKIP Show message: sexp, inline attachment filename missing prerequisites: dtach(1) SKIP all tests in T310-emacs missing prerequisites: dtach(1) SKIP all tests in T315-emacs-tagging missing prerequisites: dtach(1) SKIP all tests in T330-emacs-subject-to-filename T055-path-config: Testing Configuration of mail-root and database path FAIL count (XDG) --- T055-path-config.41.expected2022-03-22 19:30:33.438149848 + +++ T055-path-config.41.output 2022-03-22 19:30:33.438149848 + @@ -1 +1 @@ -52 + Error: could not locate database. FAIL count+tag (XDG) --- T055-path-config.42.expected2022-03-22 19:30:33.458150410 + +++ T055-path-config.42.output 2022-03-22 19:30:33.458150410 + @@ -1 +1 @@ -52 + Error: could not locate database. Error: could not locate database. Error: could not locate database. FAIL address (XDG) --- T055-path-config.43.EXPECTED2022-03-22 19:30:33.471484118 + +++ T055-path-config.43.OUTPUT 2022-03-22 19:30:33.474817545 + @@ -1,2 +0,0 @@ -Carl Worth -notmuch@notmuchmail.org Error: could not locate database. FAIL dump (XDG) --- T055-path-config.44.EXPECTED2022-03-22 19:30:33.488151254 + +++ T055-path-config.44.OUTPUT 2022-03-22 19:30:33.491484680 + @@ -1,3 +0,0 @@ -#notmuch-dump batch-tag:3 config,properties,tags -+attachment +inbox +signed +unread -- id:20091118005829.gb25...@dottiness.seas.harvard.edu -+attachment +inbox +signed +unread -- id:20091118010116.gc25...@dottiness.seas.harvard.edu Error: could not locate database. FAIL dump + tag + restore (XDG) Missing or zero length file: EXPECTED Error: could not locate database. Error: could not locate database. Error: could not locate database. Error: could not locate database. FAIL reindex (XDG) Missing or zero length file: EXPECTED Error: could not locate database. Error: could not locate database. Error: could not locate database. FAIL use existing database (XDG) --- T055-path-config.45.expected2022-03-22 19:30:33.544819514 + +++ T055-path-config.45.output 2022-03-22 19:30:33.544819514 + @@ -1 +1 @@ -No new mail. + Error: could not locate database. FAIL create database (XDG) --- T055-path-config.46.expected2022-03-22 19:30:33.561486649 + +++ T055-path-config.46.output 2022-03-22 19:30:33.561486649 + @@ -1 +1 @@ -52 + Error: could not locate database. Error: could not locate database. FAIL detect new files (XDG) --- T055-path-config.47.expected2022-03-22 19:30:33.581487212 + +++ T055-path-config.47.output 2022-03-22
Re: [PATCH] emacs: add new option notmuch-search-exclude
Mohsin Kaleem writes: > > I'm more than happy to add some new tests but at least for me the test > suite appears to be failing on the master branch. I think it'd be easier > to wait until the existing tests are fixed before adding or changing new > ones. > Can you be more specific about what tests are failing? Currently I know that the latest gmime broke smime.4 For the moment, you can use the following to skip that test % make NOTMUCH_SKIP_TESTS=smime.4 test (in general a space separated list of tests to skip is supported; see test/README) ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add new option notmuch-search-exclude
David Bremner writes: > Can you update the file devel/emacs-keybindings.org so we don't lose > track of the bindings. Also, per the contributing guide [1], please > add some brief documentation to the emacs docs in > doc/notmuch-emacs.rst Done. > Also, we need at least one new test (ideally one per mode). There should > be some tests you can crib from in T310-emacs.sh and T450-emacs-show.sh. I'm more than happy to add some new tests but at least for me the test suite appears to be failing on the master branch. I think it'd be easier to wait until the existing tests are fixed before adding or changing new ones. >From 1872120821ccad5d23ab48d128d8d77efd85055d Mon Sep 17 00:00:00 2001 From: Mohsin Kaleem Date: Sat, 27 Nov 2021 18:58:43 + Subject: [PATCH 1/2] 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@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) +
Re: [PATCH] emacs: add new option notmuch-search-exclude
Mohsin Kaleem writes: > 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. Thanks, this seems like a nice feature. > > 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. Seems reasonable, since 'e' is already taken in tree mode. Can you update the file devel/emacs-keybindings.org so we don't lose track of the bindings. Also, per the contributing guide [1], please add some brief documentation to the emacs docs in doc/notmuch-emacs.rst > 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. Whether or not this is the right thing to do, something seems to have broken the test suite. Perhaps after you fix the test suite, the answer will be more clear? Or perhaps not, then we can revisit the question. Also, we need at least one new test (ideally one per mode). There should be some tests you can crib from in T310-emacs.sh and T450-emacs-show.sh. In particular it is perfectly acceptable to call the toggle function directly rather than trying to fake keystrokes. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org