| Submitter | Jesse Rosenthal |
|---|---|
| Date | 2010-02-12 22:19:23 |
| Message ID | <m1wryiayhg.fsf@watt.gilman.jhu.edu> |
| Download | mbox | patch |
| Permalink | /patch/364/ |
| State | New |
| Headers | show |
Comments
May I propose this patch for fast-track inclusion? It makes notmuching much more pleasantly. Thanks for that patch. Sebastian ps. if someone could propose a strategy for a "forward to next unread message" keybinding in a thread, I would be (nearly) completely happy :). pps. I included this one in my feature-all branch.
On Fri, 12 Feb 2010 17:19:23 -0500, Jesse Rosenthal <jrosenthal@jhu.edu> wrote: > 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. A very lovely change, Jesse! Thanks for this (which is now pushed). And again, thanks to Sebastian for guiding the patch through the file renaming. There is one minor issue with this patch which is that viewing an identical thread more than once will bring up a new buffer rather than re-using the existing buffer. But of course, we *want* a separate buffer if the thread-ID is different but the (abbreviated) subject just happens to match. So there would have to be something clever to do the right thing here. I'm not making this minor regression block the patch, since it's so nice otherwise. > This version of the patch improves on the first version by ensuring that > the buffer names are unique, and that the `notmuch-show' command can > still be used interactively. > > Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu> > --- > notmuch.el | 25 +++++++++++++++++++------ > 1 files changed, 19 insertions(+), 6 deletions(-) That last paragraph above is good guidance for understanding the patch, but not useful as part of the permanent commit history. So I removed it before pushing the commit. In the future, you can put text like that *after* the "---" just below your Signed-off-by and then "git am" will automatically ignore it. -Carl
On Wed, 07 Apr 2010 10:46:01 -0700, Carl Worth <cworth@cworth.org> wrote: > A very lovely change, Jesse! Thanks for this (which is now pushed). And > again, thanks to Sebastian for guiding the patch through the file > renaming. Great to hear! Sorry I've been off of email, and still only have sporadic access. However, one question: it looks like it was V2 of the patch that you pushed -- was it? Unfortunately, there was a subtle bug that kept on popping up (when you call notmuch-show interactively, which rarely happens). Later in this same thread, I offered V4 (yep, there was a problematic V3 too) which fixes this: id:876359cz16.fsf@jhu.edu Sorry for posting numerous versions. Quite embarassing. The only difference, as you'll see, is how it deals with the case when buffer-name is not given to notmuch-show as an argument. Thanks for all the pushes, and apologies for the trouble. Best, Jesse
On Fri, 09 Apr 2010 10:01:09 -0400, Jesse Rosenthal <jrosenthal@jhu.edu> wrote: > Great to hear! Sorry I've been off of email, and still only have > sporadic access. However, one question: it looks like it was V2 of the > patch that you pushed -- was it? Unfortunately, there was a subtle bug > that kept on popping up (when you call notmuch-show interactively, which > rarely happens). Later in this same thread, I offered V4 (yep, there was > a problematic V3 too) which fixes this: I do remember seeing several versions of this patch. And I *think* that I did reply v4. > id:876359cz16.fsf@jhu.edu Looking at this patch carefully, I don't see any difference compared to what I applied in commit 9bee20aed34a9ed035b1a0dc89de89af1c65fd1b It seems to work for me on current master when called interactively. But do let me know if there are any additional changes I should apply here. -Carl
On 2010-04-09, Jesse Rosenthal wrote: > sporadic access. However, one question: it looks like it was V2 of the > patch that you pushed -- was it? Unfortunately, there was a subtle bug > that kept on popping up (when you call notmuch-show interactively, which > rarely happens). Later in this same thread, I offered V4 (yep, there was > a problematic V3 too) which fixes this: I think I picked v4 for merging, however removing the comment (supercedes v1-3) from the commit messages. I hope that was ok with you. Sebastian
Patch
diff --git a/notmuch.el b/notmuch.el index 040997e..9667320 100644 --- a/notmuch.el +++ b/notmuch.el @@ -1041,7 +1041,7 @@ All currently available key bindings: (lambda() (hl-line-mode 1) )) -(defun notmuch-show (thread-id &optional parent-buffer query-context) +(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name) "Run \"notmuch show\" with the given thread ID and display results. The optional PARENT-BUFFER is the notmuch-search buffer from @@ -1051,7 +1051,8 @@ thread from that buffer can be show when done with this one). The optional QUERY-CONTEXT is a notmuch search term. Only messages from the thread matching this search term are shown if non-nil. " (interactive "sNotmuch show: ") - (let ((buffer (get-buffer-create (concat "*notmuch-show-" thread-id "*")))) + (let* ((thread-buffer-name (generate-new-buffer-name buffer-name)) + (buffer (get-buffer-create thread-buffer-name))) (switch-to-buffer buffer) (notmuch-show-mode) (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer) @@ -1063,8 +1064,10 @@ matching this search term are shown if non-nil. " (erase-buffer) (goto-char (point-min)) (save-excursion - (let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" thread-id)) - (args (if query-context (append basic-args (list "and (" query-context ")")) basic-args))) + (let* ((basic-args (list notmuch-command nil t nil "show" "--entire-thread" "\'" thread-id)) + (args (if query-context + (append basic-args (list "and (" query-context ")\'")) + (append basic-args (list "\'"))))) (apply 'call-process args) (when (and (eq (buffer-size) 0) query-context) (apply 'call-process basic-args))) @@ -1242,9 +1245,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 ()
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 optionsal `buffer-name' argument to notmuch show. This version of the patch improves on the first version by ensuring that the buffer names are unique, and that the `notmuch-show' command can still be used interactively. Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu> --- notmuch.el | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-)