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

* Re: [PATCH 1/4] emacs: Implement notmuch-search-refine
  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
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2019-04-03 10:21 UTC (permalink / raw)
  To: zaephon, notmuch

zaephon@gmail.com writes:

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

I don't really understand/remember the motivation for this proposed
new feature. I know it was discussed on IRC, but I don't think I
understood it completely then either.  Is the whole story that you don't
like pressing M-p after pressing l to bring up the previous query?

d

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

* Re: [PATCH 1/4] emacs: Implement notmuch-search-refine
  2019-04-03 10:21 ` David Bremner
@ 2019-04-03 11:57   ` Leo Vivier
  2019-04-03 12:58     ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Leo Vivier @ 2019-04-03 11:57 UTC (permalink / raw)
  To: David Bremner, notmuch

Hello,

David Bremner <david@tethera.net> writes:

> Is the whole story that you don't like pressing M-p after pressing l
> to bring up the previous query?

Pretty much.  I wrote that patch not knowing that notmuch could predict
the next potential search with M-n in the minibuffer (which, as it
stands, does the same thing as M-p).

Discovering that severely undermined the raison d’être of this patch.  I
tried to do something else with it by having it mimic a similar function
in mu4e where the point was put at the end of the previous search, but
I’ve found very little use for it.

I think it’s safe to abandon this patch.

Best,

-- 
Leo Vivier

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

* Re: [PATCH 1/4] emacs: Implement notmuch-search-refine
  2019-04-03 11:57   ` Leo Vivier
@ 2019-04-03 12:58     ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2019-04-03 12:58 UTC (permalink / raw)
  To: Leo Vivier, notmuch

Leo Vivier <zaephon@gmail.com> writes:

> Discovering that severely undermined the raison d’être of this patch.  I
> tried to do something else with it by having it mimic a similar function
> in mu4e where the point was put at the end of the previous search, but
> I’ve found very little use for it.
>
> I think it’s safe to abandon this patch.
>

Thanks for the followup. I'll mark it as obsolete for now.

All the best,

David

^ permalink raw reply	[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).