unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Tom Fitzhenry <tom@tom-fitzhenry.me.uk>, notmuch@notmuchmail.org
Cc: Tom Fitzhenry <tomfitzhenry@google.com>
Subject: Re: [PATCH v2] emacs: add notmuch-expr, sexp-style queries
Date: Sun, 22 Nov 2020 10:07:50 -0400	[thread overview]
Message-ID: <87r1olwkll.fsf@tethera.net> (raw)
In-Reply-To: <20201113120122.26105-1-tom@tom-fitzhenry.me.uk>

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.


      parent reply	other threads:[~2020-11-22 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 10:00 [PATCH] emacs: add notmuch-expr, sexp-style queries Tom Fitzhenry
2020-05-21 21:32 ` Daniel Kahn Gillmor
2020-11-13 12:01 ` [PATCH v2] " Tom Fitzhenry
2020-11-16  9:48   ` David Edmondson
2020-11-16 21:09   ` Jonas Bernoulli
2020-11-22 14:07   ` David Bremner [this message]

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=87r1olwkll.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    --cc=tom@tom-fitzhenry.me.uk \
    --cc=tomfitzhenry@google.com \
    /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).