From: Mark Walters Date: Tue, 6 May 2014 07:26:41 +0000 (+0100) Subject: Re: [PATCH] emacs: put current query as default value in notmuch-read-query X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f84947d5dc51e2dd5be6f250f4c8378b39897539;p=notmuch-archives.git Re: [PATCH] emacs: put current query as default value in notmuch-read-query --- diff --git a/b6/5ae9d882d7fd69a9b4b2f4a5cc606e766630b1 b/b6/5ae9d882d7fd69a9b4b2f4a5cc606e766630b1 new file mode 100644 index 000000000..260b9cc72 --- /dev/null +++ b/b6/5ae9d882d7fd69a9b4b2f4a5cc606e766630b1 @@ -0,0 +1,110 @@ +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 132E6431FAF + for ; Tue, 6 May 2014 00:27:44 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.502 +X-Spam-Level: +X-Spam-Status: No, score=0.502 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, 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 3mdqgK-iOZHB for ; + Tue, 6 May 2014 00:27:40 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DECA7431FAE + for ; Tue, 6 May 2014 00:27:39 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1WhZm1-0007r6-6z; Tue, 06 May 2014 08:27:35 +0100 +Received: from 92.40.112.41.threembb.co.uk ([92.40.112.41] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1WhZlz-0003yw-RN; Tue, 06 May 2014 08:26:45 +0100 +From: Mark Walters +To: David Edmondson , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: put current query as default value + in notmuch-read-query +In-Reply-To: +References: <1399133579-9106-1-git-send-email-markwalters1009@gmail.com> + +User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Tue, 06 May 2014 08:26:41 +0100 +Message-ID: <874n134bbi.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 92.40.112.41 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: c5d35f0bd92d7a4b2b27f0ac4cb78817 (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) +X-QM-Scan-Virus: ClamAV says the message is clean +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:27:44 -0000 + + +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. + +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. + +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-query)) + (notmuch-tree-mode (notmuch-tree-get-current-query)) + (notmuch-search-mode (notmuch-search-get-current-query)))))) + +so at least all the logic for calculating the current query can live in +the relevant file. + +What do you think? + +Best wishes + +Mark +