[RFC PATCH 0/2] emacs proof-of-concept: functions in saved searches

Jani Nikula jani at nikula.org
Wed Nov 23 13:08:35 PST 2011


Hi, this is a quick proof-of-concept implementation of an idea by m1lkc0w on IRC
(transcript below) to allow functions in saved searches. I'm not quite sure
whether I'm for or against the idea, though it's kind of neat... :)

Patch 1 adds the implementation. The (if (functionp ...)) parts should obviously
be abstracted, but otherwise there's not much to it.

Patch 2 has a couple of crude example functions (that I just shoved into
notmuch-hello.el) that might be useful in saved searches. One to match
everything that the other saved searches don't, another a building block to
combine existing saved searches.

Comments are welcome, though I don't think I'll be pursuing this much further.

BR,
Jani.


PS. For the original problem of date range searches there's also
id:"cover.1312964528.git.jani at nikula.org" if you're willing to live with such
out of tree patches (they won't be merged).


[2011-11-23 UTC+2]
 00:43         m1lkc0w   How difficult would it be to allow functions in "saved 
                         searches"?
 00:46         m1lkc0w   This could be helpful to define functions for 
                         calculating search timestamps
 00:48         bremner   m1lkc0w: personally I'd like to get away from saved 
                         searches being emacs specific
 00:48         bremner   for dates, would it solve your problem if notmuch had 
                         a sensible date parser?
 00:49         m1lkc0w   bremner: sure.
 00:49         m1lkc0w   bremner: I just thought that in the meantime, I can 
                         calculate the timespamps in elisp
 00:50         m1lkc0w   bremner: Just wanted to list last week's email - 
                         that's hwo the idea came up
 00:51         bremner   I guess it wouldn't be that hard for someone with 
                         elisp skillz to make saved searches have a ("name" . 
                         function ) in addition to (name . string)


Jani Nikula (2):
  emacs: allow functions as saved searches
  emacs: a couple of example functions that might be useful with saved
    searches

 emacs/notmuch-hello.el |   27 +++++++++++++++++++++++++--
 emacs/notmuch-lib.el   |    8 ++++++--
 emacs/notmuch.el       |    9 +++++++--
 3 files changed, 38 insertions(+), 6 deletions(-)

-- 
1.7.5.4



More information about the notmuch mailing list