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 1B609429E35 for ; Mon, 16 Jan 2012 13:10:34 -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 ZQnc4cBMorXM for ; Mon, 16 Jan 2012 13:10:33 -0800 (PST) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 351DF431FD4 for ; Mon, 16 Jan 2012 13:10:33 -0800 (PST) Received: by eekd41 with SMTP id d41so945606eek.26 for ; Mon, 16 Jan 2012 13:10:32 -0800 (PST) Received: by 10.213.28.130 with SMTP id m2mr3315274ebc.104.1326748231808; Mon, 16 Jan 2012 13:10:31 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi. [80.220.92.23]) by mx.google.com with ESMTPS id b49sm76948193eec.9.2012.01.16.13.10.29 (version=SSLv3 cipher=OTHER); Mon, 16 Jan 2012 13:10:30 -0800 (PST) From: Jani Nikula To: Pieter Praet , David Edmondson , Austin Clements Subject: Re: [PATCH] v2 [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into `notmuch' In-Reply-To: <1326732415-21894-1-git-send-email-pieter@praet.org> References: <87r4yza95m.fsf@praet.org> <1326732415-21894-1-git-send-email-pieter@praet.org> User-Agent: Notmuch/0.11+76~g1de742d (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) Date: Mon, 16 Jan 2012 23:10:27 +0200 Message-ID: <87ehuzl5fg.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Notmuch Mail 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: Mon, 16 Jan 2012 21:10:34 -0000 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. What does "merge" mean here? Will it still be possible for me to hit one key to unconditionally get to notmuch-hello, and another to cycle through the buffers? I wouldn't want to lose that ability. > --- > emacs/notmuch.el | 40 ++++++++++++++-------------------------- > 1 files changed, 14 insertions(+), 26 deletions(-) > > 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))))) > + (if next-buffer > + (progn > + (switch-to-buffer next-buffer) > + (bury-buffer old-buffer)) > + (notmuch-hello)))) notmuch-cycle-notmuch-buffers pretty much explains in the name what it does, but additionally it has documentation, and explanatory comments. Please don't drop those. BR, Jani > > (defun notmuch-interesting-buffer (b) > "Is the current buffer of interest to a notmuch user?" > @@ -1078,31 +1091,6 @@ current search results AND that are tagged with the given tag." > message-mode)))) > > ;;;###autoload > -(defun notmuch-cycle-notmuch-buffers () > - "Cycle through any existing notmuch buffers (search, show or hello). > - > -If the current buffer is the only notmuch buffer, bury it. If no > -notmuch buffers exist, run `notmuch'." > - (interactive) > - > - (let (start first) > - ;; If the current buffer is a notmuch buffer, remember it and then > - ;; bury it. > - (when (notmuch-interesting-buffer (current-buffer)) > - (setq start (current-buffer)) > - (bury-buffer)) > - > - ;; Find the first notmuch buffer. > - (setq first (loop for buffer in (buffer-list) > - if (notmuch-interesting-buffer buffer) > - return buffer)) > - > - (if first > - ;; If the first one we found is any other than the starting > - ;; buffer, switch to it. > - (unless (eq first start) > - (switch-to-buffer first)) > - (notmuch)))) > > (setq mail-user-agent 'notmuch-user-agent) > > -- > 1.7.8.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch