unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] custom search prefix
@ 2015-04-06  1:13 Sebastian Fischmeister
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Fischmeister @ 2015-04-06  1:13 UTC (permalink / raw)
  To: notmuch


Hi,

I found this handy to provide a specific prefix for searches. For
example, when you always want to search only the last 2 years of emails,
then you can set the variable notmuch-query-prefix to "date:2y..now ".

  Sebastian


Sebastian Fischmeister (1):
  custom prefix

 emacs/notmuch.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.3.5

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

* [PATCH] custom search prefix
@ 2015-04-06  1:13 Sebastian Fischmeister
  2015-08-02 10:33 ` David Bremner
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Fischmeister @ 2015-04-06  1:13 UTC (permalink / raw)
  To: notmuch


---
 emacs/notmuch.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index ab00454..c9cd31a 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -851,6 +851,12 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
           (concat "*notmuch-search-" query "*"))
          )))
 
+(defcustom notmuch-query-prefix nil
+  "Add a prefix to the standard query."
+  :type 'string
+  :group 'notmuch-search)
+
+
 (defun notmuch-read-query (prompt)
   "Read a notmuch-query from the minibuffer with completion.
 
@@ -883,7 +889,7 @@ PROMPT is the string to prompt with."
       ;; this was simpler than convincing completing-read to accept spaces:
       (define-key keymap (kbd "TAB") 'minibuffer-complete)
       (let ((history-delete-duplicates t))
-       (read-from-minibuffer prompt nil keymap nil
+       (read-from-minibuffer prompt notmuch-query-prefix keymap nil
                              'notmuch-search-history current-query nil)))))
 
 (defun notmuch-search-get-query ()
-- 
2.3.5

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

* Re: [PATCH] custom search prefix
  2015-04-06  1:13 [PATCH] custom search prefix Sebastian Fischmeister
@ 2015-08-02 10:33 ` David Bremner
  0 siblings, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-08-02 10:33 UTC (permalink / raw)
  To: sfischme, notmuch


Hi Sebastian;

Sorry this sat so long in the queue.

I agree it doesn't cost much to add it, but offhand I'm not sure what
the use case is. It would be be good to (briefly) mention this in the
commit message and also expand the docstring for the variable a bit,
since this is currently our only documentation.

> +(defcustom notmuch-query-prefix nil
> +  "Add a prefix to the standard query."
> +  :type 'string
> +  :group 'notmuch-search)
> +

In addition to general comments about, I'd say that "standard query" is
a bit ambigious for me. It sounds like it would be added e.g. to
saved-searches.  Maybe "default" search, with some discussion of where
it is used (so people don't have to read the source to figure it out).

d

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

end of thread, other threads:[~2015-08-02 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-06  1:13 [PATCH] custom search prefix Sebastian Fischmeister
2015-08-02 10:33 ` David Bremner
  -- strict thread matches above, loose matches on Subject: below --
2015-04-06  1:13 Sebastian Fischmeister

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