* (no subject)
@ 2011-11-13 21:16 Jameson Graef Rollins
2011-11-13 21:16 ` [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive Jameson Graef Rollins
0 siblings, 1 reply; 6+ messages in thread
From: Jameson Graef Rollins @ 2011-11-13 21:16 UTC (permalink / raw)
To: Notmuch Mail
I really hate the default behavior of the space bar in notmuch-show; I
don't want it to pop out of the thread that i'm currently view, and I
especially don't want it to archive threads. The space bar should
just be for viewing, not altering.
The following patch breaks out the food functionality from
notmuch-show-advance-and-archive so that people can easily rebind it
to the space bar. Although I do personally think we should change the
default behavior, I leave the current behavior untouched, since I
suppose there maybe are some people out there that like the current
behavior and don't expect it to change.
jamie.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive
2011-11-13 21:16 Jameson Graef Rollins
@ 2011-11-13 21:16 ` Jameson Graef Rollins
2011-11-16 22:47 ` Pieter Praet
2011-11-21 2:49 ` David Bremner
0 siblings, 2 replies; 6+ messages in thread
From: Jameson Graef Rollins @ 2011-11-13 21:16 UTC (permalink / raw)
To: Notmuch Mail
This patch breaks out much of the functionality of
notmuch-show-advance-and-archive into a new function:
notmuch-show-advance. This new function does all the advancing
through a show buffer that notmuch-show-advance-and-archive did,
without all the invasive thread archiving. The return value of
notmuch-show-advance is nil if the bottom of the thread is not
reached, and t if it is.
notmuch-show-advance-and-archive is modified to just call
notmuch-show-advance, and then call notmuch-show-archive-thread if the
return value is true. In this way the previous functionality of
notmuch-show-advance-and-archive is preserved.
This provides a way for people to rebind the space bar to a more sane
function if they don't like the default behavior.
---
emacs/notmuch-show.el | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index d5c95d8..a7f3263 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1135,26 +1135,18 @@ All currently available key bindings:
;; Commands typically bound to keys.
-(defun notmuch-show-advance-and-archive ()
- "Advance through thread and archive.
-
-This command is intended to be one of the simplest ways to
-process a thread of email. It does the following:
+(defun notmuch-show-advance ()
+ "Advance through thread.
If the current message in the thread is not yet fully visible,
scroll by a near screenful to read more of the message.
Otherwise, (the end of the current message is already within the
-current window), advance to the next open message.
-
-Finally, if there is no further message to advance to, and this
-last message is already read, then archive the entire current
-thread, (remove the \"inbox\" tag from each message). Also kill
-this buffer, and display the next thread from the search from
-which this thread was originally shown."
+current window), advance to the next open message."
(interactive)
(let* ((end-of-this-message (notmuch-show-message-bottom))
- (visible-end-of-this-message (1- end-of-this-message)))
+ (visible-end-of-this-message (1- end-of-this-message))
+ (ret nil))
(while (invisible-p visible-end-of-this-message)
(setq visible-end-of-this-message
(previous-single-char-property-change visible-end-of-this-message
@@ -1173,8 +1165,24 @@ which this thread was originally shown."
(notmuch-show-next-open-message))
(t
- ;; This is the last message - archive the thread.
- (notmuch-show-archive-thread)))))
+ ;; This is the last message - change the return value
+ (setq ret t)))
+ ret))
+
+(defun notmuch-show-advance-and-archive ()
+ "Advance through thread and archive.
+
+This command is intended to be one of the simplest ways to
+process a thread of email. It works exactly like
+notmuch-show-advance, in that it scrolls through messages in a
+show buffer, except that when it gets to the end of the buffer it
+archives the entire current thread, (remove the \"inbox\" tag
+from each message), kills the buffer, and displays the next
+thread from the search from which this thread was originally
+shown."
+ (interactive)
+ (if (notmuch-show-advance)
+ (notmuch-show-archive-thread)))
(defun notmuch-show-rewind ()
"Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
--
1.7.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive
2011-11-13 21:16 ` [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive Jameson Graef Rollins
@ 2011-11-16 22:47 ` Pieter Praet
2012-01-12 17:04 ` Pieter Praet
2011-11-21 2:49 ` David Bremner
1 sibling, 1 reply; 6+ messages in thread
From: Pieter Praet @ 2011-11-16 22:47 UTC (permalink / raw)
To: Jameson Graef Rollins; +Cc: Notmuch Mail
On Sun, 13 Nov 2011 13:16:48 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> This patch breaks out much of the functionality of
> notmuch-show-advance-and-archive into a new function:
> notmuch-show-advance. This new function does all the advancing
> through a show buffer that notmuch-show-advance-and-archive did,
> without all the invasive thread archiving. The return value of
> notmuch-show-advance is nil if the bottom of the thread is not
> reached, and t if it is.
>
> notmuch-show-advance-and-archive is modified to just call
> notmuch-show-advance, and then call notmuch-show-archive-thread if the
> return value is true. In this way the previous functionality of
> notmuch-show-advance-and-archive is preserved.
>
> This provides a way for people to rebind the space bar to a more sane
> function if they don't like the default behavior.
> ---
> emacs/notmuch-show.el | 38 +++++++++++++++++++++++---------------
> 1 files changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index d5c95d8..a7f3263 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1135,26 +1135,18 @@ All currently available key bindings:
>
> ;; Commands typically bound to keys.
>
> -(defun notmuch-show-advance-and-archive ()
> - "Advance through thread and archive.
> -
> -This command is intended to be one of the simplest ways to
> -process a thread of email. It does the following:
> +(defun notmuch-show-advance ()
> + "Advance through thread.
>
> If the current message in the thread is not yet fully visible,
> scroll by a near screenful to read more of the message.
>
> Otherwise, (the end of the current message is already within the
> -current window), advance to the next open message.
> -
> -Finally, if there is no further message to advance to, and this
> -last message is already read, then archive the entire current
> -thread, (remove the \"inbox\" tag from each message). Also kill
> -this buffer, and display the next thread from the search from
> -which this thread was originally shown."
> +current window), advance to the next open message."
> (interactive)
> (let* ((end-of-this-message (notmuch-show-message-bottom))
> - (visible-end-of-this-message (1- end-of-this-message)))
> + (visible-end-of-this-message (1- end-of-this-message))
> + (ret nil))
> (while (invisible-p visible-end-of-this-message)
> (setq visible-end-of-this-message
> (previous-single-char-property-change visible-end-of-this-message
> @@ -1173,8 +1165,24 @@ which this thread was originally shown."
> (notmuch-show-next-open-message))
>
> (t
> - ;; This is the last message - archive the thread.
> - (notmuch-show-archive-thread)))))
> + ;; This is the last message - change the return value
> + (setq ret t)))
> + ret))
> +
> +(defun notmuch-show-advance-and-archive ()
> + "Advance through thread and archive.
> +
> +This command is intended to be one of the simplest ways to
> +process a thread of email. It works exactly like
> +notmuch-show-advance, in that it scrolls through messages in a
> +show buffer, except that when it gets to the end of the buffer it
> +archives the entire current thread, (remove the \"inbox\" tag
> +from each message), kills the buffer, and displays the next
> +thread from the search from which this thread was originally
> +shown."
> + (interactive)
> + (if (notmuch-show-advance)
> + (notmuch-show-archive-thread)))
>
> (defun notmuch-show-rewind ()
> "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
> --
> 1.7.7.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
Nice one!
Signed-off-by: Pieter Praet <pieter@praet.org> ;)
This has also exposed a pre-existing bug: When the last visible message
is longer than a screenful and contains a *hidden* signature, you'll
never get to see the end of it.
The culprit is presumably seeking shelter from the flyswatter @
`notmuch-show-message-extent' or one of its relatives: Cc'ing our
resident invisibility guru.
Peace
--
Pieter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive
2011-11-13 21:16 ` [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive Jameson Graef Rollins
2011-11-16 22:47 ` Pieter Praet
@ 2011-11-21 2:49 ` David Bremner
1 sibling, 0 replies; 6+ messages in thread
From: David Bremner @ 2011-11-21 2:49 UTC (permalink / raw)
To: Jameson Graef Rollins, Notmuch Mail
On Sun, 13 Nov 2011 13:16:48 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> This patch breaks out much of the functionality of
> notmuch-show-advance-and-archive into a new function:
> notmuch-show-advance. This new function does all the advancing
> through a show buffer that notmuch-show-advance-and-archive did,
> without all the invasive thread archiving. The return value of
> notmuch-show-advance is nil if the bottom of the thread is not
> reached, and t if it is.
Pushed to master
d
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive
2011-11-16 22:47 ` Pieter Praet
@ 2012-01-12 17:04 ` Pieter Praet
2012-01-16 10:28 ` Pieter Praet
0 siblings, 1 reply; 6+ messages in thread
From: Pieter Praet @ 2012-01-12 17:04 UTC (permalink / raw)
To: Jameson Graef Rollins; +Cc: Notmuch Mail
On Wed, 16 Nov 2011 23:47:53 +0100, Pieter Praet <pieter@praet.org> wrote:
> On Sun, 13 Nov 2011 13:16:48 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > This patch breaks out much of the functionality of
> > notmuch-show-advance-and-archive into a new function:
> > notmuch-show-advance. This new function does all the advancing
> > through a show buffer that notmuch-show-advance-and-archive did,
> > without all the invasive thread archiving. The return value of
> > notmuch-show-advance is nil if the bottom of the thread is not
> > reached, and t if it is.
> >
> > notmuch-show-advance-and-archive is modified to just call
> > notmuch-show-advance, and then call notmuch-show-archive-thread if the
> > return value is true. In this way the previous functionality of
> > notmuch-show-advance-and-archive is preserved.
> >
> > This provides a way for people to rebind the space bar to a more sane
> > function if they don't like the default behavior.
> > ---
> > emacs/notmuch-show.el | 38 +++++++++++++++++++++++---------------
> > 1 files changed, 23 insertions(+), 15 deletions(-)
> >
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index d5c95d8..a7f3263 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -1135,26 +1135,18 @@ All currently available key bindings:
> >
> > ;; Commands typically bound to keys.
> >
> > -(defun notmuch-show-advance-and-archive ()
> > - "Advance through thread and archive.
> > -
> > -This command is intended to be one of the simplest ways to
> > -process a thread of email. It does the following:
> > +(defun notmuch-show-advance ()
> > + "Advance through thread.
> >
> > If the current message in the thread is not yet fully visible,
> > scroll by a near screenful to read more of the message.
> >
> > Otherwise, (the end of the current message is already within the
> > -current window), advance to the next open message.
> > -
> > -Finally, if there is no further message to advance to, and this
> > -last message is already read, then archive the entire current
> > -thread, (remove the \"inbox\" tag from each message). Also kill
> > -this buffer, and display the next thread from the search from
> > -which this thread was originally shown."
> > +current window), advance to the next open message."
> > (interactive)
> > (let* ((end-of-this-message (notmuch-show-message-bottom))
> > - (visible-end-of-this-message (1- end-of-this-message)))
> > + (visible-end-of-this-message (1- end-of-this-message))
> > + (ret nil))
> > (while (invisible-p visible-end-of-this-message)
> > (setq visible-end-of-this-message
> > (previous-single-char-property-change visible-end-of-this-message
> > @@ -1173,8 +1165,24 @@ which this thread was originally shown."
> > (notmuch-show-next-open-message))
> >
> > (t
> > - ;; This is the last message - archive the thread.
> > - (notmuch-show-archive-thread)))))
> > + ;; This is the last message - change the return value
> > + (setq ret t)))
> > + ret))
> > +
> > +(defun notmuch-show-advance-and-archive ()
> > + "Advance through thread and archive.
> > +
> > +This command is intended to be one of the simplest ways to
> > +process a thread of email. It works exactly like
> > +notmuch-show-advance, in that it scrolls through messages in a
> > +show buffer, except that when it gets to the end of the buffer it
> > +archives the entire current thread, (remove the \"inbox\" tag
> > +from each message), kills the buffer, and displays the next
> > +thread from the search from which this thread was originally
> > +shown."
> > + (interactive)
> > + (if (notmuch-show-advance)
> > + (notmuch-show-archive-thread)))
> >
> > (defun notmuch-show-rewind ()
> > "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
> > --
> > 1.7.7.1
> >
> > _______________________________________________
> > notmuch mailing list
> > notmuch@notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch
>
>
> Nice one!
>
> Signed-off-by: Pieter Praet <pieter@praet.org> ;)
>
>
> This has also exposed a pre-existing bug: When the last visible message
> is longer than a screenful and contains a *hidden* signature, you'll
> never get to see the end of it.
>
> The culprit is presumably seeking shelter from the flyswatter @
> `notmuch-show-message-extent' or one of its relatives: Cc'ing our
> resident invisibility guru.
>
>
> Peace
>
> --
> Pieter
FYI, this bug has been fixed by Aaron Ecay [1], commit 8392a7cc, which
will be included in v0.12. Not accompanied by a test, though, so keep
an eye out for regressions.
Maybe the following might be of use to someone:
#+begin_src sh
msg_lines=25
sh -c "stty rows 24 cols 80; \
emacs -Q -nw --eval \
'(progn
(dotimes (i ${msg_lines}) (insert \"\n\"))
(goto-char (point-min))
(scroll-up nil)
(princ (line-number-at-pos nil)))'"
#+end_src
This correctly returns "20", but when running the exact same thing
with Emacs in batch mode (add '--batch' option), it returns "7" ?!?
Peace
--
Pieter
[1] id:"1324563860-21986-1-git-send-email-aaronecay@gmail.com"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive
2012-01-12 17:04 ` Pieter Praet
@ 2012-01-16 10:28 ` Pieter Praet
0 siblings, 0 replies; 6+ messages in thread
From: Pieter Praet @ 2012-01-16 10:28 UTC (permalink / raw)
To: Jameson Graef Rollins; +Cc: Notmuch Mail
On Thu, 12 Jan 2012 18:04:10 +0100, Pieter Praet <pieter@praet.org> wrote:
> On Wed, 16 Nov 2011 23:47:53 +0100, Pieter Praet <pieter@praet.org> wrote:
> > On Sun, 13 Nov 2011 13:16:48 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> > > This patch breaks out much of the functionality of
> > > notmuch-show-advance-and-archive into a new function:
> > > notmuch-show-advance. This new function does all the advancing
> > > through a show buffer that notmuch-show-advance-and-archive did,
> > > without all the invasive thread archiving. The return value of
> > > notmuch-show-advance is nil if the bottom of the thread is not
> > > reached, and t if it is.
> > >
> > > notmuch-show-advance-and-archive is modified to just call
> > > notmuch-show-advance, and then call notmuch-show-archive-thread if the
> > > return value is true. In this way the previous functionality of
> > > notmuch-show-advance-and-archive is preserved.
> > >
> > > This provides a way for people to rebind the space bar to a more sane
> > > function if they don't like the default behavior.
> > > ---
> > > emacs/notmuch-show.el | 38 +++++++++++++++++++++++---------------
> > > 1 files changed, 23 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > > index d5c95d8..a7f3263 100644
> > > --- a/emacs/notmuch-show.el
> > > +++ b/emacs/notmuch-show.el
> > > @@ -1135,26 +1135,18 @@ All currently available key bindings:
> > >
> > > ;; Commands typically bound to keys.
> > >
> > > -(defun notmuch-show-advance-and-archive ()
> > > - "Advance through thread and archive.
> > > -
> > > -This command is intended to be one of the simplest ways to
> > > -process a thread of email. It does the following:
> > > +(defun notmuch-show-advance ()
> > > + "Advance through thread.
> > >
> > > If the current message in the thread is not yet fully visible,
> > > scroll by a near screenful to read more of the message.
> > >
> > > Otherwise, (the end of the current message is already within the
> > > -current window), advance to the next open message.
> > > -
> > > -Finally, if there is no further message to advance to, and this
> > > -last message is already read, then archive the entire current
> > > -thread, (remove the \"inbox\" tag from each message). Also kill
> > > -this buffer, and display the next thread from the search from
> > > -which this thread was originally shown."
> > > +current window), advance to the next open message."
> > > (interactive)
> > > (let* ((end-of-this-message (notmuch-show-message-bottom))
> > > - (visible-end-of-this-message (1- end-of-this-message)))
> > > + (visible-end-of-this-message (1- end-of-this-message))
> > > + (ret nil))
> > > (while (invisible-p visible-end-of-this-message)
> > > (setq visible-end-of-this-message
> > > (previous-single-char-property-change visible-end-of-this-message
> > > @@ -1173,8 +1165,24 @@ which this thread was originally shown."
> > > (notmuch-show-next-open-message))
> > >
> > > (t
> > > - ;; This is the last message - archive the thread.
> > > - (notmuch-show-archive-thread)))))
> > > + ;; This is the last message - change the return value
> > > + (setq ret t)))
> > > + ret))
> > > +
> > > +(defun notmuch-show-advance-and-archive ()
> > > + "Advance through thread and archive.
> > > +
> > > +This command is intended to be one of the simplest ways to
> > > +process a thread of email. It works exactly like
> > > +notmuch-show-advance, in that it scrolls through messages in a
> > > +show buffer, except that when it gets to the end of the buffer it
> > > +archives the entire current thread, (remove the \"inbox\" tag
> > > +from each message), kills the buffer, and displays the next
> > > +thread from the search from which this thread was originally
> > > +shown."
> > > + (interactive)
> > > + (if (notmuch-show-advance)
> > > + (notmuch-show-archive-thread)))
> > >
> > > (defun notmuch-show-rewind ()
> > > "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
> > > --
> > > 1.7.7.1
> > >
> > > _______________________________________________
> > > notmuch mailing list
> > > notmuch@notmuchmail.org
> > > http://notmuchmail.org/mailman/listinfo/notmuch
> >
> >
> > Nice one!
> >
> > Signed-off-by: Pieter Praet <pieter@praet.org> ;)
> >
> >
> > This has also exposed a pre-existing bug: When the last visible message
> > is longer than a screenful and contains a *hidden* signature, you'll
> > never get to see the end of it.
> >
> > The culprit is presumably seeking shelter from the flyswatter @
> > `notmuch-show-message-extent' or one of its relatives: Cc'ing our
> > resident invisibility guru.
> >
> >
> > Peace
> >
> > --
> > Pieter
>
>
> FYI, this bug has been fixed by Aaron Ecay [1], commit 8392a7cc, which
> will be included in v0.12. Not accompanied by a test, though, so keep
> an eye out for regressions.
>
> Maybe the following might be of use to someone:
>
> #+begin_src sh
> msg_lines=25
> sh -c "stty rows 24 cols 80; \
> emacs -Q -nw --eval \
> '(progn
> (dotimes (i ${msg_lines}) (insert \"\n\"))
> (goto-char (point-min))
> (scroll-up nil)
> (princ (line-number-at-pos nil)))'"
> #+end_src
>
> This correctly returns "20", but when running the exact same thing
> with Emacs in batch mode (add '--batch' option), it returns "7" ?!?
>
>
Minor clarification, in the unlikely event anyone's wondering:
A result of "20" is correct because we have 24 lines of which 3 are
lost to interface (mode line, echo area and menu bar are enabled by
default), and another one is "lost" due to `scroll-up' moving point
to the penultimate visible line.
> Peace
>
> --
> Pieter
>
> [1] id:"1324563860-21986-1-git-send-email-aaronecay@gmail.com"
Peace
--
Pieter
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-16 10:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-13 21:16 Jameson Graef Rollins
2011-11-13 21:16 ` [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive Jameson Graef Rollins
2011-11-16 22:47 ` Pieter Praet
2012-01-12 17:04 ` Pieter Praet
2012-01-16 10:28 ` Pieter Praet
2011-11-21 2:49 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).