--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 132E6431FAF\r
+ for <notmuch@notmuchmail.org>; Tue, 6 May 2014 00:27:44 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.502\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.502 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 3mdqgK-iOZHB for <notmuch@notmuchmail.org>;\r
+ Tue, 6 May 2014 00:27:40 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id DECA7431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 6 May 2014 00:27:39 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WhZm1-0007r6-6z; Tue, 06 May 2014 08:27:35 +0100\r
+Received: from 92.40.112.41.threembb.co.uk ([92.40.112.41] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WhZlz-0003yw-RN; Tue, 06 May 2014 08:26:45 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: put current query as default value\r
+ in notmuch-read-query\r
+In-Reply-To: <cunha53fm8v.fsf@hotblack-desiato.hh.sledj.net>\r
+References: <1399133579-9106-1-git-send-email-markwalters1009@gmail.com>\r
+ <cunha53fm8v.fsf@hotblack-desiato.hh.sledj.net>\r
+User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 06 May 2014 08:26:41 +0100\r
+Message-ID: <874n134bbi.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 92.40.112.41\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: c5d35f0bd92d7a4b2b27f0ac4cb78817 (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored 0.0 points. Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 06 May 2014 07:27:44 -0000\r
+\r
+\r
+Hi\r
+\r
+On Tue, 06 May 2014, David Edmondson <dme@dme.org> wrote:\r
+> On Sat, May 03 2014, Mark Walters wrote:\r
+>> An alternative to putting the logic in notmuch-read-query would be to\r
+>> store the query in a consistently named buffer local variable in all\r
+>> the modes. If we want to show the actually run query in notmuch-show\r
+>> above then this is probably the neatest solution.\r
+>\r
+> Could per-mode query functions not simply pass the default as an\r
+> optional second argument to `notmuch-read-query'?\r
+\r
+They could but at the moment notmuch-search and notmuch-tree are both\r
+bound in the global key map and they in turn call notmuch-read-query. \r
+\r
+I guess we could add an argument to notmuch-search and notmuch-tree\r
+for the default argument (which they would pass to\r
+notmuch-read-query). Then calling modes which know a search value\r
+(show,search and tree) could override the global keymap (probably using\r
+remap or something to mean that they keep any customised binding) to\r
+link into something which passes the default value through.\r
+\r
+One variant which might be nicer than the current version would be to\r
+have something like\r
+(let ((current-query (case major-mode\r
+ (notmuch-show-mode (notmuch-show-get-current-query))\r
+ (notmuch-tree-mode (notmuch-tree-get-current-query))\r
+ (notmuch-search-mode (notmuch-search-get-current-query))))))\r
+\r
+so at least all the logic for calculating the current query can live in\r
+the relevant file.\r
+\r
+What do you think?\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r