Re: [PATCH] emacs: add new option notmuch-search-exclude

2022-03-22 Thread Mohsin Kaleem
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

2022-03-22 Thread David Bremner
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

2022-03-22 Thread Mohsin Kaleem
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

2022-03-22 Thread David Bremner
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: Forcing a sync of maildir flags?

2022-03-22 Thread Sean Whitton
Hello David,

On Thu 20 Feb 2020 at 08:22AM -04, David Bremner wrote:

> Sean Whitton  writes:
>
>> I have this in my post-new hook:
>>
>> notmuch tag -unread -- folder:sent
>>
>> The idea is that copies of my sent mail which get returned to me and
>> stored in my inbox, e.g. by mailing lists, would get maildir Seen tags
>> added to them.  But that does not happen.
>
> I guess this is most likely a bug. It would be nice to have a test in
> T340-maildir-sync.sh that duplicated it. I suspect the problem is
> related to messages in the new/ subdirectory. Some non-notmuch clients
> (prominently mutt) interpret being in new/ has having user-visible
> semantics, so notmuch tries not to move files out of there
> unnecessarily, On the other hand the maildir spec says that files in
> new/ cannot have flags, so they cannot have their unread tag removed
> without moving the file to cur/

I am seeing this bug, or a closely related one, a whole lot right now.
Messages are coming back as unread over and over again.  I recently made
some changes to my notmuch cronjobs, so that probably has something to
do with it, but I have no guesses as to what the problem is.

As a first thing to try, I am going to add something to my pre-new hook
to perform the new/ -> cur/ move as specified by maildir(5) on all my
synced maildirs, so that notmuch never sees messages in new/ except when
it writes new drafts and sent mail there (and they'll get moved on the
next sync).

I'll drop the 'notmuch tag -unread -- folder:sent' workaround at the
same time to see what happens.

-- 
Sean Whitton
___
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

2022-03-22 Thread Mohsin Kaleem
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

2022-03-22 Thread David Bremner
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: Failing notmuch/SMIME test

2022-03-22 Thread David Bremner
Daniel Kahn Gillmor  writes:

> I suppose the right way to fix this generically is a test which
> abstracts out whether gmime reports an angle-addr or a addr-spec for
> x.509 certs, and then adjust the tests to match.
>
> I can try to send a patch for this, but it'll take me a while to swap
> it all back in.
>
> If anyone wants to propose a patch in the meantime, i'd also be happy to
> review.
>
> The simplest thing in the short term is probably to switch the test to
> matching based on the bare e-mail address and assert a build-dep on
> gmime 3.2.8 (see attached), but that seems a little bit extreme, since
> gmime only released 3.2.9 recently (and 3.2.8 never made it out the door
> via any formal channels, if i understand the history correctly).

What do you think about accepting both with < > and without, via some
"sanitize" function? Or just marking the test broken for old gmime. I
think we do something like the latter in some places.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Thanks for notmuch-lore

2022-03-22 Thread Carl Worth
On Tue, Mar 22 2022, Kyle Meyer wrote:
> I may be missing something (I didn't know about notmuch-lore before
> seeing it mentioned here), but it looks like the initialization step of
> notmuch-lore's pre-new handles that already.  You just need to set
> `since` far enough back:

Hmm... I did see the "since" parameter and cranked it back.

It didn't seem to do what I wanted, but it's possible the bug is only
with multi-epoch archives, (I was trying to bring in LKML).

From poking at it, it looked like it did perform a "deepening" operation
using the "since" parameter after the initial clone, but then didn't use
anything older than the most-recent upstream commit for the range of
commits from which to get messages out.

But my examination of the code and behavior was very cursory, I admit.

> Also, just to list some other options in this space, l2md and impibe are
> mentioned at  as tools for
> converting public-inbox archives into maildir format.  (I haven't used
> either myself.)

Thanks! I clearly didn't look quite hard enough. I appreciate the
pointers.

-Carl


signature.asc
Description: PGP signature
___
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

2022-03-22 Thread Mohsin Kaleem
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)
+