[notmuch] [PATCH] notmuch.el: Make notmuch-show buffer name first subject, instead...
authorJesse Rosenthal <jrosenthal@jhu.edu>
Fri, 12 Feb 2010 17:10:41 +0000 (12:10 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:12 +0000 (09:36 -0800)
81/36ddb01ba85ef4a7e4f3a55a3fe963b7cee564 [new file with mode: 0644]

diff --git a/81/36ddb01ba85ef4a7e4f3a55a3fe963b7cee564 b/81/36ddb01ba85ef4a7e4f3a55a3fe963b7cee564
new file mode 100644 (file)
index 0000000..52c9f08
--- /dev/null
@@ -0,0 +1,125 @@
+Return-Path: <prvs=jrosenthal=65281eaca@jhu.edu>\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 6DB08431FBC\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Feb 2010 10:24:15 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.929\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.929 tagged_above=-999 required=5 tests=[AWL=1.070,\r
+       BAYES_50=0.001, RCVD_IN_DNSWL_MED=-4] 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 VA4x8UoGdz+p for <notmuch@notmuchmail.org>;\r
+       Fri, 12 Feb 2010 10:24:14 -0800 (PST)\r
+X-Greylist: delayed 3602 seconds by postgrey-1.32 at olra;\r
+       Fri, 12 Feb 2010 10:24:14 PST\r
+Received: from ipex3.johnshopkins.edu (ipex3.johnshopkins.edu\r
+       [128.220.161.140])\r
+       by olra.theworths.org (Postfix) with ESMTP id A498B431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Feb 2010 10:24:14 -0800 (PST)\r
+X-IronPort-Anti-Spam-Filtered: true\r
+X-IronPort-Anti-Spam-Result:\r
+ ApAFALsddUuA3DZF/2dsb2JhbACPRAGLPHSzS4QxiFWEWASDEw\r
+X-IronPort-AV: E=Sophos;i="4.49,462,1262581200"; d="scan'208";a="349840089"\r
+Received: from watt.gilman.jhu.edu ([128.220.54.69])\r
+       by ipex3.johnshopkins.edu with ESMTP/TLS/ADH-AES256-SHA;\r
+       12 Feb 2010 12:24:11 -0500\r
+Received: by watt.gilman.jhu.edu (Postfix, from userid 502)\r
+       id 859BC3FBE66; Fri, 12 Feb 2010 12:24:10 -0500 (EST)\r
+From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+To: notmuch@notmuchmail.org\r
+Date: Fri, 12 Feb 2010 12:10:41 -0500\r
+Message-ID: <m1y6iybc5h.fsf@watt.gilman.jhu.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Subject: [notmuch] [PATCH] notmuch.el: Make notmuch-show buffer name first\r
+       subject, instead of thread-id\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: Fri, 12 Feb 2010 18:24:15 -0000\r
+\r
+\r
+Change the buffer name to the subject of the thread instead of\r
+the thread-id. This is more meaningful to the user, and will make it easier\r
+to scroll through numerous open buffers.\r
+\r
+Note that this patch adds a required `buffer-name' argument to notmuch-show.\r
+\r
+Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+---\r
+ notmuch.el |   24 ++++++++++++++++++------\r
+ 1 files changed, 18 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/notmuch.el b/notmuch.el\r
+index 040997e..fbf547e 100644\r
+--- a/notmuch.el\r
++++ b/notmuch.el\r
+@@ -1041,7 +1041,7 @@ All currently available key bindings:\r
+         (lambda()\r
+           (hl-line-mode 1) ))\r
\r
+-(defun notmuch-show (thread-id &optional parent-buffer query-context)\r
++(defun notmuch-show (thread-id buffer-name &optional parent-buffer query-context)\r
+   "Run \"notmuch show\" with the given thread ID and display results.\r
\r
+ The optional PARENT-BUFFER is the notmuch-search buffer from\r
+@@ -1051,7 +1051,7 @@ thread from that buffer can be show when done with this one).\r
+ The optional QUERY-CONTEXT is a notmuch search term. Only messages from the thread\r
+ matching this search term are shown if non-nil. "\r
+   (interactive "sNotmuch show: ")\r
+-  (let ((buffer (get-buffer-create (concat "*notmuch-show-" thread-id "*"))))\r
++  (let ((buffer (get-buffer-create buffer-name)))\r
+     (switch-to-buffer buffer)\r
+     (notmuch-show-mode)\r
+     (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)\r
+@@ -1063,8 +1063,10 @@ matching this search term are shown if non-nil. "\r
+       (erase-buffer)\r
+       (goto-char (point-min))\r
+       (save-excursion\r
+-      (let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" thread-id))\r
+-              (args (if query-context (append basic-args (list "and (" query-context ")")) basic-args)))\r
++      (let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" "\'" thread-id))\r
++              (args (if query-context\r
++                        (append basic-args (list "and (" query-context ")\'"))\r
++                      (append basic-args (list "\'")))))\r
+         (apply 'call-process args)\r
+         (when (and (eq (buffer-size) 0) query-context)\r
+           (apply 'call-process basic-args)))\r
+@@ -1242,9 +1244,19 @@ Complete list of currently available key bindings:\r
+ (defun notmuch-search-show-thread ()\r
+   "Display the currently selected thread."\r
+   (interactive)\r
+-  (let ((thread-id (notmuch-search-find-thread-id)))\r
++  (let ((thread-id (notmuch-search-find-thread-id))\r
++      (subject (notmuch-search-find-subject))\r
++      buffer-name)\r
++    (when (string-match "^[ \t]*$" subject)\r
++      (setq subject "[No Subject]"))\r
++    (setq buffer-name (concat "*"\r
++                            (truncate-string-to-width subject 32 nil nil t)\r
++                            "*"))\r
+     (if (> (length thread-id) 0)\r
+-      (notmuch-show thread-id (current-buffer) notmuch-search-query-string)\r
++      (notmuch-show thread-id\r
++                    buffer-name\r
++                    (current-buffer)\r
++                    notmuch-search-query-string)\r
+       (error "End of search results"))))\r
\r
+ (defun notmuch-search-reply-to-thread ()\r
+-- \r
+1.6.5.3\r
+\r