From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id tj+NK8lwul/lRgAA0tVLHw (envelope-from ) for ; Sun, 22 Nov 2020 14:08:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id oPcTJ8lwul9GRgAAB5/wlQ (envelope-from ) for ; Sun, 22 Nov 2020 14:08:09 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EEE8C9402D6 for ; Sun, 22 Nov 2020 14:08:06 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9CD25270EA; Sun, 22 Nov 2020 09:07:57 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 60797270D8 for ; Sun, 22 Nov 2020 09:07:54 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 6D8495FB8B; Sun, 22 Nov 2020 09:07:52 -0500 (EST) Received: (nullmailer pid 740514 invoked by uid 1000); Sun, 22 Nov 2020 14:07:50 -0000 From: David Bremner To: Tom Fitzhenry , notmuch@notmuchmail.org Subject: Re: [PATCH v2] emacs: add notmuch-expr, sexp-style queries In-Reply-To: <20201113120122.26105-1-tom@tom-fitzhenry.me.uk> References: <20200513100024.8474-1-tom@tom-fitzhenry.me.uk> <20201113120122.26105-1-tom@tom-fitzhenry.me.uk> Date: Sun, 22 Nov 2020 10:07:50 -0400 Message-ID: <87r1olwkll.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: PO75RSBPE7XBLBI2OHRVBB3ZHCU7A65B X-Message-ID-Hash: PO75RSBPE7XBLBI2OHRVBB3ZHCU7A65B X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Tom Fitzhenry X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: -1.01 X-TUID: gwTgYZJjkZTi Tom Fitzhenry 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.