From 6755a8ebde8b97dc32c1f4b8729d7d66835b6060 Mon Sep 17 00:00:00 2001 From: Charles Celerier Date: Tue, 2 Dec 2014 12:01:52 +1900 Subject: [PATCH] Re: [PATCH v2] emacs: Added "is:" style completion to notmuch-read-query. --- e0/c0ffc00d389201fe2c46701969838badccc699 | 146 ++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 e0/c0ffc00d389201fe2c46701969838badccc699 diff --git a/e0/c0ffc00d389201fe2c46701969838badccc699 b/e0/c0ffc00d389201fe2c46701969838badccc699 new file mode 100644 index 000000000..ef841e77c --- /dev/null +++ b/e0/c0ffc00d389201fe2c46701969838badccc699 @@ -0,0 +1,146 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id E622B431FC3 + for ; Mon, 1 Dec 2014 09:02:15 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id bGX68a2NkfGs for ; + Mon, 1 Dec 2014 09:02:09 -0800 (PST) +Received: from smtp2.cs.Stanford.EDU (smtp2.cs.stanford.edu [171.64.64.26]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 05D98431FC0 + for ; Mon, 1 Dec 2014 09:02:08 -0800 (PST) +Received: from tor-exit.de ([195.37.190.67]:44480 helo=Jane.lan) + by smtp2.cs.Stanford.EDU with esmtpsa (UNKNOWN:AES128-GCM-SHA256:128) + (Exim 4.80.1) (envelope-from ) + id 1XvUMN-0004Ym-4l; Mon, 01 Dec 2014 09:02:06 -0800 +From: Charles Celerier +To: David Edmondson , Notmuch Mail +Subject: Re: [PATCH v2] emacs: Added "is:" style completion + to notmuch-read-query. +In-Reply-To: +References: <1417219835-92141-1-git-send-email-cceleri@cs.stanford.edu> + <1417279197-90877-1-git-send-email-cceleri@cs.stanford.edu> + +User-Agent: Notmuch/0.18.1+208~g93eda7e (http://notmuchmail.org) Emacs/24.4.1 + (x86_64-apple-darwin14.0.0) +Date: Mon, 01 Dec 2014 12:01:52 -0500 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; + micalg=pgp-sha1; protocol="application/pgp-signature" +X-Scan-Signature: 1a99e790efc5595ebc7b409aae77a077 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 01 Dec 2014 17:02:16 -0000 + +--=-=-= +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +Can the variables in the varlist depend on the definition of variables +that precede them in the list? I believe I tried your suggestion, but +quickly gave up as Emacs gave me an error claiming that all-tags was +void. + +charles + +David Edmondson writes: + +> On Sat, Nov 29 2014, Charles Celerier wrote: +>> The notmuch-search-terms man page states that "tag:" is equivalent +>> to "is:". Completion for "is:" style searches is now supported +>> in the Emacs interface. +>> +>> Signed-off-by: Charles Celerier +>> --- +>> emacs/notmuch.el | 11 +++++++---- +>> 1 file changed, 7 insertions(+), 4 deletions(-) +>> +>> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +>> index 218486a..d29499c 100644 +>> --- a/emacs/notmuch.el +>> +++ b/emacs/notmuch.el +>> @@ -856,12 +856,15 @@ See `notmuch-tag' for information on the format of= + TAG-CHANGES." +>>=20=20 +>> PROMPT is the string to prompt with." +>> (lexical-let +>> + (( all-tags +>> + (mapcar (lambda (tag) (notmuch-escape-boolean-term tag)) +>> + (process-lines notmuch-command "search" "--output=3Dtag= +s" "*")))) +>> + (let +> +> I think that David's suggestion was that you would have only one `let' +> form, so something like: +> +> (lexical-let* +> ((all-tags (mapcar ...)) +> (completions (append ...)) +> (keymap (copy-keymap ...)) +> (current-query ...)) +> ...) +> +>> ((completions +>> (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:" +>> "subject:" "attachment:") +>> - (mapcar (lambda (tag) +>> - (concat "tag:" (notmuch-escape-boolean-term tag))) +>> - (process-lines notmuch-command "search" "--output=3Dtags" "*"))))) +>> + (mapcar (lambda (tag) (concat "tag:" tag)) all-tags) +>> + (mapcar (lambda (tag) (concat "is:" tag)) all-tags)))) +>> (let ((keymap (copy-keymap minibuffer-local-map)) +>> (current-query (case major-mode +>> (notmuch-search-mode (notmuch-search-get-query)) +>> @@ -884,7 +887,7 @@ PROMPT is the string to prompt with." +>> (define-key keymap (kbd "TAB") 'minibuffer-complete) +>> (let ((history-delete-duplicates t)) +>> (read-from-minibuffer prompt nil keymap nil +>> - 'notmuch-search-history current-query nil))))) +>> + 'notmuch-search-history current-query nil)))))) +>>=20=20 +>> (defun notmuch-search-get-query () +>> "Return the current query in this search buffer" +>> --=20 +>> 2.1.2 +>> +>> _______________________________________________ +>> notmuch mailing list +>> notmuch@notmuchmail.org +>> http://notmuchmail.org/mailman/listinfo/notmuch + +--=-=-= +Content-Type: application/pgp-signature; name="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG/MacGPG2 v2 + +iQEcBAEBAgAGBQJUfJ8BAAoJEOjk698fDjuAZMcH/j3DCPbML4Mg4F3SvsDhSDmj +zVQ+m2jiOXGkrpgxf9zJugwutt5PlULMmQkOKB8gxzAAvLFO3WC89zeEm453z12Z +jlKpHJY/DnMF3Y34Sj9UYbUXdIWZEzMqJRv7F6UrWL32xcnOIbV45v1oikUNiRdE +ivhYjU5CiSa8HU1TrbKxidkr3SXfBcD0A6re48zEcCD32Wi86at6a0ZRPANEa5Xa +tGqiyt2AClbIUvJ3o7ozPeVFCFuVi+R3jy1fOM4ynKz2AWCpjEpvMyIDMSztkT9K +xvqpw81x0no9a8Rhq3GkxxxKJBHPKYmoKGVOTxXN4vSEQFsyNP3tyhSgnAyZdus= +=A8/Y +-----END PGP SIGNATURE----- +--=-=-=-- -- 2.26.2