[PATCH] [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into `notmuch'
authorPieter Praet <pieter@praet.org>
Mon, 16 Jan 2012 10:42:31 +0000 (11:42 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:14 +0000 (09:42 -0800)
0f/76bb1c04d22368694aee574a03023535930534 [new file with mode: 0644]

diff --git a/0f/76bb1c04d22368694aee574a03023535930534 b/0f/76bb1c04d22368694aee574a03023535930534
new file mode 100644 (file)
index 0000000..1cb4287
--- /dev/null
@@ -0,0 +1,117 @@
+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 75BE6431E64\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:44:26 -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 kktGsQ8Rm3Io for <notmuch@notmuchmail.org>;\r
+       Mon, 16 Jan 2012 02:44:26 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D43B2431FC0\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:44:25 -0800 (PST)\r
+Received: by wibhr12 with SMTP id hr12so2269757wib.26\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:44:24 -0800 (PST)\r
+Received: by 10.180.85.4 with SMTP id d4mr18522588wiz.0.1326710664720;\r
+       Mon, 16 Jan 2012 02:44:24 -0800 (PST)\r
+Received: from localhost ([109.131.75.86])\r
+       by mx.google.com with ESMTPS id fv6sm33219738wib.8.2012.01.16.02.44.24\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 16 Jan 2012 02:44:24 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: David Edmondson <dme@dme.org>,\r
+       Austin Clements <amdragon@MIT.EDU>\r
+Subject: [PATCH] [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers'\r
+       into `notmuch'\r
+Date: Mon, 16 Jan 2012 11:42:31 +0100\r
+Message-Id: <1326710551-23122-1-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.8.1\r
+In-Reply-To: <cunpqek597g.fsf@hotblack-desiato.hh.sledj.net>\r
+References: <cunpqek597g.fsf@hotblack-desiato.hh.sledj.net>\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: Mon, 16 Jan 2012 10:44:26 -0000\r
+\r
+CLisp'ier version of `notmuch-cycle-notmuch-buffers', merged into `notmuch',\r
+eliminating the need to hog yet another keybind.\r
+\r
+FYI: causes 2 compile warnings due to requiring the cl package at runtime.\r
+---\r
+ emacs/notmuch.el |   34 ++++++++--------------------------\r
+ 1 files changed, 8 insertions(+), 26 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index ef4dcc7..60ab0b2 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -1067,7 +1067,14 @@ 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 (remove-if-not #'notmuch-interesting-buffer (buffer-list)))\r
++       (next-buffer (first (member-if-not #'(lambda (b) (eq old-buffer b)) interesting-buffers))))\r
++    (if next-buffer\r
++      (progn\r
++        (switch-to-buffer next-buffer)\r
++        (bury-buffer old-buffer))\r
++      (notmuch-hello))))\r
\r
+ (defun notmuch-interesting-buffer (b)\r
+   "Is the current buffer of interest to a notmuch user?"\r
+@@ -1078,31 +1085,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