From 6ca9e3cd3960894709d1e36114d5df91de77cb8d Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Tue, 6 May 2014 08:44:53 +0100 Subject: [PATCH] Re: [PATCH] emacs: put current query as default value in notmuch-read-query --- b6/31c84244b04c3150b5551faf928314d406350b | 132 ++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 b6/31c84244b04c3150b5551faf928314d406350b diff --git a/b6/31c84244b04c3150b5551faf928314d406350b b/b6/31c84244b04c3150b5551faf928314d406350b new file mode 100644 index 000000000..c092edfce --- /dev/null +++ b/b6/31c84244b04c3150b5551faf928314d406350b @@ -0,0 +1,132 @@ +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 1827C431FB6 + for ; Tue, 6 May 2014 00:45:05 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 MVesYUx4f+sh for ; + Tue, 6 May 2014 00:45:01 -0700 (PDT) +Received: from mail-we0-f176.google.com (mail-we0-f176.google.com + [74.125.82.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 98EE8431FAE + for ; Tue, 6 May 2014 00:45:01 -0700 (PDT) +Received: by mail-we0-f176.google.com with SMTP id q59so6123997wes.21 + for ; Tue, 06 May 2014 00:45:00 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:to:subject:in-reply-to:references:user-agent + :from:date:message-id:mime-version:content-type; + bh=zne+Kx5l+3vGiNAF0R4Y+LXD/flBfFv8LPgkWD9+hGY=; + b=cBd9WMiUPZYfkiCjwHg3FnPszE4hUCQHxvirIkZwWXaHO1vROG0i45CFtJtY7qTlV0 + LwWbq0sYfePYk0uPnYjmY7OmeKS6bFHgbRFM7QHmersi45TLoYCwoGxlZIXZ0YZ/dj/s + mOfsnZeEBTxo8qbD+PY+2nCbpAQ9/aB9fj8h2uYq8pbZS1vwLgj5mvCyZjkS16iFTcZh + 2v1gp8lfCo+BKPWNbT8ci1AFLLZFZE97Rls+o0z1PBMb7XgMMQrrXfzm7bs4D4//DllX + 9t0uu//r9CLP+uNm04xgu9YBJWkTbtGa2oCElqv1sLg+ZU+QaFqqzyW0ODrmJt/FvY6x + bLrA== +X-Gm-Message-State: + ALoCoQmq0e2Mau6DYfD4EiPCnfwIXm09qQWB/TwRhSHhHco8d4m9BRqXGci1bBgh1jLXu9ZPHuaa +X-Received: by 10.180.13.208 with SMTP id j16mr1147778wic.58.1399362300321; + Tue, 06 May 2014 00:45:00 -0700 (PDT) +Received: from localhost (disaster-area.hh.sledj.net. [81.149.164.25]) + by mx.google.com with ESMTPSA id + by1sm20745331wjc.26.2014.05.06.00.44.58 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Tue, 06 May 2014 00:44:59 -0700 (PDT) +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: put current query as default value + in notmuch-read-query +In-Reply-To: <874n134bbi.fsf@qmul.ac.uk> +References: <1399133579-9106-1-git-send-email-markwalters1009@gmail.com> + + <874n134bbi.fsf@qmul.ac.uk> +User-Agent: Notmuch/0.18~rc0 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +From: David Edmondson +Date: Tue, 06 May 2014 08:44:53 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; + micalg=pgp-sha1; protocol="application/pgp-signature" +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: Tue, 06 May 2014 07:45:05 -0000 + +--=-=-= +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Tue, May 06 2014, Mark Walters wrote: +> Hi +> +> On Tue, 06 May 2014, David Edmondson wrote: +>> On Sat, May 03 2014, Mark Walters wrote: +>>> An alternative to putting the logic in notmuch-read-query would be to +>>> store the query in a consistently named buffer local variable in all +>>> the modes. If we want to show the actually run query in notmuch-show +>>> above then this is probably the neatest solution. +>> +>> Could per-mode query functions not simply pass the default as an +>> optional second argument to `notmuch-read-query'? +> +> They could but at the moment notmuch-search and notmuch-tree are both +> bound in the global key map and they in turn call notmuch-read-query.=20 +> +> I guess we could add an argument to notmuch-search and notmuch-tree +> for the default argument (which they would pass to +> notmuch-read-query). Then calling modes which know a search value +> (show,search and tree) could override the global keymap (probably using +> remap or something to mean that they keep any customised binding) to +> link into something which passes the default value through. + +I would probably replace the global keymap bindings, but others should +chime in. + +> One variant which might be nicer than the current version would be to +> have something like +> (let ((current-query (case major-mode +> (notmuch-show-mode (notmuch-show-get-current-q= +uery)) +> (notmuch-tree-mode (notmuch-tree-get-current-q= +uery)) +> (notmuch-search-mode (notmuch-search-get-curre= +nt-query)))))) +> +> so at least all the logic for calculating the current query can live in +> the relevant file. +> +> What do you think? + +This is nicer than the current patch. + +--=-=-= +Content-Type: application/pgp-signature; name="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1 + +iKYEARECAGYFAlNokvZfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl +bnBncC5maWZ0aGhvcnNlbWFuLm5ldDc1M0Y5NDJDMEExNjc3MDE4OURGMUYyMDY5 +RUNEMEFCRjA0OTY1MTYACgkQaezQq/BJZRYscACfeF4wpsLhmlckRc7MdGZEcye9 ++HoAnA1nLKezzb1zRr2jZbE0WFDeSdR0 +=j3FG +-----END PGP SIGNATURE----- +--=-=-=-- -- 2.26.2