unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/4] emacs: Implement notmuch-search-refine
@ 2019-02-07 15:36 zaephon
  2019-04-03 10:21 ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: zaephon @ 2019-02-07 15:36 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: [PATCH 1/4] emacs: Implement notmuch-search-refine --]
[-- Type: text/x-patch, Size: 1912 bytes --]

From 6f73e9aa2031de33eb48a05807295fdb7c3bb566 Mon Sep 17 00:00:00 2001
From: Leo Vivier <zaephon@gmail.com>
Date: Wed, 6 Feb 2019 16:44:59 +0100
Subject: [PATCH 1/4] emacs: Implement notmuch-search-refine
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Refine the current query string.
---
Filtering was already implemented with notmuch-search-filter, but
there wasn’t any way to refine the current query.
---
 emacs/notmuch.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 804e78ab..8bbed17d 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -1070,6 +1070,27 @@ current search results AND the additional query string provided."
 		      (concat grouped-original-query " and " grouped-query))
 		    notmuch-search-oldest-first)))
 
+(defvar notmuch-search-refine-replace-buffer nil
+  "Should ‘not-much-refine’ replace the current search?")
+
+(defun notmuch-search-refine (query &optional replace)
+  "Refine the current query string.
+
+When REPLACE is non-nil, do not create another buffer.  See also
+‘notmuch-search-refine-replace-buffer’."
+  (interactive (list (minibuffer-with-setup-hook
+                         (lambda ()
+                           (next-history-element 1)
+                           (end-of-line)
+                           (insert " "))
+                       (notmuch-read-query "Refine search: "))))
+  (let ((grouped-query (notmuch-group-disjunctive-query-string
+                        query)))
+    (when (or replace
+	      notmuch-search-refine-replace-buffer)
+      (notmuch-bury-or-kill-this-buffer))
+    (notmuch-search grouped-query notmuch-search-oldest-first)))
+
 (defun notmuch-search-filter-by-tag (tag)
   "Filter the current search results based on a single tag.
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-03 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 15:36 [PATCH 1/4] emacs: Implement notmuch-search-refine zaephon
2019-04-03 10:21 ` David Bremner
2019-04-03 11:57   ` Leo Vivier
2019-04-03 12:58     ` David Bremner

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