Recommended method to pair Notmuch with Neovim?

2023-04-16 Thread Ralph Seichter
Based on the Notmuch documentation [1] and Internet search results,
Felipe Contreras' notmuch-vim plugin [2] used to be a popular method of
combining Notmuch with Vim (at least classic Vim). However, there have
not been any Git repository updates for this plugin for two years, while
Neovim development has been very active during that time. Also, this
particular plugin requires Ruby support in Vim, which I'd rather avoid,
if possible.

  [1] https://git.notmuchmail.org/git/notmuch/blob/HEAD:/vim/README
  [2] https://github.com/felipec/notmuch-vim

My questions are:

1. Do any of you fellow mailing list members use notmuch-vim with
   Neovim?

2. Can you recommend an alternative Notmuch/Neovim plugin?

I am currently using Notmuch with Emacs, but I'd like to find a way to
integrate Notmuch with Neovim instead.

Your feedback is appreciated.

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


inbox-update: new competition of notmuch-lore

2023-04-16 Thread Felipe Contreras
Hi,

I'm moving from mbsync to public-inbox and I find there aren't many tools to
make it work with notmuch.

I gave a try to notmuch-lore [1] but I found it too slow and had a couple of
issues.

So I wrote my own script to convert public-inbox mailing lists to Maildir
format: notmuch-tools/inbox-update [2].

It's much faster at the initial clone, it deals with deleted mails, and YAML is
a much better configuration format.

Also, you can configure which epochs you want to fetch (notmuch-lore fetches
all of them).

One thing it doesn't yet do is trim the repository once the mails have been
converted, but that's probably easy to add later on.

You can check the GitHub page for more information [2].

Cheers.

[1] https://github.com/wkz/notmuch-lore
[2] https://github.com/felipec/notmuch-tools

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


[PATCH v2 0/3] emacs: Add new option notmuch-search-hide-excluded

2023-04-16 Thread mohkale
From: Mohsin Kaleem 

Hi,

I've finally managed to come back to this patch series. Since last time
I've collapsed all the separate commits into 3 main ones. The first adds
the new option and then updates the commands and tests that should be
affected by it. The second allows you to configure message exclusion in
notmuch-saved-searches. The last adds several tests for the new
functionality.

Mohsin Kaleem (3):
  emacs: Add new option notmuch-search-hide-excluded
  emacs: Allow notmuch-saved-searches to hide excluded messages
  test/emacs: Add test cases for notmuch-search-hide-excluded

 devel/emacs-keybindings.org   |   2 +-
 doc/notmuch-emacs.rst |   7 +
 emacs/notmuch-hello.el|  40 ++--
 emacs/notmuch-jump.el |  11 +-
 emacs/notmuch-lib.el  |  10 +
 emacs/notmuch-tree.el |  60 --
 emacs/notmuch.el  |  52 +++--
 test/T310-emacs.sh|   2 +-
 test/T460-emacs-tree.sh   |   2 +-
 test/T461-emacs-search-exclude.sh | 185 ++
 .../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 +
 ...notmuch-unthreaded-tag-inbox-with-excluded |  53 +
 ...much-unthreaded-tag-inbox-without-excluded |  49 +
 .../notmuch-tree-tag-inbox-oldest-first   |  53 +
 17 files changed, 629 insertions(+), 45 deletions(-)
 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
 create mode 100644 
test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
 create mode 100644 
test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-without-excluded
 create mode 100644 
test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first

-- 
2.40.0

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


[PATCH v2 1/3] emacs: Add new option notmuch-search-hide-excluded

2023-04-16 Thread mohkale
From: Mohsin Kaleem 

The new notmuch-search-hide-excluded option allows users to configure whether
to show or hide excluded messages (as determined by search.exclude_tags
in the local notmuch config file). It defaults to true for now to maintain
backwards-compatibility with how notmuch-{search,tree} already worked.

New commands notmuch-search-toggle-hide-excluded and
notmuch-tree-toggle-exclude have also been added. They toggle the value
of notmuch-search-hide-excluded for the search in the current search or
tree buffer. It's bound to "i" in the respective keymaps for these
modes.

Lastly I've amended some calls to notmuch-tree and notmuch-unthreaded
which didn't pass through the buffer local value of
notmuch-search-oldest-first (and now notmuch-search-exclude).
Examples of where I've done this
  + include notmuch-jump-search
  + notmuch-tree-from-search-current-query
  + notmuch-unthreaded-from-search-current-query
  + notmuch-tree-from-search-thread

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
---
 devel/emacs-keybindings.org   |  2 +-
 doc/notmuch-emacs.rst |  7 +++
 emacs/notmuch-hello.el|  5 +-
 emacs/notmuch-jump.el | 11 ++--
 emacs/notmuch-lib.el  | 10 
 emacs/notmuch-tree.el | 60 +++
 emacs/notmuch.el  | 52 
 test/T310-emacs.sh|  2 +-
 test/T460-emacs-tree.sh   |  2 +-
 .../notmuch-tree-tag-inbox-oldest-first   | 53 
 10 files changed, 172 insertions(+), 32 deletions(-)
 create mode 100644 
test/emacs-tree.expected-output/notmuch-tree-tag-inbox-oldest-first

diff --git a/devel/emacs-keybindings.org b/devel/emacs-keybindings.org
index ad7f72ef..218677c2 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-hide-excluded|  
 | notmuch-tree-toggle-hide-excluded   |
 | 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 7dff7d64..91af6d14 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -232,6 +232,10 @@ menu of results that the user can explore further by 
pressing
 
 Refresh the buffer
 
+.. el:define-key:: i
+
+Toggle whether to show messages with excluded tags in search results.
+
 .. el:define-key:: ?
 
 Display full set of key bindings
@@ -559,6 +563,9 @@ tags.
 
Filter the current search results based on an additional tag
 
+.. el:define-key:: i
+
+Toggle whether to show messages with excluded tags in search results.
 
 .. el:define-key:: g
=
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 4662e704..6aef322a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -33,10 +33,11 @@
 (declare-function notmuch-poll "notmuch-lib" ())
 (declare-function notmuch-tree "notmuch-tree"
  (&optional query query-context target buffer-name
-open-target unthreaded parent-buffer oldest-first))
+open-target unthreaded parent-buffer
+oldest-first hide-excluded))
 (declare-function notmuch-unthreaded "notmuch-tree"
  (&optional query query-context target buffer-name
-open-target))
+open-target oldest-first hide-excluded))
 
 
 ;;; Options
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
index 6a276928..53496e5c 100644
--- a/emacs/notmuch-jump.el
+++ b/emacs/notmuch-jump.el
@@ -50,15 +50,18 @@ 

[PATCH v2 3/3] test/emacs: Add test cases for notmuch-search-hide-excluded

2023-04-16 Thread mohkale
From: Mohsin Kaleem 

---
 test/T461-emacs-search-exclude.sh | 185 ++
 .../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 +
 ...notmuch-unthreaded-tag-inbox-with-excluded |  53 +
 ...much-unthreaded-tag-inbox-without-excluded |  49 +
 7 files changed, 435 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
 create mode 100644 
test/emacs-exclude.expected-output/notmuch-unthreaded-tag-inbox-with-excluded
 create mode 100644 
test/emacs-exclude.expected-output/notmuch-unthreaded-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 ..70882a7b
--- /dev/null
+++ b/test/T461-emacs-search-exclude.sh
@@ -0,0 +1,185 @@
+#!/usr/bin/env bash
+
+test_description="exclude options persist between Emacs search and tree modes"
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
+
+EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
+
+test_require_emacs
+add_email_corpus
+notmuch config set search.exclude_tags deleted
+notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
+
+# Basic test cases just asserting exclude option is working and consistent.
+
+test_begin_subtest "Search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward "inbox")
+   (widget-button-press (1- (point)))
+   (notmuch-test-wait)
+   (test-output)
+   (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded 
OUTPUT
+
+test_begin_subtest "Toggling exclude in search will show excluded mail"
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward "inbox")
+   (widget-button-press (1- (point)))
+   (notmuch-test-wait)
+  (notmuch-search-toggle-hide-excluded)
+   (notmuch-test-wait)
+   (test-output)
+   (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Tree search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward "inbox")
+   (widget-button-press (1- (point)))
+   (notmuch-test-wait)
+   (notmuch-tree-from-search-current-query)
+   (notmuch-test-wait)
+   (test-output)
+   (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
+
+test_begin_subtest "Toggling exclude in tree search will show excluded mail"
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward "inbox")
+   (widget-button-press (1- (point)))
+   (notmuch-test-wait)
+   (notmuch-tree-from-search-current-query)
+   (notmuch-test-wait)
+  (notmuch-tree-toggle-hide-excluded)
+   (notmuch-test-wait)
+   (test-output)
+   (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
+
+test_begin_subtest "Unthreaded search doesn't contain excluded mail by default"
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward "inbox")
+   (widget-button-press (1- (point)))
+   (notmuch-test-wait)
+   (notmuch-unthreaded-from-search-current-query)
+   (notmuch-test-wait)
+   (test-output)
+   (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-without-excluded 
OUTPUT
+
+test_begin_subtest "Toggling exclude in unthreaded will show excluded mail"
+test_emacs '(notmuch-hello)
+   (goto-char (point-min))
+   (re-search-forward "inbox")
+   (widget-button-press (1- (point)))
+   (notmuch-test-wait)
+   (notmuch-unthreaded-from-search-current-query)
+   (notmuch-test-wait)
+  (notmuch-tree-toggle-hide-excluded)
+   (notmuch-test-wait)
+   (test-output)
+   (delete-other-windows)'
+test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded 
OUTPUT
+
+# Cycling from search to tree to unthreaded and vice versa will persist the 
current
+# value of notmuch-search-hide-excluded.
+
+test_begin_subtest "Value o

[PATCH v2 2/3] emacs: Allow notmuch-saved-searches to hide excluded messages

2023-04-16 Thread mohkale
From: Mohsin Kaleem 

---
 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 6aef322a..6d4197dd 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -144,6 +144,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.
+  :excludedWhether to show mail with excluded tags in the
+   search. Possible values are `hide', `show',
+   or nil. Nil means use the default value of
+   `notmuch-search-hide-excluded'.
   :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
@@ -485,19 +489,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-hide-excluded)))
+(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 exclude)))
+  (t
+   (notmuch-search search-terms oldest-first exclude)
 
 (defun notmuch-saved-search-count (search)
   (car (notmuch--process-lines notmuch-command "count" search)))
@@ -644,6 +648,10 @@ with `notmuch-hello-query-counts'."
 (newest-first nil)
 (oldest-first t)
 (otherwise notmuch-search-oldest-first)))
+(exclude (cl-case (plist-get elem :excluded)
+   (hide t)
+   (show nil)
+   (otherwise notmuch-search-hide-excluded)))
 (search-type (plist-get elem :search-type))
 (msg-count (plist-get elem :count)))
(widget-insert (format "%8s "
@@ -653,6 +661,7 @@ with `notmuch-hello-query-counts'."
   :notmuch-search-terms query
   :notmuch-search-oldest-first oldest-first
   :notmuch-search-type search-type
+  :notmuch-search-hide-excluded exclude
   name)
(setq column-indent
  (1+ (max 0 (- column-width (length name)))
-- 
2.40.0

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