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 3133B431FBD for ; Wed, 18 Jan 2012 02:05:00 -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 UXjeZfwDL5ot for ; Wed, 18 Jan 2012 02:04:59 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 1B7C7431FAE for ; Wed, 18 Jan 2012 02:04:58 -0800 (PST) Received: by werp13 with SMTP id p13so1243587wer.26 for ; Wed, 18 Jan 2012 02:04:58 -0800 (PST) Received: by 10.216.131.76 with SMTP id l54mr9098571wei.34.1326881097930; Wed, 18 Jan 2012 02:04:57 -0800 (PST) Received: from localhost ([109.131.97.13]) by mx.google.com with ESMTPS id em13sm21567366wid.7.2012.01.18.02.04.57 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jan 2012 02:04:57 -0800 (PST) From: Pieter Praet To: David Edmondson , notmuch Subject: Re: [PATCH] v2 [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into `notmuch' In-Reply-To: References: <87r4yza95m.fsf@praet.org> <1326732415-21894-1-git-send-email-pieter@praet.org> User-Agent: Notmuch/0.11+86~g67f4140 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-unknown-linux-gnu) Date: Wed, 18 Jan 2012 11:03:09 +0100 Message-ID: <87fwfd8h0i.fsf@praet.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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, 18 Jan 2012 10:05:00 -0000 On Mon, 16 Jan 2012 17:03:44 +0000, David Edmondson wrote: > On Mon, 16 Jan 2012 17:46:55 +0100, Pieter Praet wrote: > > Make `notmuch-cycle-notmuch-buffers' more Lispy and merge into `notmuch', > > eliminating the need to hog yet another keybind. > ... > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el > > index ef4dcc7..539b3a0 100644 > > --- a/emacs/notmuch.el > > +++ b/emacs/notmuch.el > > @@ -1067,7 +1067,20 @@ current search results AND that are tagged with the given tag." > > (defun notmuch () > > "Run notmuch and display saved searches, known tags, etc." > > (interactive) > > - (notmuch-hello)) > > + (let* ((old-buffer (current-buffer)) > > + (interesting-buffers > > + (delq nil (mapcar (lambda (b) > > + (if (notmuch-interesting-buffer b) b)) > > + (buffer-list)))) > > + (next-buffer (first > > + (delq nil (mapcar (lambda (b) > > + (unless (eq old-buffer b) b)) > > + interesting-buffers))))) > > This feels _less_ lispy. [...] True. I simply re-implemented `delete-if-not' in order to prevent having to require the `cl' package at runtime. (why on Earth isn't there an equivalent function in plain Elisp ?!?) $ sed -e "s/C\?Lisp\(y\|'ier\)/Elispy/" $COMMIT_MSG > [...] Any occurrences of '(delq nil ...)' strike me > as odd. [...] How so? Lacking a flexible way to conditionally remove elements from a list (that doesn't require the `cl' package in some way or another), a combination of `mapcar' and `delq' seemed like the easiest approach. (AFAIK; Please correct me if (when) I'm wrong!) > [...] What's wrong with '(loop ... collect ...)'? > Nothing at all. I was fixing my own patch [1] without resorting to requiring the `cl' package at runtime :) Would be nice if we could get rid of the compile-time dependency as well, though. Fresh patch to that effect follows. Feel free to disregard it, just bikesheddin'... > > + (if next-buffer > > + (progn > > + (switch-to-buffer next-buffer) > > + (bury-buffer old-buffer)) > > + (notmuch-hello)))) > > Integrating with `notmuch' is fine with me. Peace -- Pieter [1] id:"1326710551-23122-1-git-send-email-pieter@praet.org"