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 0CC2A429E4D for ; Wed, 23 Nov 2011 13:08:46 -0800 (PST) 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 5GhrwkvHuvE4 for ; Wed, 23 Nov 2011 13:08:45 -0800 (PST) Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 301D8429E4B for ; Wed, 23 Nov 2011 13:08:45 -0800 (PST) Received: by bkaq10 with SMTP id q10so2250402bka.26 for ; Wed, 23 Nov 2011 13:08:42 -0800 (PST) Received: by 10.205.128.138 with SMTP id he10mr25420692bkc.13.1322082522183; Wed, 23 Nov 2011 13:08:42 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi. [80.220.92.23]) by mx.google.com with ESMTPS id i3sm23159675fah.11.2011.11.23.13.08.39 (version=SSLv3 cipher=OTHER); Wed, 23 Nov 2011 13:08:40 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [RFC PATCH 0/2] emacs proof-of-concept: functions in saved searches Date: Wed, 23 Nov 2011 23:08:35 +0200 Message-Id: X-Mailer: git-send-email 1.7.5.4 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: Wed, 23 Nov 2011 21:08:46 -0000 Hi, this is a quick proof-of-concept implementation of an idea by m1lkc0w on IRC (transcript below) to allow functions in saved searches. I'm not quite sure whether I'm for or against the idea, though it's kind of neat... :) Patch 1 adds the implementation. The (if (functionp ...)) parts should obviously be abstracted, but otherwise there's not much to it. Patch 2 has a couple of crude example functions (that I just shoved into notmuch-hello.el) that might be useful in saved searches. One to match everything that the other saved searches don't, another a building block to combine existing saved searches. Comments are welcome, though I don't think I'll be pursuing this much further. BR, Jani. PS. For the original problem of date range searches there's also id:"cover.1312964528.git.jani@nikula.org" if you're willing to live with such out of tree patches (they won't be merged). [2011-11-23 UTC+2] 00:43 m1lkc0w How difficult would it be to allow functions in "saved searches"? 00:46 m1lkc0w This could be helpful to define functions for calculating search timestamps 00:48 bremner m1lkc0w: personally I'd like to get away from saved searches being emacs specific 00:48 bremner for dates, would it solve your problem if notmuch had a sensible date parser? 00:49 m1lkc0w bremner: sure. 00:49 m1lkc0w bremner: I just thought that in the meantime, I can calculate the timespamps in elisp 00:50 m1lkc0w bremner: Just wanted to list last week's email - that's hwo the idea came up 00:51 bremner I guess it wouldn't be that hard for someone with elisp skillz to make saved searches have a ("name" . function ) in addition to (name . string) Jani Nikula (2): emacs: allow functions as saved searches emacs: a couple of example functions that might be useful with saved searches emacs/notmuch-hello.el | 27 +++++++++++++++++++++++++-- emacs/notmuch-lib.el | 8 ++++++-- emacs/notmuch.el | 9 +++++++-- 3 files changed, 38 insertions(+), 6 deletions(-) -- 1.7.5.4