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

2022-08-12 Thread David Bremner
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

2022-08-12 Thread David Bremner
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 7/9] test: Fix Navigation of notmuch-hello to search results

2022-08-12 Thread David Bremner
Mohsin Kaleem  writes:

> 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.

Please make sure the test suite passes after every commit. Probably that
means squashing this fix into the previous commit.

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


Re: [PATCH 6/9] test: Add test cases for new exclude option

2022-08-12 Thread David Bremner
Mohsin Kaleem  writes:

This should mention emacs in the commit message. test/emacs: is the
usual convention.

> ---
>  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-inbox-with-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
>
> diff --git a/test/T461-emacs-search-exclude.sh 
> b/test/T461-emacs-search-exclude.sh
> new file mode 100755
> index ..bf558847
> --- /dev/null
> +++ b/test/T461-emacs-search-exclude.sh
> @@ -0,0 +1,99 @@
> +#!/usr/bin/env bash
> +
> +test_description="exclude options persist between Emacs search and tree 
> modes"
> +. $(dirname "$0")/test-lib.sh || exit 1
> +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
> +
> +EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
> +
> +test_require_emacs
> +add_email_corpus
> +notmuch config set search.exclude_tags deleted
> +notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
> +
> +# Basic test cases just asserting exclude option is working and consistent.
> +
> +test_begin_subtest "Search doesn't contain excluded mail by default"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> + (test-output)
> + (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded 
> OUTPUT
> +
> +test_begin_subtest "Toggling exclude in search will show excluded mail"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> +  (notmuch-search-toggle-exclude)
> + (notmuch-test-wait)
> + (test-output)
> + (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded 
> OUTPUT
> +
> +test_begin_subtest "Tree search doesn't contain excluded mail by default"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> + (notmuch-tree-from-search-current-query)
> + (notmuch-test-wait)
> + (test-output)
> + (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded 
> OUTPUT
> +
> +test_begin_subtest "Toggling exclude in tree search will show excluded mail"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> + (notmuch-tree-from-search-current-query)
> + (notmuch-test-wait)
> +  (notmuch-tree-toggle-exclude)
> + (notmuch-test-wait)
> + (test-output)
> + (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
> +
> +# 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 OUTPUT
> +
> +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 
> OUTPUT
> +
> +# TODO: Add test 

Re: [PATCH 5/9] feat: Add more interactive specs

2022-08-12 Thread David Bremner


This needs a better commit message. Both the subject (what is actually
happening) and the body (more detail about what, and some explanation
about why).

I'd suggest sticking to emacs: as a tag for the subject, but this is
less important than the other two issues I mentioned.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 4/9] feat: Allow :exclude configuration in notmuch-hello

2022-08-12 Thread David Bremner
Mohsin Kaleem  writes:

> ---
>  emacs/notmuch-hello.el | 35 ++-
>  1 file changed, 22 insertions(+), 13 deletions(-)

I would suggest describing this change as a change to
notmuch-saved-searches; that variable is used other places in notmuch as
well (mainly notmuch-jump.el)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 2/9] docs: Update with notmuch-*-toggle-exclude

2022-08-12 Thread David Bremner
Mohsin Kaleem  writes:

> ---
>  devel/emacs-keybindings.org | 2 +-
>  doc/notmuch-emacs.rst   | 5 +
>  2 files changed, 6 insertions(+), 1 deletion(-)

apologies, but this patch will need to be rebased on top of master, as
I've just changed that section of the emacs manual. For now I'm just
skipping it.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [Emacs] Using notmuch-address with EUDC, and completion-at-point

2022-08-12 Thread David Bremner
Alexander Adolf  writes:

> Hello David,
>
> thanks for your comments and questions.
>
> David Bremner  writes:
>
>> Alexander Adolf  writes:
>>
>>> As I wanted email address completion via completion-at-point in
>>> message-mode too, I implemented a new EUDC function to go into
>>> completion-at-point-functions [3].
>>>
>>> [1] https://company-mode.github.io
>>> [2] https://github.com/minad/corfu
>>> [3] https://github.com/emacs-mirror/emacs/blob/master/lisp/net/eudc-capf.el
>>>
>>
>> I will have to leave to others to test this, since I'm personally still
>> running emacs 27 (and that is likely to continue for a while, at least
>> on some machines).
>
> You could do
>
>  (require 'eudcb-notmuch-address)
>  (eudc-notmuch-address-set-server "localhost")
>
> and bind the function eudc-expand-inline to a key chord of your choice
> in message-mode-map.
>
> Then you'd no longer have to tweak message-completion-alist.

I stopped my investigations at the point it looked like I needed to edit
notmuch-address.el. I guess another patch or two is needed to do notmuch
integration. And of course we would need tests (in the notmuch test
suite) and documentation before actually merging the functionality, but
those can probably wait until we have a clearer idea what benefits the
change would bring.

> This assumes that eudc-expand-inline is present in Emacs 27, of course,
> which I admittedly haven't checked.

The function exists here in Emacs 27.1.

> What you'd probably lose (or no longer need, whichever way you view it)
> is any company-mode integration.

Unless the UX is very close, some people will strongly prefer to stay
with the existing completion, so I guess we'd need to make it
opt-in. Unfortunately as Tomi already pointed out the configuration is
already a bit of a confusing mess.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org