[PATCH] notmuch-mutt: replace extra command with notmuch-native thread search feature

Subject: [PATCH] notmuch-mutt: replace extra command with notmuch-native thread search feature

Date: Fri, 7 Apr 2023 08:54:53 +0800

To: notmuch@notmuchmail.org

Cc: Paul Wise

From: Paul Wise


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 | 6 +-----
 debian/control                    | 1 -
 3 files changed, 1 insertion(+), 8 deletions(-)

PS: I am not subscribed, please CC me in response.

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 d1e2c084..e0b2aceb 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;
 
@@ -124,11 +123,8 @@ sub thread_action($$@) {
 	empty_maildir($results_dir);
 	die "notmuch-mutt: cannot find Message-Id, abort.\n";
     }
-    my $search_cmd = 'notmuch search --output=threads ' . shell_quote("id:$mid");
-    my $tid = `$search_cmd`;	# get thread id
-    chomp($tid);
 
-    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

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: