summaryrefslogtreecommitdiff
path: root/emacs/notmuch.el
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2010-03-06 09:20:21 -0500
committerCarl Worth <cworth@cworth.org>2010-04-07 10:40:06 -0700
commit9bee20aed34a9ed035b1a0dc89de89af1c65fd1b (patch)
tree1a7364786299a1ba72cfde9545ce9fec765290ac /emacs/notmuch.el
parentfbec989fe3272d6eff038369587be076347b96f0 (diff)
notmuch.el: Make notmuch-show buffer name first subject, instead of thread-id (supersedes V1--3)
Change the buffer name to a uniquified subject of the thread (i.e. the subject of the first message in the thread) instead of the thread-id. This is more meaningful to the user, and will make it easier to scroll through numerous open buffers. Note that this patch adds an optional `buffer-name' argument to notmuch show. Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu> Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Diffstat (limited to 'emacs/notmuch.el')
-rw-r--r--emacs/notmuch.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 9ff3767..b32230e 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -411,9 +411,19 @@ Complete list of currently available key bindings:
(defun notmuch-search-show-thread ()
"Display the currently selected thread."
(interactive)
- (let ((thread-id (notmuch-search-find-thread-id)))
+ (let ((thread-id (notmuch-search-find-thread-id))
+ (subject (notmuch-search-find-subject))
+ buffer-name)
+ (when (string-match "^[ \t]*$" subject)
+ (setq subject "[No Subject]"))
+ (setq buffer-name (concat "*"
+ (truncate-string-to-width subject 32 nil nil t)
+ "*"))
(if (> (length thread-id) 0)
- (notmuch-show thread-id (current-buffer) notmuch-search-query-string)
+ (notmuch-show thread-id
+ (current-buffer)
+ notmuch-search-query-string
+ buffer-name)
(error "End of search results"))))
(defun notmuch-search-reply-to-thread ()