Re: [PATCH] v2 [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into...
authorPieter Praet <pieter@praet.org>
Wed, 18 Jan 2012 10:07:42 +0000 (11:07 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:34 +0000 (09:42 -0800)
67/89709d12dc4f709aab6e357779d0089514c95c [new file with mode: 0644]

diff --git a/67/89709d12dc4f709aab6e357779d0089514c95c b/67/89709d12dc4f709aab6e357779d0089514c95c
new file mode 100644 (file)
index 0000000..682bbcf
--- /dev/null
@@ -0,0 +1,174 @@
+Return-Path: <pieter@praet.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3082D431FBD\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 02:09:33 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id BEf8hq5+ktzd for <notmuch@notmuchmail.org>;\r
+       Wed, 18 Jan 2012 02:09:32 -0800 (PST)\r
+Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
+ [74.125.82.45])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 0E85A431FAE   for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 02:09:31 -0800\r
+ (PST)\r
+Received: by wgbdr13 with SMTP id dr13so2154329wgb.2\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 02:09:30 -0800 (PST)\r
+Received: by 10.180.109.77 with SMTP id hq13mr29978785wib.7.1326881370925;\r
+       Wed, 18 Jan 2012 02:09:30 -0800 (PST)\r
+Received: from localhost ([109.131.97.13])\r
+       by mx.google.com with ESMTPS id em13sm21586448wid.7.2012.01.18.02.09.29\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 18 Jan 2012 02:09:30 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Jani Nikula <jani@nikula.org>, David Edmondson <dme@dme.org>,\r
+       Austin Clements <amdragon@MIT.EDU>\r
+Subject: Re: [PATCH] v2 [RFC] emacs: merge overhauled\r
+       `notmuch-cycle-notmuch-buffers' into `notmuch'\r
+In-Reply-To: <87ehuzl5fg.fsf@nikula.org>\r
+References: <87r4yza95m.fsf@praet.org>\r
+       <1326732415-21894-1-git-send-email-pieter@praet.org>\r
+       <87ehuzl5fg.fsf@nikula.org>\r
+User-Agent: Notmuch/0.11+86~g67f4140 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+Date: Wed, 18 Jan 2012 11:07:42 +0100\r
+Message-ID: <87d3ah8gsx.fsf@praet.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 18 Jan 2012 10:09:33 -0000\r
+\r
+On Mon, 16 Jan 2012 23:10:27 +0200, Jani Nikula <jani@nikula.org> wrote:\r
+> On Mon, 16 Jan 2012 17:46:55 +0100, Pieter Praet <pieter@praet.org> wrote:\r
+> > Make `notmuch-cycle-notmuch-buffers' more Lispy and merge into `notmuch',\r
+> > eliminating the need to hog yet another keybind.\r
+> \r
+> What does "merge" mean here? [...]\r
+\r
+"One function ought to be enough for anybody." ? :) [1]\r
+\r
+\r
+> [...] Will it still be possible for me to hit one\r
+> key to unconditionally get to notmuch-hello, and another to cycle\r
+> through the buffers? I wouldn't want to lose that ability.\r
+> \r
+\r
+Sure, but then your new key should be bound to `notmuch' instead\r
+of `notmuch-cycle-notmuch-buffers', and the key originally bound\r
+to `notmuch' should be remapped to `notmuch-hello'.\r
+\r
+\r
+> > ---\r
+> >  emacs/notmuch.el |   40 ++++++++++++++--------------------------\r
+> >  1 files changed, 14 insertions(+), 26 deletions(-)\r
+> > \r
+> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> > index ef4dcc7..539b3a0 100644\r
+> > --- a/emacs/notmuch.el\r
+> > +++ b/emacs/notmuch.el\r
+> > @@ -1067,7 +1067,20 @@ current search results AND that are tagged with the given tag."\r
+> >  (defun notmuch ()\r
+> >    "Run notmuch and display saved searches, known tags, etc."\r
+> >    (interactive)\r
+> > -  (notmuch-hello))\r
+> > +  (let* ((old-buffer (current-buffer))\r
+> > +   (interesting-buffers\r
+> > +    (delq nil (mapcar (lambda (b)\r
+> > +                        (if (notmuch-interesting-buffer b) b))\r
+> > +                      (buffer-list))))\r
+> > +   (next-buffer (first\r
+> > +    (delq nil (mapcar (lambda (b)\r
+> > +                        (unless (eq old-buffer b) b))\r
+> > +                      interesting-buffers)))))\r
+> > +    (if next-buffer\r
+> > +          (progn\r
+> > +            (switch-to-buffer next-buffer)\r
+> > +            (bury-buffer old-buffer))\r
+> > +      (notmuch-hello))))\r
+> \r
+> notmuch-cycle-notmuch-buffers pretty much explains in the name what it\r
+> does, but additionally it has documentation, and explanatory\r
+> comments. Please don't drop those.\r
+> \r
+\r
+Agreed.\r
+\r
+\r
+Less intrusive patch available [2].\r
+\r
+\r
+> BR,\r
+> Jani\r
+> \r
+> \r
+> \r
+> >  \r
+> >  (defun notmuch-interesting-buffer (b)\r
+> >    "Is the current buffer of interest to a notmuch user?"\r
+> > @@ -1078,31 +1091,6 @@ current search results AND that are tagged with the given tag."\r
+> >                   message-mode))))\r
+> >  \r
+> >  ;;;###autoload\r
+> > -(defun notmuch-cycle-notmuch-buffers ()\r
+> > -  "Cycle through any existing notmuch buffers (search, show or hello).\r
+> > -\r
+> > -If the current buffer is the only notmuch buffer, bury it. If no\r
+> > -notmuch buffers exist, run `notmuch'."\r
+> > -  (interactive)\r
+> > -\r
+> > -  (let (start first)\r
+> > -    ;; If the current buffer is a notmuch buffer, remember it and then\r
+> > -    ;; bury it.\r
+> > -    (when (notmuch-interesting-buffer (current-buffer))\r
+> > -      (setq start (current-buffer))\r
+> > -      (bury-buffer))\r
+> > -\r
+> > -    ;; Find the first notmuch buffer.\r
+> > -    (setq first (loop for buffer in (buffer-list)\r
+> > -               if (notmuch-interesting-buffer buffer)\r
+> > -               return buffer))\r
+> > -\r
+> > -    (if first\r
+> > -  ;; If the first one we found is any other than the starting\r
+> > -  ;; buffer, switch to it.\r
+> > -  (unless (eq first start)\r
+> > -    (switch-to-buffer first))\r
+> > -      (notmuch))))\r
+> >  \r
+> >  (setq mail-user-agent 'notmuch-user-agent)\r
+> >  \r
+> > -- \r
+> > 1.7.8.1\r
+> > \r
+> > _______________________________________________\r
+> > notmuch mailing list\r
+> > notmuch@notmuchmail.org\r
+> > http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+\r
+Peace\r
+\r
+-- \r
+Pieter\r
+\r
+[1] http://www.computerworld.com/s/article/9101699\r
+[2] id:"1326881084-25432-1-git-send-email-pieter@praet.org"\r