Re: [PATCH v2] emacs: add notmuch-expr, sexp-style queries

Subject: Re: [PATCH v2] emacs: add notmuch-expr, sexp-style queries

Date: Sun, 22 Nov 2020 10:07:50 -0400

To: Tom Fitzhenry, notmuch@notmuchmail.org

Cc: Tom Fitzhenry

From: David Bremner


Tom Fitzhenry <tom@tom-fitzhenry.me.uk> writes:

> +(require 'ert)
> +(require 'notmuch-expr)

Any ideas (from anyone) how we can run these tests in the notmuch test
suite? I guess some kind of shim might be needed, but perhaps it can
just be wrapped in one or more test_emacs calls.

> +
> +(defmacro notmuch-expr (query)
> +  "Compile an sexp QUERY into a textual notmuch query."
> +  `(notmuch-expr--eval ,query))

Does this need to be a macro? If so I'd appreciate a brief comment as to
why. At this point optimizing performace seems pretty premature, but
maybe there are other good reasons.
> index 165aaa43..8c5843e5 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -79,6 +79,7 @@
>  (require 'notmuch-maildir-fcc)
>  (require 'notmuch-message)
>  (require 'notmuch-parser)
> +(require 'notmuch-expr)
>  

I know we have just been requiring things historically, but I really
wonder if it's the right thing to do, especially since it seems the
library is not (yet) used for anything. Perhaps an autoload cookie on
the appropriate functions would be best.

By the way, I'd eventually like the CLI to parse S-expr queries (and/or
perhaps JSON queries) to avoid passing via strings (and all the problems
that entails). I'm not sure when I'll get around to it. There are also
some design details to be worked out, but hopefully it would bne a
mostly-compatible syntax with what is provided here.


_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: