|
Pieter Praet |
|
|
* emacs/notmuch-show.el (notmuch-show-open-or-close-all):
Rename to `notmuch-show-toggle-all-messages', and make it toggle visibility of all messages based on the visibility of the current message, instead of setting visibility based on whether or not a prefix arg was supplied. Same functionality, less effort (reaching for 'C-u' is a pain)... --- emacs/notmuch-show.el | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index e6a5b31..2d17f74 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1050,8 +1050,8 @@ thread id. If a prefix is given, crypto processing is toggled." (define-key map "p" 'notmuch-show-previous-open-message) (define-key map (kbd "DEL") 'notmuch-show-rewind) (define-key map " " 'notmuch-show-advance-and-archive) - (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) (define-key map (kbd "RET") 'notmuch-show-toggle-message) + (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages) (define-key map "#" 'notmuch-show-print-message) map) "Keymap for \"notmuch show\" buffers.") @@ -1502,16 +1502,18 @@ the result." (not (plist-get props :message-visible)))) (force-window-update)) -(defun notmuch-show-open-or-close-all () - "Set the visibility all of the messages in the current thread. -By default make all of the messages visible. With a prefix -argument, hide all of the messages." +(defun notmuch-show-toggle-all-messages () + "Toggle the visibility of all messages in the current thread. +If the current message is visible, hide all messages -- and vice versa." (interactive) - (save-excursion - (goto-char (point-min)) - (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) - (not current-prefix-arg)) - until (not (notmuch-show-goto-message-next)))) + (let ((toggle (notmuch-show-message-visible-p))) + (save-excursion + (goto-char (point-min)) + (loop do (notmuch-show-message-visible + (notmuch-show-get-message-properties) + (not toggle)) + until (not (notmuch-show-goto-message-next))))) + (recenter-top-bottom 1) (force-window-update)) (defun notmuch-show-next-button () -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <[hidden email]> wrote:
> * emacs/notmuch-show.el (notmuch-show-open-or-close-all): > Rename to `notmuch-show-toggle-all-messages', and make it toggle > visibility of all messages based on the visibility of the current > message, instead of setting visibility based on whether or not a > prefix arg was supplied. > > Same functionality, less effort (reaching for 'C-u' is a pain)... -1. The behaviour you've provided is not what I want, from two perspectives: - currently it's clear what will happen when I use M-RET or C-uM-RET without me having to think about whether the cursor is over an open message, - often I'll be reading an open message and I want to open all of the rest to look at some context. That's a little more awkward after this change. > > --- > emacs/notmuch-show.el | 22 ++++++++++++---------- > 1 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index e6a5b31..2d17f74 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1050,8 +1050,8 @@ thread id. If a prefix is given, crypto processing is toggled." > (define-key map "p" 'notmuch-show-previous-open-message) > (define-key map (kbd "DEL") 'notmuch-show-rewind) > (define-key map " " 'notmuch-show-advance-and-archive) > - (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) > (define-key map (kbd "RET") 'notmuch-show-toggle-message) > + (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages) > (define-key map "#" 'notmuch-show-print-message) > map) > "Keymap for \"notmuch show\" buffers.") > @@ -1502,16 +1502,18 @@ the result." > (not (plist-get props :message-visible)))) > (force-window-update)) > > -(defun notmuch-show-open-or-close-all () > - "Set the visibility all of the messages in the current thread. > -By default make all of the messages visible. With a prefix > -argument, hide all of the messages." > +(defun notmuch-show-toggle-all-messages () > + "Toggle the visibility of all messages in the current thread. > +If the current message is visible, hide all messages -- and vice versa." > (interactive) > - (save-excursion > - (goto-char (point-min)) > - (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) > - (not current-prefix-arg)) > - until (not (notmuch-show-goto-message-next)))) > + (let ((toggle (notmuch-show-message-visible-p))) > + (save-excursion > + (goto-char (point-min)) > + (loop do (notmuch-show-message-visible > + (notmuch-show-get-message-properties) > + (not toggle)) > + until (not (notmuch-show-goto-message-next))))) > + (recenter-top-bottom 1) > (force-window-update)) > > (defun notmuch-show-next-button () > -- > 1.7.8.1 > > _______________________________________________ > notmuch mailing list > [hidden email] > http://notmuchmail.org/mailman/listinfo/notmuch _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Tomi Ollila-2 |
|
|
On Wed, 25 Jan 2012 06:35:33 +0000, David Edmondson <[hidden email]> wrote:
> On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <[hidden email]> wrote: > > * emacs/notmuch-show.el (notmuch-show-open-or-close-all): > > Rename to `notmuch-show-toggle-all-messages', and make it toggle > > visibility of all messages based on the visibility of the current > > message, instead of setting visibility based on whether or not a > > prefix arg was supplied. > > > > Same functionality, less effort (reaching for 'C-u' is a pain)... > > -1. > > The behaviour you've provided is not what I want, from two perspectives: > - currently it's clear what will happen when I use M-RET or > C-uM-RET without me having to think about whether the cursor > is over an open message, > - often I'll be reading an open message and I want to open all > of the rest to look at some context. That's a little more > awkward after this change. Yes, let's just switch. c-u M-RET to expand and M-RET to collapse (!!!) (Needless to say I've never expanded but often collapsed ;) Tomi _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by David Edmondson
On Wed, 25 Jan 2012 06:35:33 +0000, David Edmondson <[hidden email]> wrote:
> On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <[hidden email]> wrote: > > * emacs/notmuch-show.el (notmuch-show-open-or-close-all): > > Rename to `notmuch-show-toggle-all-messages', and make it toggle > > visibility of all messages based on the visibility of the current > > message, instead of setting visibility based on whether or not a > > prefix arg was supplied. > > > > Same functionality, less effort (reaching for 'C-u' is a pain)... > > -1. > > The behaviour you've provided is not what I want, from two perspectives: > - currently it's clear what will happen when I use M-RET or > C-uM-RET without me having to think about whether the cursor > is over an open message, > - often I'll be reading an open message and I want to open all > of the rest to look at some context. That's a little more > awkward after this change. I may be missing something, but wouldn't both issues be solved by simply pressing M-RET a second time? I've been using this for a little while now, and IMO it makes navigating through long and diverging threads a lot faster, much like zooming in/out on an outline. How about if C-u M-RET behaved as usual ? > > > > --- > > emacs/notmuch-show.el | 22 ++++++++++++---------- > > 1 files changed, 12 insertions(+), 10 deletions(-) > > > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > > index e6a5b31..2d17f74 100644 > > --- a/emacs/notmuch-show.el > > +++ b/emacs/notmuch-show.el > > @@ -1050,8 +1050,8 @@ thread id. If a prefix is given, crypto processing is toggled." > > (define-key map "p" 'notmuch-show-previous-open-message) > > (define-key map (kbd "DEL") 'notmuch-show-rewind) > > (define-key map " " 'notmuch-show-advance-and-archive) > > - (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) > > (define-key map (kbd "RET") 'notmuch-show-toggle-message) > > + (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages) > > (define-key map "#" 'notmuch-show-print-message) > > map) > > "Keymap for \"notmuch show\" buffers.") > > @@ -1502,16 +1502,18 @@ the result." > > (not (plist-get props :message-visible)))) > > (force-window-update)) > > > > -(defun notmuch-show-open-or-close-all () > > - "Set the visibility all of the messages in the current thread. > > -By default make all of the messages visible. With a prefix > > -argument, hide all of the messages." > > +(defun notmuch-show-toggle-all-messages () > > + "Toggle the visibility of all messages in the current thread. > > +If the current message is visible, hide all messages -- and vice versa." > > (interactive) > > - (save-excursion > > - (goto-char (point-min)) > > - (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) > > - (not current-prefix-arg)) > > - until (not (notmuch-show-goto-message-next)))) > > + (let ((toggle (notmuch-show-message-visible-p))) > > + (save-excursion > > + (goto-char (point-min)) > > + (loop do (notmuch-show-message-visible > > + (notmuch-show-get-message-properties) > > + (not toggle)) > > + until (not (notmuch-show-goto-message-next))))) > > + (recenter-top-bottom 1) > > (force-window-update)) > > > > (defun notmuch-show-next-button () > > -- > > 1.7.8.1 > > > > _______________________________________________ > > notmuch mailing list > > [hidden email] > > http://notmuchmail.org/mailman/listinfo/notmuch Peace -- Pieter _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
On Thu, 26 Jan 2012 14:02:15 +0100, Pieter Praet <[hidden email]> wrote:
> I may be missing something, but wouldn't both issues be solved by simply > pressing M-RET a second time? I've been using this for a little while > now, and IMO it makes navigating through long and diverging threads a lot > faster, much like zooming in/out on an outline. > > How about if C-u M-RET behaved as usual ? Okay, I used it for a day and I'm happy that the original patch is good. +2 (which leaves me at +1). _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Tomi Ollila-2 |
|
|
In reply to this post by Pieter Praet
+1 Tomi _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Dmitry Kurochkin |
|
|
In reply to this post by Pieter Praet
Hi Pieter.
On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <[hidden email]> wrote: > * emacs/notmuch-show.el (notmuch-show-open-or-close-all): > Rename to `notmuch-show-toggle-all-messages', and make it toggle > visibility of all messages based on the visibility of the current > message, instead of setting visibility based on whether or not a > prefix arg was supplied. > > Same functionality, less effort (reaching for 'C-u' is a pain)... > > --- > emacs/notmuch-show.el | 22 ++++++++++++---------- > 1 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index e6a5b31..2d17f74 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1050,8 +1050,8 @@ thread id. If a prefix is given, crypto processing is toggled." > (define-key map "p" 'notmuch-show-previous-open-message) > (define-key map (kbd "DEL") 'notmuch-show-rewind) > (define-key map " " 'notmuch-show-advance-and-archive) > - (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) > (define-key map (kbd "RET") 'notmuch-show-toggle-message) > + (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages) Should the function name include "visible" or "visibility" to make it clear what is toggled? E.g. `notmuch-show-toggle-visibility-all'. Also, consider changing "all-messages" to just "all" or "thread". That seems to be more consistent with other functions. > (define-key map "#" 'notmuch-show-print-message) > map) > "Keymap for \"notmuch show\" buffers.") > @@ -1502,16 +1502,18 @@ the result." > (not (plist-get props :message-visible)))) > (force-window-update)) > > -(defun notmuch-show-open-or-close-all () > - "Set the visibility all of the messages in the current thread. > -By default make all of the messages visible. With a prefix > -argument, hide all of the messages." > +(defun notmuch-show-toggle-all-messages () > + "Toggle the visibility of all messages in the current thread. > +If the current message is visible, hide all messages -- and vice versa." > (interactive) > - (save-excursion > - (goto-char (point-min)) > - (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) > - (not current-prefix-arg)) > - until (not (notmuch-show-goto-message-next)))) > + (let ((toggle (notmuch-show-message-visible-p))) Please rename "toggle" to "visible-p". That would make it more clear what the variable means, and is consistent with `notmuch-show-message-visible-p'. > + (save-excursion > + (goto-char (point-min)) > + (loop do (notmuch-show-message-visible > + (notmuch-show-get-message-properties) > + (not toggle)) > + until (not (notmuch-show-goto-message-next))))) A new `notmuch-show-mapc' function was introduced in a recent commit. Please use it here instead of a custom loop. > + (recenter-top-bottom 1) There was no `recenter-top-bottom' call before. Why is it needed now? It seems like an independent change and, if it is needed, would be better as a separate patch. At the very least, it's worth mentioning in the preamble and perhaps in a comment. Regards, Dmitry > (force-window-update)) > > (defun notmuch-show-next-button () > -- > 1.7.8.1 > > _______________________________________________ > notmuch mailing list > [hidden email] > http://notmuchmail.org/mailman/listinfo/notmuch notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
On Mon, 13 Feb 2012 14:51:17 +0400, Dmitry Kurochkin <[hidden email]> wrote:
> Hi Pieter. > > On Wed, 25 Jan 2012 06:25:39 +0100, Pieter Praet <[hidden email]> wrote: > > * emacs/notmuch-show.el (notmuch-show-open-or-close-all): > > Rename to `notmuch-show-toggle-all-messages', and make it toggle > > visibility of all messages based on the visibility of the current > > message, instead of setting visibility based on whether or not a > > prefix arg was supplied. > > > > Same functionality, less effort (reaching for 'C-u' is a pain)... > > > > --- > > emacs/notmuch-show.el | 22 ++++++++++++---------- > > 1 files changed, 12 insertions(+), 10 deletions(-) > > > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > > index e6a5b31..2d17f74 100644 > > --- a/emacs/notmuch-show.el > > +++ b/emacs/notmuch-show.el > > @@ -1050,8 +1050,8 @@ thread id. If a prefix is given, crypto processing is toggled." > > (define-key map "p" 'notmuch-show-previous-open-message) > > (define-key map (kbd "DEL") 'notmuch-show-rewind) > > (define-key map " " 'notmuch-show-advance-and-archive) > > - (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) > > (define-key map (kbd "RET") 'notmuch-show-toggle-message) > > + (define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages) > > Should the function name include "visible" or "visibility" to make it > clear what is toggled? E.g. `notmuch-show-toggle-visibility-all'. > > Also, consider changing "all-messages" to just "all" or "thread". That > seems to be more consistent with other functions. > Good point, but we also have `notmuch-show-toggle-message' and `notmuch-show-toggle-headers', so `notmuch-show-toggle-visibility-all' would imply that both messages as well as headers are toggled. Also, `notmuch-show-toggle-visibility-thread' sounds to me like it would toggle the thread itself instead of the messages of which it is composed, so my personal expectation would be that it just blanks the entire buffer. (what's in a name....) How about renaming the relevant functions like so: - `notmuch-show-toggle-headers' -> `notmuch-show-toggle-visibility-headers' - `notmuch-show-toggle-message' -> `notmuch-show-toggle-visibility-message' - `notmuch-show-open-or-close-all' -> `notmuch-show-toggle-visibility-messages' > > (define-key map "#" 'notmuch-show-print-message) > > map) > > "Keymap for \"notmuch show\" buffers.") > > @@ -1502,16 +1502,18 @@ the result." > > (not (plist-get props :message-visible)))) > > (force-window-update)) > > > > -(defun notmuch-show-open-or-close-all () > > - "Set the visibility all of the messages in the current thread. > > -By default make all of the messages visible. With a prefix > > -argument, hide all of the messages." > > +(defun notmuch-show-toggle-all-messages () > > + "Toggle the visibility of all messages in the current thread. > > +If the current message is visible, hide all messages -- and vice versa." > > (interactive) > > - (save-excursion > > - (goto-char (point-min)) > > - (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) > > - (not current-prefix-arg)) > > - until (not (notmuch-show-goto-message-next)))) > > + (let ((toggle (notmuch-show-message-visible-p))) > > Please rename "toggle" to "visible-p". That would make it more clear > what the variable means, and is consistent with > `notmuch-show-message-visible-p'. > AFAIK the '-p' suffix is "reserved" for predicate functions, and using it for a variable could be confusing. But I'm not aware of any guidelines on indicating the variable type except when it stores one or more functions [1,2]... Perhaps we could call it `visible-bool' ? Anyways, I've gone with your suggestion: `visible-p' it is... > > + (save-excursion > > + (goto-char (point-min)) > > + (loop do (notmuch-show-message-visible > > + (notmuch-show-get-message-properties) > > + (not toggle)) > > + until (not (notmuch-show-goto-message-next))))) > > A new `notmuch-show-mapc' function was introduced in a recent commit. > Please use it here instead of a custom loop. > Nice! > > + (recenter-top-bottom 1) > > There was no `recenter-top-bottom' call before. Why is it needed now? > It seems like an independent change and, if it is needed, would be > better as a separate patch. At the very least, it's worth mentioning in > the preamble and perhaps in a comment. > It ensures that the message being uncollapsed is put properly in view (instead of starting somewhere in the middle of the buffer) whilst also making it obvious that/if/when there's previous messages in the thread (due to its argument being 1 instead of 0). I thought about using `notmuch-show-message-adjust' instead, but that obscures the fact that there's previous messages. As it's quite essential in making the function DTRT, I've opted to clarify it in a comment as well as the commit message instead of splitting it out into a separate patch. > Regards, > Dmitry > > > (force-window-update)) > > > > (defun notmuch-show-next-button () > > -- > > 1.7.8.1 > > > > _______________________________________________ > > notmuch mailing list > > [hidden email] > > http://notmuchmail.org/mailman/listinfo/notmuch So... I've expanded the test suite to cover everything I might be breaking, renamed the toggle functions to be consistent, and addressed all your comments in some way or another. I've also thrown in a bonus patch which is *not* meant to be applied (WIP, should eventually provide functionality similar to `notmuch-search-filter{,-by-tag}'). Patches follow. Peace -- Pieter [1] http://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html [2] http://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks.html _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Pieter Praet
* test/emacs:
- New subtest "notmuch-show: show message headers": Setting `notmuch-message-headers-visible' to t causes all headers defined in `notmuch-message-headers' to be shown. - New subtest "notmuch-show: hide message headers": Setting `notmuch-message-headers-visible' to nil causes all headers defined in `notmuch-message-headers' to be hidden. ("Subject:" may be an exception; See the use of `headers-start' in `notmuch-show-insert-msg') - New subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)": Setting `notmuch-message-headers-visible' to t causes all headers defined in `notmuch-message-headers' to be shown, but they can be hidden for the current message by running `notmuch-show-toggle-headers'. --- test/emacs | 25 ++++++++++++++++++++ .../notmuch-show-message-with-headers-hidden | 22 +++++++++++++++++ .../notmuch-show-message-with-headers-visible | 25 ++++++++++++++++++++ 3 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 test/emacs.expected-output/notmuch-show-message-with-headers-hidden create mode 100644 test/emacs.expected-output/notmuch-show-message-with-headers-visible diff --git a/test/emacs b/test/emacs index b74cfa9..f9ea1c3 100755 --- a/test/emacs +++ b/test/emacs @@ -383,6 +383,31 @@ test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail. (test-visible-output)' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages +test_begin_subtest "notmuch-show: show message headers" +test_emacs \ + '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date")) + (notmuch-message-headers-visible t)) + (notmuch-show "id:[hidden email]") + (test-visible-output))' +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-visible + +test_begin_subtest "notmuch-show: hide message headers" +test_emacs \ + '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date")) + (notmuch-message-headers-visible nil)) + (notmuch-show "id:[hidden email]") + (test-visible-output))' +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden + +test_begin_subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)" +test_emacs \ + '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date")) + (notmuch-message-headers-visible t)) + (notmuch-show "id:[hidden email]") + (notmuch-show-toggle-headers) + (test-visible-output))' +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden + test_begin_subtest "Stashing in notmuch-show" add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \ '[from]="Some One <[hidden email]>"' \ diff --git a/test/emacs.expected-output/notmuch-show-message-with-headers-hidden b/test/emacs.expected-output/notmuch-show-message-with-headers-hidden new file mode 100644 index 0000000..9d7f91b --- /dev/null +++ b/test/emacs.expected-output/notmuch-show-message-with-headers-hidden @@ -0,0 +1,22 @@ +Jan Janak <[hidden email]> (2009-11-17) (inbox unread) +Subject: [notmuch] What a great idea! + Jan Janak <[hidden email]> (2009-11-17) (inbox) + + On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak <jan at ryngle.com> wrote: + > Hello, + > + > First of all, notmuch is a wonderful idea, both the cmdline tool and + [ 2 more citation lines. Click/Enter to show. ] + > + > Have you considered sending an announcement to the org-mode mailing list? + > http://org-mode.org + + Sorry, wrong URL, the correct one is: http://orgmode.org + + > Various ways of searching/referencing emails from emacs were discussed + > there several times and none of them were as elegant as notmuch (not + > even close). Maybe notmuch would attract some of the developers + > there.. + + -- Jan + Carl Worth <[hidden email]> (2009-11-18) (inbox unread) diff --git a/test/emacs.expected-output/notmuch-show-message-with-headers-visible b/test/emacs.expected-output/notmuch-show-message-with-headers-visible new file mode 100644 index 0000000..8efbd60 --- /dev/null +++ b/test/emacs.expected-output/notmuch-show-message-with-headers-visible @@ -0,0 +1,25 @@ +Jan Janak <[hidden email]> (2009-11-17) (inbox unread) +Subject: [notmuch] What a great idea! + Jan Janak <[hidden email]> (2009-11-17) (inbox) + Subject: [notmuch] What a great idea! + To: [hidden email] + Date: Tue, 17 Nov 2009 23:38:47 +0100 + + On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak <jan at ryngle.com> wrote: + > Hello, + > + > First of all, notmuch is a wonderful idea, both the cmdline tool and + [ 2 more citation lines. Click/Enter to show. ] + > + > Have you considered sending an announcement to the org-mode mailing list? + > http://org-mode.org + + Sorry, wrong URL, the correct one is: http://orgmode.org + + > Various ways of searching/referencing emails from emacs were discussed + > there several times and none of them were as elegant as notmuch (not + > even close). Maybe notmuch would attract some of the developers + > there.. + + -- Jan + Carl Worth <[hidden email]> (2009-11-18) (inbox unread) -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Pieter Praet
* test/emacs:
- New subtest "notmuch-show: collapse all messages in thread": `notmuch-show-open-or-close-all' with prefix arg ("C-u M-RET") collapses all messages in thread. - New subtest "notmuch-show: uncollapse all messages in thread": `notmuch-show-open-or-close-all' without prefix arg ("M-RET") uncollapses all messages in thread. --- test/emacs | 13 +++ ...notmuch-show-thread-with-all-messages-collapsed | 4 + ...tmuch-show-thread-with-all-messages-uncollapsed | 79 ++++++++++++++++++++ 3 files changed, 96 insertions(+), 0 deletions(-) create mode 100644 test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed create mode 100644 test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed diff --git a/test/emacs b/test/emacs index f9ea1c3..7d6e6ee 100755 --- a/test/emacs +++ b/test/emacs @@ -408,6 +408,19 @@ test_emacs \ (test-visible-output))' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden +test_begin_subtest "notmuch-show: collapse all messages in thread" +test_emacs '(notmuch-show "id:[hidden email]") + (let ((current-prefix-arg t)) + (notmuch-show-open-or-close-all) + (test-visible-output))' +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-collapsed + +test_begin_subtest "notmuch-show: uncollapse all messages in thread" +test_emacs '(notmuch-show "id:[hidden email]") + (notmuch-show-open-or-close-all) + (test-visible-output)' +test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed + test_begin_subtest "Stashing in notmuch-show" add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \ '[from]="Some One <[hidden email]>"' \ diff --git a/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed new file mode 100644 index 0000000..73b0e60 --- /dev/null +++ b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-collapsed @@ -0,0 +1,4 @@ +Jan Janak <[hidden email]> (2009-11-17) (inbox) +Subject: [notmuch] What a great idea! + Jan Janak <[hidden email]> (2009-11-17) (inbox) + Carl Worth <[hidden email]> (2009-11-18) (inbox unread) diff --git a/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed new file mode 100644 index 0000000..bd5598e --- /dev/null +++ b/test/emacs.expected-output/notmuch-show-thread-with-all-messages-uncollapsed @@ -0,0 +1,79 @@ +Jan Janak <[hidden email]> (2009-11-17) (inbox) +Subject: [notmuch] What a great idea! +To: [hidden email] +Date: Tue, 17 Nov 2009 23:35:30 +0100 + +Hello, + +First of all, notmuch is a wonderful idea, both the cmdline tool and +the emacs interface! Thanks a lot for writing it, I was really excited +when I read the announcement today. + +Have you considered sending an announcement to the org-mode mailing list? +http://org-mode.org + +Various ways of searching/referencing emails from emacs were discussed +there several times and none of them were as elegant as notmuch (not +even close). Maybe notmuch would attract some of the developers +there.. + + -- Jan + Jan Janak <[hidden email]> (2009-11-17) (inbox) + Subject: [notmuch] What a great idea! + To: [hidden email] + Date: Tue, 17 Nov 2009 23:38:47 +0100 + + On Tue, Nov 17, 2009 at 11:35 PM, Jan Janak <jan at ryngle.com> wrote: + > Hello, + > + > First of all, notmuch is a wonderful idea, both the cmdline tool and + [ 2 more citation lines. Click/Enter to show. ] + > + > Have you considered sending an announcement to the org-mode mailing list? + > http://org-mode.org + + Sorry, wrong URL, the correct one is: http://orgmode.org + + > Various ways of searching/referencing emails from emacs were discussed + > there several times and none of them were as elegant as notmuch (not + > even close). Maybe notmuch would attract some of the developers + > there.. + + -- Jan + Carl Worth <[hidden email]> (2009-11-18) (inbox unread) + Subject: [notmuch] What a great idea! + To: [hidden email] + Date: Wed, 18 Nov 2009 02:49:52 -0800 + + On Tue, 17 Nov 2009 23:35:30 +0100, Jan Janak <jan at ryngle.com> wrote: + > First of all, notmuch is a wonderful idea, both the cmdline tool and + > the emacs interface! Thanks a lot for writing it, I was really excited + > when I read the announcement today. + + Ah, here's where I planned a nice welcome. So welcome (again), Jan! :-) + + I've been having a lot of fun with notmuch already, (though there have + been some days of pain before it was functional enough and my + email-reply latency went way up). But regardless---I got through that, + and I'm able to work more efficiently with notmuch now than I could with + sup before. So I'm happy. + + And I'm delighted when other people find this interesting as well. + + > Have you considered sending an announcement to the org-mode mailing list? + > http://orgmode.org + + Thanks for the idea. I think I may have looked into org-mode years ago, + (when I was investigating planner-mode and various emacs "personal wiki" + systems for keeping random notes and what-not). + + > Various ways of searching/referencing emails from emacs were discussed + > there several times and none of them were as elegant as notmuch (not + > even close). Maybe notmuch would attract some of the developers + > there.. + + Yeah. I'll drop them a mail. Having a real emacs wizard on board would + be nice. (I'm afraid the elisp I've written so far for this project is + fairly grim.) + + -Carl -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Pieter Praet
* emacs/notmuch-show.el
(notmuch-show-toggle-headers): Rename to `notmuch-show-toggle-visibility-headers'. (notmuch-show-mode-map): Update "h" binding wrt renamed `notmuch-show-toggle-headers'. (notmuch-message-headers): Update docstring wrt renamed `notmuch-show-toggle-headers'. (notmuch-message-headers-visible): Update docstring wrt renamed `notmuch-show-toggle-headers'. Also fixed a small typo. * test/emacs: Update subtest wrt renamed `notmuch-show-toggle-headers': - "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)" --- emacs/notmuch-show.el | 12 ++++++------ test/emacs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index aa9ccee..861018d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -48,8 +48,8 @@ (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date") For an open message, all of these headers will be made visible according to `notmuch-message-headers-visible' or can be toggled -with `notmuch-show-toggle-headers'. For a closed message, only -the first header in the list will be visible." +with `notmuch-show-toggle-visibility-headers'. For a closed message, +only the first header in the list will be visible." :type '(repeat string) :group 'notmuch-show) @@ -59,8 +59,8 @@ (defcustom notmuch-message-headers-visible t If this value is non-nil, then all of the headers defined in `notmuch-message-headers' will be visible by default in the display of each message. Otherwise, these headers will be hidden and -`notmuch-show-toggle-headers' can be used to make the visible for -any given message." +`notmuch-show-toggle-visibility-headers' can be used to make them +visible for any given message." :type 'boolean :group 'notmuch-show) @@ -1168,7 +1168,7 @@ (defvar notmuch-show-mode-map (define-key map "v" 'notmuch-show-view-all-mime-parts) (define-key map "c" 'notmuch-show-stash-map) (define-key map "=" 'notmuch-show-refresh-view) - (define-key map "h" 'notmuch-show-toggle-headers) + (define-key map "h" 'notmuch-show-toggle-visibility-headers) (define-key map "*" 'notmuch-show-tag-all) (define-key map "-" 'notmuch-show-remove-tag) (define-key map "+" 'notmuch-show-add-tag) @@ -1650,7 +1650,7 @@ (defun notmuch-show-remove-tag () (interactive) (notmuch-show-tag "-")) -(defun notmuch-show-toggle-headers () +(defun notmuch-show-toggle-visibility-headers () "Toggle the visibility of the current message headers." (interactive) (let ((props (notmuch-show-get-message-properties))) diff --git a/test/emacs b/test/emacs index 7d6e6ee..f17efbd 100755 --- a/test/emacs +++ b/test/emacs @@ -399,12 +399,12 @@ test_emacs \ (test-visible-output))' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden -test_begin_subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-headers)" +test_begin_subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-visibility-headers)" test_emacs \ '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date")) (notmuch-message-headers-visible t)) (notmuch-show "id:[hidden email]") - (notmuch-show-toggle-headers) + (notmuch-show-toggle-visibility-headers) (test-visible-output))' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Pieter Praet
* emacs/notmuch-show.el
(notmuch-show-toggle-message): Rename to `notmuch-show-toggle-visibility-message'. (notmuch-show-mode-map): Update "RET" binding wrt renamed `notmuch-show-toggle-message'. * test/emacs: Update subtests wrt renamed `notmuch-show-toggle-message': - "Hiding message in notmuch-show view" - "Hiding message with visible citation in notmuch-show view" - "Refresh modified show buffer" --- emacs/notmuch-show.el | 4 ++-- test/emacs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 861018d..9b879c7 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1183,7 +1183,7 @@ (defvar notmuch-show-mode-map (define-key map (kbd "DEL") 'notmuch-show-rewind) (define-key map " " 'notmuch-show-advance-and-archive) (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) - (define-key map (kbd "RET") 'notmuch-show-toggle-message) + (define-key map (kbd "RET") 'notmuch-show-toggle-visibility-message) (define-key map "#" 'notmuch-show-print-message) (define-key map "!" 'notmuch-show-toggle-elide-non-matching) (define-key map "$" 'notmuch-show-toggle-process-crypto) @@ -1659,7 +1659,7 @@ (defun notmuch-show-toggle-visibility-headers () (not (plist-get props :headers-visible)))) (force-window-update)) -(defun notmuch-show-toggle-message () +(defun notmuch-show-toggle-visibility-message () "Toggle the visibility of the current message." (interactive) (let ((props (notmuch-show-get-message-properties))) diff --git a/test/emacs b/test/emacs index f17efbd..6f14895 100755 --- a/test/emacs +++ b/test/emacs @@ -371,7 +371,7 @@ test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Hiding message in notmuch-show view" test_emacs '(notmuch-show "id:[hidden email]") - (notmuch-show-toggle-message) + (notmuch-show-toggle-visibility-message) (test-visible-output)' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages @@ -379,7 +379,7 @@ test_begin_subtest "Hiding message with visible citation in notmuch-show view" test_emacs '(notmuch-show "id:[hidden email]") (search-forward "Click/Enter to show.") (button-activate (button-at (point))) - (notmuch-show-toggle-message) + (notmuch-show-toggle-visibility-message) (test-visible-output)' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages @@ -496,9 +496,9 @@ test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Refresh modified show buffer" test_subtest_known_broken test_emacs '(notmuch-show "id:[hidden email]") - (notmuch-show-toggle-message) + (notmuch-show-toggle-visibility-message) (notmuch-show-next-message) - (notmuch-show-toggle-message) + (notmuch-show-toggle-visibility-message) (test-visible-output "EXPECTED") (notmuch-show-refresh-view) (test-visible-output)' -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Pieter Praet
* emacs/notmuch-show.el
(notmuch-show-open-or-close-all): Rename to `notmuch-show-toggle-visibility-messages'. (notmuch-show-mode-map): Update "M-RET" binding wrt renamed `notmuch-show-open-or-close-all'. * test/emacs: Update subtests wrt renamed `notmuch-show-open-or-close-all': - "notmuch-show: collapse all messages in thread" - "notmuch-show: uncollapse all messages in thread" --- emacs/notmuch-show.el | 4 ++-- test/emacs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 9b879c7..e4d1f9c 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1182,8 +1182,8 @@ (defvar notmuch-show-mode-map (define-key map "p" 'notmuch-show-previous-open-message) (define-key map (kbd "DEL") 'notmuch-show-rewind) (define-key map " " 'notmuch-show-advance-and-archive) - (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all) (define-key map (kbd "RET") 'notmuch-show-toggle-visibility-message) + (define-key map (kbd "M-RET") 'notmuch-show-toggle-visibility-messages) (define-key map "#" 'notmuch-show-print-message) (define-key map "!" 'notmuch-show-toggle-elide-non-matching) (define-key map "$" 'notmuch-show-toggle-process-crypto) @@ -1668,7 +1668,7 @@ (defun notmuch-show-toggle-visibility-message () (not (plist-get props :message-visible)))) (force-window-update)) -(defun notmuch-show-open-or-close-all () +(defun notmuch-show-toggle-visibility-messages () "Set the visibility all of the messages in the current thread. By default make all of the messages visible. With a prefix argument, hide all of the messages." diff --git a/test/emacs b/test/emacs index 6f14895..29fdec0 100755 --- a/test/emacs +++ b/test/emacs @@ -411,13 +411,13 @@ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden test_begin_subtest "notmuch-show: collapse all messages in thread" test_emacs '(notmuch-show "id:[hidden email]") (let ((current-prefix-arg t)) - (notmuch-show-open-or-close-all) + (notmuch-show-toggle-visibility-messages) (test-visible-output))' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-collapsed test_begin_subtest "notmuch-show: uncollapse all messages in thread" test_emacs '(notmuch-show "id:[hidden email]") - (notmuch-show-open-or-close-all) + (notmuch-show-toggle-visibility-messages) (test-visible-output)' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Pieter Praet
* emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):
Toggle visibility of all messages in current thread based on visibility of the current message, instead of setting visibility based on whether or not a prefix arg was supplied. Also move current buffer line to the 2nd window line so the current message is put properly into focus, whilst making the presence of previous messages in the thread obvious. Same functionality, less effort (reaching for 'C-u' is a pain)... --- emacs/notmuch-show.el | 20 ++++++++++++-------- test/emacs | 6 +++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index e4d1f9c..82d4265 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1669,15 +1669,19 @@ (defun notmuch-show-toggle-visibility-message () (force-window-update)) (defun notmuch-show-toggle-visibility-messages () - "Set the visibility all of the messages in the current thread. -By default make all of the messages visible. With a prefix -argument, hide all of the messages." + "Toggle the visibility of all messages in the current thread. +If the current message is visible, hide all messages -- and vice versa." (interactive) - (save-excursion - (goto-char (point-min)) - (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) - (not current-prefix-arg)) - until (not (notmuch-show-goto-message-next)))) + (let ((visible-p (notmuch-show-message-visible-p))) + (notmuch-show-mapc + (lambda () (notmuch-show-message-visible + (notmuch-show-get-message-properties) + (not visible-p))))) + + ;; Put the current message properly into focus, but don't + ;; obscure the presence of previous messages in the thread. + (recenter-top-bottom 1) + (force-window-update)) (defun notmuch-show-next-button () diff --git a/test/emacs b/test/emacs index 29fdec0..5c61743 100755 --- a/test/emacs +++ b/test/emacs @@ -410,14 +410,14 @@ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden test_begin_subtest "notmuch-show: collapse all messages in thread" test_emacs '(notmuch-show "id:[hidden email]") - (let ((current-prefix-arg t)) - (notmuch-show-toggle-visibility-messages) - (test-visible-output))' + (notmuch-show-toggle-visibility-messages) + (test-visible-output)' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-collapsed test_begin_subtest "notmuch-show: uncollapse all messages in thread" test_emacs '(notmuch-show "id:[hidden email]") (notmuch-show-toggle-visibility-messages) + (notmuch-show-toggle-visibility-messages) (test-visible-output)' test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Pieter Praet
* emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):
When provided with a prefix arg, prompt the user for a tag. Show all messages that have it and hide those that don't. --- emacs/notmuch-show.el | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 82d4265..b5e482b 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -38,6 +38,7 @@ (declare-function notmuch-call-notmuch-process "notmuch" (&rest args)) (declare-function notmuch-fontify-headers "notmuch" nil) +(declare-function notmuch-select-tag-with-completion "notmuch" (prompt &rest search-terms)) (declare-function notmuch-read-tag-changes "notmuch" (&optional initial-input &rest search-terms)) (declare-function notmuch-search-next-thread "notmuch" nil) (declare-function notmuch-search-show-thread "notmuch" nil) @@ -1670,13 +1671,19 @@ (defun notmuch-show-toggle-visibility-message () (defun notmuch-show-toggle-visibility-messages () "Toggle the visibility of all messages in the current thread. -If the current message is visible, hide all messages -- and vice versa." +If the current message is visible, hide all messages -- and vice versa. + +With a prefix argument, prompt for a tag and only show messages which have it." (interactive) - (let ((visible-p (notmuch-show-message-visible-p))) + (let ((visible-p (notmuch-show-message-visible-p)) + (filter (if current-prefix-arg + (notmuch-select-tag-with-completion "Filter by tag: ")))) (notmuch-show-mapc (lambda () (notmuch-show-message-visible (notmuch-show-get-message-properties) - (not visible-p))))) + (if current-prefix-arg + (member filter (notmuch-show-get-tags)) + (not visible-p)))))) ;; Put the current message properly into focus, but don't ;; obscure the presence of previous messages in the thread. -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
| Powered by Nabble | See how NAML generates this page |