* [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
@ 2012-02-17 18:34 Daniel Schoepe
2012-02-17 18:46 ` David Edmondson
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Daniel Schoepe @ 2012-02-17 18:34 UTC (permalink / raw)
To: notmuch
This introduces a variable to control after how many characters a line
is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
window width if it is lower).
---
emacs/notmuch-wash.el | 36 ++++++++++++++++++++++++++----------
1 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 56981d0..7d003a2 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -87,6 +87,14 @@ If there is one more line than the sum of
`notmuch-wash-citation-lines-suffix', show that, otherwise
collapse the remaining lines into a button.")
+(defvar notmuch-wash-wrap-lines-length nil
+ "Wrap line after at most this many characters.
+
+If this is nil, lines in messages will be wrapped to fit in the
+current window. If this is a number, lines will be wrapped after
+this many characters or at the window width (whichever one is
+lower).")
+
(defun notmuch-wash-toggle-invisible-action (cite-button)
(let ((invis-spec (button-get cite-button 'invisibility-spec)))
(if (invisible-p invis-spec)
@@ -276,16 +284,24 @@ Perform several transformations on the message body:
;;
(defun notmuch-wash-wrap-long-lines (msg depth)
- "Wrap any long lines in the message to the width of the window.
-
-When doing so, maintaining citation leaders in the wrapped text."
-
- (let ((coolj-wrap-follows-window-size nil)
- (fill-column (- (window-width)
- depth
- ;; 2 to avoid poor interaction with
- ;; `word-wrap'.
- 2)))
+ "Wrap long lines in the message.
+
+If `notmuch-wash-wrap-lines-length' is a number, this will wrap
+the message lines to the minimum of the width of the window or
+its value. Otherwise, this function will wrap long lines in the
+message at the window width. When doing so, citation leaders in
+the wrapped text are maintained."
+
+ (let* ((coolj-wrap-follows-window-size nil)
+ (limit (if (numberp notmuch-wash-wrap-lines-length)
+ (min notmuch-wash-wrap-lines-length
+ (window-width))
+ (window-width)))
+ (fill-column (- limit
+ depth
+ ;; 2 to avoid poor interaction with
+ ;; `word-wrap'.
+ 2)))
(coolj-wrap-region (point-min) (point-max))))
;;
--
1.7.9
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
2012-02-17 18:34 [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines Daniel Schoepe
@ 2012-02-17 18:46 ` David Edmondson
2012-02-17 18:57 ` Daniel Schoepe
2012-04-15 17:39 ` Mark Walters
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: David Edmondson @ 2012-02-17 18:46 UTC (permalink / raw)
To: Daniel Schoepe; +Cc: notmuch
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
* daniel@schoepe.org [2012-02-17 Fri 18:34]
> This introduces a variable to control after how many characters a line
> is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
> window width if it is lower).
What do you use this for?
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
2012-02-17 18:34 [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines Daniel Schoepe
2012-02-17 18:46 ` David Edmondson
@ 2012-04-15 17:39 ` Mark Walters
2012-04-18 15:30 ` Adam Wolfe Gordon
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Mark Walters @ 2012-04-15 17:39 UTC (permalink / raw)
To: Daniel Schoepe, notmuch
On Fri, 17 Feb 2012, Daniel Schoepe <daniel@schoepe.org> wrote:
> This introduces a variable to control after how many characters a line
> is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
> window width if it is lower).
Hi
This looks ok but I wonder if slightly different behaviour might be
preferable (and looks simple to implement): rather then always wrapping
at min of notmuch-wash-wrap-lines-length and window-width wrap at min of
(notmuch-wash-wrap-lines-length + depth) and window-width. Then if you
have a wide buffer you can still get 80 chars (say) of useful text even
for well nested messages whilst not having very long lines anywhere.
Best wishes
Mark
> ---
> emacs/notmuch-wash.el | 36 ++++++++++++++++++++++++++----------
> 1 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
> index 56981d0..7d003a2 100644
> --- a/emacs/notmuch-wash.el
> +++ b/emacs/notmuch-wash.el
> @@ -87,6 +87,14 @@ If there is one more line than the sum of
> `notmuch-wash-citation-lines-suffix', show that, otherwise
> collapse the remaining lines into a button.")
>
> +(defvar notmuch-wash-wrap-lines-length nil
> + "Wrap line after at most this many characters.
> +
> +If this is nil, lines in messages will be wrapped to fit in the
> +current window. If this is a number, lines will be wrapped after
> +this many characters or at the window width (whichever one is
> +lower).")
> +
> (defun notmuch-wash-toggle-invisible-action (cite-button)
> (let ((invis-spec (button-get cite-button 'invisibility-spec)))
> (if (invisible-p invis-spec)
> @@ -276,16 +284,24 @@ Perform several transformations on the message body:
> ;;
>
> (defun notmuch-wash-wrap-long-lines (msg depth)
> - "Wrap any long lines in the message to the width of the window.
> -
> -When doing so, maintaining citation leaders in the wrapped text."
> -
> - (let ((coolj-wrap-follows-window-size nil)
> - (fill-column (- (window-width)
> - depth
> - ;; 2 to avoid poor interaction with
> - ;; `word-wrap'.
> - 2)))
> + "Wrap long lines in the message.
> +
> +If `notmuch-wash-wrap-lines-length' is a number, this will wrap
> +the message lines to the minimum of the width of the window or
> +its value. Otherwise, this function will wrap long lines in the
> +message at the window width. When doing so, citation leaders in
> +the wrapped text are maintained."
> +
> + (let* ((coolj-wrap-follows-window-size nil)
> + (limit (if (numberp notmuch-wash-wrap-lines-length)
> + (min notmuch-wash-wrap-lines-length
> + (window-width))
> + (window-width)))
> + (fill-column (- limit
> + depth
> + ;; 2 to avoid poor interaction with
> + ;; `word-wrap'.
> + 2)))
> (coolj-wrap-region (point-min) (point-max))))
>
> ;;
> --
> 1.7.9
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
2012-02-17 18:34 [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines Daniel Schoepe
2012-02-17 18:46 ` David Edmondson
2012-04-15 17:39 ` Mark Walters
@ 2012-04-18 15:30 ` Adam Wolfe Gordon
2012-04-18 15:46 ` Daniel Schoepe
2012-06-28 7:41 ` Albin Stjerna
2012-06-30 1:41 ` David Bremner
4 siblings, 1 reply; 10+ messages in thread
From: Adam Wolfe Gordon @ 2012-04-18 15:30 UTC (permalink / raw)
To: Daniel Schoepe; +Cc: notmuch
Hi Daniel,
On Fri, Feb 17, 2012 at 11:34, Daniel Schoepe <daniel@schoepe.org> wrote:
> This introduces a variable to control after how many characters a line
> is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
> window width if it is lower).
I really like this idea, and I'm using this patch now. I've been
missing this mechanism in notmuch.
> +(defvar notmuch-wash-wrap-lines-length nil
> + "Wrap line after at most this many characters.
> +
> +If this is nil, lines in messages will be wrapped to fit in the
> +current window. If this is a number, lines will be wrapped after
> +this many characters or at the window width (whichever one is
> +lower).")
This should probably be a defcustom, in the notmuch-show section.
Otherwise, LGTM.
-- Adam
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
2012-04-18 15:30 ` Adam Wolfe Gordon
@ 2012-04-18 15:46 ` Daniel Schoepe
2012-04-19 14:33 ` Adam Wolfe Gordon
0 siblings, 1 reply; 10+ messages in thread
From: Daniel Schoepe @ 2012-04-18 15:46 UTC (permalink / raw)
To: Adam Wolfe Gordon; +Cc: notmuch
[-- Attachment #1: Type: text/plain, Size: 685 bytes --]
Hi Adam,
On Wed, 18.04.2012 17:30, Adam Wolfe Gordon wrote:
>> +(defvar notmuch-wash-wrap-lines-length nil
>> + "Wrap line after at most this many characters.
>> +
>> +If this is nil, lines in messages will be wrapped to fit in the
>> +current window. If this is a number, lines will be wrapped after
>> +this many characters or at the window width (whichever one is
>> +lower).")
>
> This should probably be a defcustom, in the notmuch-show section.
the reason for not making this a defcustom was that all of the other
functions in notmuch-wash.el use defvar for customization too, so
perhaps they should all be defcustom'd in a separate patch?
Cheers,
Daniel
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
2012-04-18 15:46 ` Daniel Schoepe
@ 2012-04-19 14:33 ` Adam Wolfe Gordon
0 siblings, 0 replies; 10+ messages in thread
From: Adam Wolfe Gordon @ 2012-04-19 14:33 UTC (permalink / raw)
To: Daniel Schoepe; +Cc: notmuch
On Wed, Apr 18, 2012 at 09:46, Daniel Schoepe <daniel@schoepe.org> wrote:
> the reason for not making this a defcustom was that all of the other
> functions in notmuch-wash.el use defvar for customization too, so
> perhaps they should all be defcustom'd in a separate patch?
Ah, yes, I see now. Most of those variables (the regexps and
button-formats) probably don't need to be customizable - it seems
unlikely that anyone will want to change them except for
internationalization, which should probably be done differently
anyway. I think it makes sense for the others to be customs, so doing
that in a separate patch is a good idea.
Thanks again for this patch - it makes my mail read reading much more pleasant.
-- Adam
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
2012-02-17 18:34 [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines Daniel Schoepe
` (2 preceding siblings ...)
2012-04-18 15:30 ` Adam Wolfe Gordon
@ 2012-06-28 7:41 ` Albin Stjerna
2012-06-28 8:51 ` Daniel Schoepe
2012-06-30 1:41 ` David Bremner
4 siblings, 1 reply; 10+ messages in thread
From: Albin Stjerna @ 2012-06-28 7:41 UTC (permalink / raw)
To: Daniel Schoepe; +Cc: NotMuch Mail Mailing List
Daniel Schoepe wrote:
> This introduces a variable to control after how many characters a line
> is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
> window width if it is lower).
Hi!
Did this patch make it into mainline notmuch? Because I can't find the variable notmuch-wash-wrap-long-lines using apropos-variable.
If it didn't make it: what is now the preferred method of wrapping long lines when reading emails using notmuch/Emacs?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines
2012-02-17 18:34 [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines Daniel Schoepe
` (3 preceding siblings ...)
2012-06-28 7:41 ` Albin Stjerna
@ 2012-06-30 1:41 ` David Bremner
4 siblings, 0 replies; 10+ messages in thread
From: David Bremner @ 2012-06-30 1:41 UTC (permalink / raw)
To: Daniel Schoepe, notmuch
Daniel Schoepe <daniel@schoepe.org> writes:
> This introduces a variable to control after how many characters a line
> is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the
> window width if it is lower).
pushed,
d
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-06-30 1:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-17 18:34 [PATCH] emacs: Add configurable wrapping width for notmuch-wash-wrap-long-lines Daniel Schoepe
2012-02-17 18:46 ` David Edmondson
2012-02-17 18:57 ` Daniel Schoepe
2012-04-15 17:39 ` Mark Walters
2012-04-18 15:30 ` Adam Wolfe Gordon
2012-04-18 15:46 ` Daniel Schoepe
2012-04-19 14:33 ` Adam Wolfe Gordon
2012-06-28 7:41 ` Albin Stjerna
2012-06-28 8:51 ` Daniel Schoepe
2012-06-30 1:41 ` 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).