unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: zaephon@gmail.com
To: notmuch@notmuchmail.org
Subject: [PATCH 1/4] emacs: Implement notmuch-search-refine
Date: Thu, 07 Feb 2019 16:36:39 +0100	[thread overview]
Message-ID: <87wombliew.fsf@hidden> (raw)

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

             reply	other threads:[~2019-02-07 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 15:36 zaephon [this message]
2019-04-03 10:21 ` [PATCH 1/4] emacs: Implement notmuch-search-refine David Bremner
2019-04-03 11:57   ` Leo Vivier
2019-04-03 12:58     ` 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=87wombliew.fsf@hidden \
    --to=zaephon@gmail.com \
    --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).