Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 12E4F6DE02DD for ; Wed, 15 Jul 2015 01:28:59 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.593 X-Spam-Level: X-Spam-Status: No, score=-0.593 tagged_above=-999 required=5 tests=[AWL=0.107, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ayGxeYiQyiZ4 for ; Wed, 15 Jul 2015 01:28:56 -0700 (PDT) Received: from avasout04.plus.net (avasout04.plus.net [212.159.14.19]) by arlo.cworth.org (Postfix) with ESMTPS id 89EFF6DE0243 for ; Wed, 15 Jul 2015 01:28:55 -0700 (PDT) Received: from localhost ([84.93.237.98]) by avasout04 with smtp id sYUr1q007283uBY01YUsDe; Wed, 15 Jul 2015 09:28:54 +0100 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=JOrGyJ+b c=1 sm=1 tr=0 a=BJaFPv9AyABFDM2hXLRoEA==:117 a=BJaFPv9AyABFDM2hXLRoEA==:17 a=0Bzu9jTXAAAA:8 a=80hmnl3cAAAA:8 a=qFRnvRBcnqcA:10 a=8nJEP1OIZ-IA:10 a=zOBTXjUuO1YA:10 a=VA9x5NBs7_5sdWHAPJUA:9 a=gQA8C8--ayaFZDxL:21 a=FLZN7u4ZqtSCcmyE:21 a=wPNLvfGTeEIA:10 Received: from localhost ([127.0.0.1] helo=webmail.plus.net) by localhost with esmtp (Exim 4.76) (envelope-from ) id 1ZFI3f-00013r-B8; Wed, 15 Jul 2015 09:28:51 +0100 Received: from 216.31.211.11 (proxying for unknown) (SquirrelMail authenticated user bubblegen+matt) by webmail.plus.net with HTTP; Wed, 15 Jul 2015 09:28:51 +0100 Message-ID: <8c802621a74950fb3216c86b117a7b93.squirrel@webmail.plus.net> In-Reply-To: <87bnff0wb9.fsf@qmul.ac.uk> References: <8cd45d0665469d8f5e98928e61e9a411.squirrel@webmail.plus.net> <87bnff0wb9.fsf@qmul.ac.uk> Date: Wed, 15 Jul 2015 09:28:51 +0100 Subject: Re: (emacs) customise key bindings taking text input From: "Matthew Lear" To: "Mark Walters" Reply-To: matt@bubblegen.co.uk User-Agent: SquirrelMail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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: Wed, 15 Jul 2015 08:28:59 -0000 > > On Tue, 14 Jul 2015, Matthew Lear wrote: >> Hi all, >> >> I was wondering if there was a way to add a new search similar to what >> pressing s does, but make it use a predefined list of search terms in >> addition to the text being entered? For example, I have reams of bug >> notification emails which currently have various tags applied. If I >> wanted >> to search a subset of these tags with a number (bug id) in the subject, >> right now I have to press s and type tag:foo and tag:bar and >> subject:1234. >> If I could add a new search option (eg 'B') and after pressing that I >> simply enter the bug id and hit return, it would save me a lot of >> typing. >> I have custom searches set up which do the 'tag:foo and tag:bar' and I >> can >> filter on the subject, but that still means pressing f and typing >> subject:1234. >> >> I fear I'm rambling here but hopefully I've conveyed what I'm trying to >> do. >> Is this possible? >> Just trying to cut down on my typing ;-) > > I don't think there is anything built in but adding something like this > snippet > > (defun my-search (&optional bug) > (interactive) > (let* ((bug (or bug (notmuch-read-query "Bug number: "))) > (query (concat "tag:foo and tag:bar and subject:" bug))) > (notmuch-search query))) > > to your .emacs file and binding it to B in the notmuch-common-keymap would > probably > do what you want. > > If people think this would be more generally useful it may be possible > to add something like this to saved searches (ie a partial saved search) > and then they would be accessible from notmuch-hello or via notmuch > jump. That's a good idea. Hooking into saved searches and then being able to refine/enhance them via a customisable text input field would be really nice. The above lisp-fu works a treat. Thank you very much, and thanks for fixing the mark read logic in notmuch-tree :-) Cheers, -- Matt