unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Paul Wise <pabs3@bonedaddy.net>
To: notmuch@notmuchmail.org
Cc: Paul Wise <pabs3@bonedaddy.net>
Subject: [PATCH v2 2/2] notmuch-mutt: replace extra command with notmuch thread search feature
Date: Sun,  9 Apr 2023 12:41:43 +0800	[thread overview]
Message-ID: <20230409044143.4041560-2-pabs3@bonedaddy.net> (raw)
In-Reply-To: <20230409044143.4041560-1-pabs3@bonedaddy.net>

This should be be slightly faster since it avoids forking a shell
and is less code in and less dependencies for the script.

Since String::ShellQuote isn't used elsewhere, drop mention of it.
---
 contrib/notmuch-mutt/README       | 2 --
 contrib/notmuch-mutt/notmuch-mutt | 9 ++-------
 debian/control                    | 1 -
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/contrib/notmuch-mutt/README b/contrib/notmuch-mutt/README
index 26996c4a..c7520228 100644
--- a/contrib/notmuch-mutt/README
+++ b/contrib/notmuch-mutt/README
@@ -39,8 +39,6 @@ To *run* notmuch-mutt you will need Perl with the following libraries:
   (Debian package: libmail-box-perl)
 - Mail::Header <https://metacpan.org/pod/Mail::Header>
   (Debian package: libmailtools-perl)
-- String::ShellQuote <https://metacpan.org/pod/String::ShellQuote>
-  (Debian package: libstring-shellquote-perl)
 - Term::ReadLine::Gnu <https://metacpan.org/pod/Term::ReadLine::Gnu>
   (Debian package: libterm-readline-gnu-perl)
 
diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
index 1bb95ba6..48cb5594 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -17,7 +17,6 @@ use Getopt::Long qw(:config no_getopt_compat);
 use Mail::Header;
 use Mail::Box::Maildir;
 use Pod::Usage;
-use String::ShellQuote;
 use Term::ReadLine;
 use Digest::SHA;
 
@@ -126,13 +125,9 @@ sub thread_action($$@) {
     }
 
     $mid =~ s/ //g; # notmuch strips spaces before storing Message-Id
-    $mid =~ s/"/""/g; # escape all double quote characters
-
-    my $search_cmd = 'notmuch search --output=threads ' . shell_quote(qq{id:"$mid"});
-    my $tid = `$search_cmd`;	# get thread id
-    chomp($tid);
+    $mid =~ s/"/""""/g; # escape all double quote characters twice
 
-    search($results_dir, $remove_dups, $tid);
+    search($results_dir, $remove_dups, qq{thread:"{id:""$mid""}"});
 }
 
 sub tag_action(@) {
diff --git a/debian/control b/debian/control
index 2dcb8cc7..135eb7ce 100644
--- a/debian/control
+++ b/debian/control
@@ -227,7 +227,6 @@ Architecture: all
 Depends:
  libmail-box-perl,
  libmailtools-perl,
- libstring-shellquote-perl,
  libterm-readline-gnu-perl,
  notmuch (>= 0.4),
  ${misc:Depends},
-- 
2.39.2

  reply	other threads:[~2023-04-09  4:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07  0:54 [PATCH] notmuch-mutt: replace extra command with notmuch-native thread search feature Paul Wise
2023-04-08 11:42 ` David Bremner
2023-04-09  4:38   ` Paul Wise
2023-04-09  4:41     ` [PATCH v2 1/2] notmuch-mutt: fix Xapian query construction Paul Wise
2023-04-09  4:41       ` Paul Wise [this message]
2023-05-27 17:31         ` [PATCH v2 2/2] notmuch-mutt: replace extra command with notmuch thread search feature David Bremner
2023-04-09 16:00     ` [PATCH] notmuch-mutt: replace extra command with notmuch-native " David Bremner
2023-04-10  0:48       ` Paul Wise
2023-04-10 13:04     ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230409044143.4041560-2-pabs3@bonedaddy.net \
    --to=pabs3@bonedaddy.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).