[PATCH] emacs: add some convenience functions to show mode
authorJameson Rollins <jrollins@finestructure.net>
Sun, 14 Nov 2010 22:09:01 +0000 (17:09 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:30 +0000 (09:37 -0800)
3d/abc77c654b9857202ccbb198a04c9a4ca2b483 [new file with mode: 0644]

diff --git a/3d/abc77c654b9857202ccbb198a04c9a4ca2b483 b/3d/abc77c654b9857202ccbb198a04c9a4ca2b483
new file mode 100644 (file)
index 0000000..b02868c
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <jrollins@finestructure.net>\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 7418240DDF9\r
+       for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 14:16:46 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9] autolearn=ham\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 gnWaTY8KED9f for <notmuch@notmuchmail.org>;\r
+       Sun, 14 Nov 2010 14:16:36 -0800 (PST)\r
+Received: from tarap.cc.columbia.edu (tarap.cc.columbia.edu [128.59.29.7])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4A7BE40DDCF\r
+       for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 14:16:36 -0800 (PST)\r
+Received: from servo.finestructure.net (cpe-74-66-82-137.nyc.res.rr.com\r
+       [74.66.82.137])\r
+       (user=jgr2110 author=jrollins@finestructure.net mech=PLAIN bits=0)\r
+       by tarap.cc.columbia.edu (8.14.4/8.14.3) with ESMTP id oAEMGYHT001324\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT)\r
+       for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 17:16:35 -0500 (EST)\r
+Received: from jrollins by servo.finestructure.net with local (Exim 4.72)\r
+       (envelope-from <jrollins@finestructure.net>) id 1PHksE-0004hL-8X\r
+       for notmuch@notmuchmail.org; Sun, 14 Nov 2010 17:16:34 -0500\r
+From: Jameson Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH] emacs: add some convenience functions to show mode\r
+Date: Sun, 14 Nov 2010 17:09:01 -0500\r
+Message-ID: <87zktbeekd.fsf@servo.finestructure.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-No-Spam-Score: Local\r
+X-Scanned-By: MIMEDefang 2.68 on 128.59.29.7\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: Sun, 14 Nov 2010 22:16:46 -0000\r
+\r
+Adding three new conveneince functions:\r
+\r
+notmuch-show-next-open-message-or-pop\r
+notmuch-show-next-thread\r
+notmuch-show-previous-thread\r
+\r
+While these are not currently bound to any keys, I have found them to\r
+be very useful for constructing custom key bindings outside of what\r
+notmuch provides by default.  For example:\r
+\r
+(define-key notmuch-show-mode-map "a"\r
+  (lambda ()\r
+    "archive current message and advance"\r
+    (interactive)\r
+    (notmuch-show-remove-tag "inbox")\r
+    (notmuch-show-next-open-message-or-pop)))\r
+(define-key notmuch-show-mode-map "N" 'notmuch-show-next-thread)\r
+(define-key notmuch-show-mode-map "P" 'notmuch-show-previous-thread)\r
+---\r
+ emacs/notmuch-show.el |   39 +++++++++++++++++++++++++++++++++++++++\r
+ 1 files changed, 39 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index b89b685..820fd0e 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -920,6 +920,45 @@ any effects from previous calls to\r
+   (notmuch-show-mark-read)\r
+   (notmuch-show-message-adjust))\r
\r
++(defun notmuch-show-next-open-message-or-pop ()\r
++  "Show the next message or pop out if none remain."\r
++  (interactive)\r
++  (let (r)\r
++    (while (and (setq r (notmuch-show-goto-message-next))\r
++              (not (notmuch-show-message-visible-p))))\r
++    (if r\r
++      (progn\r
++        (notmuch-show-mark-read)\r
++        (notmuch-show-message-adjust))\r
++      (let ((parent-buffer notmuch-show-parent-buffer))\r
++      (if parent-buffer\r
++          (progn\r
++            (kill-this-buffer)\r
++            (switch-to-buffer parent-buffer)\r
++            (forward-line 1)))))))\r
++\r
++(defun notmuch-show-next-thread ()\r
++  "Move to the next thread from the last search."\r
++  (interactive)\r
++  (let ((parent-buffer notmuch-show-parent-buffer))\r
++    (if parent-buffer\r
++      (progn\r
++        (kill-this-buffer)\r
++        (switch-to-buffer parent-buffer)\r
++        (forward-line 1)\r
++        (notmuch-search-show-thread)))))\r
++\r
++(defun notmuch-show-previous-thread ()\r
++  "Move to the previous thread from the last search."\r
++  (interactive)\r
++  (let ((parent-buffer notmuch-show-parent-buffer))\r
++    (if parent-buffer\r
++      (progn\r
++        (kill-this-buffer)\r
++        (switch-to-buffer parent-buffer)\r
++        (forward-line -1)\r
++        (notmuch-search-show-thread)))))\r
++\r
+ (defun notmuch-show-view-raw-message ()\r
+   "View the file holding the current message."\r
+   (interactive)\r
+-- \r
+1.7.2.3\r
+\r