* format=flowed incorrect line wrapping
@ 2018-12-19 22:15 Nicolas Bock
2018-12-19 23:02 ` Dan Čermák
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Bock @ 2018-12-19 22:15 UTC (permalink / raw)
To: notmuch
Hi,
I can't figure out how to configure notmuch (in Emacs) to properly
wrap emails that are format=flowed. Right now long lines are
wrapped somewhere at around 70 some width.
Thanks already,
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: format=flowed incorrect line wrapping
2018-12-19 22:15 format=flowed incorrect line wrapping Nicolas Bock
@ 2018-12-19 23:02 ` Dan Čermák
2018-12-20 14:00 ` Nicolas Bock
0 siblings, 1 reply; 6+ messages in thread
From: Dan Čermák @ 2018-12-19 23:02 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 614 bytes --]
Hi Nick,
I can turn that behavior off by disabling auto-fill-mode (M-x
auto-fill-mode). You can probably disable that globally via some setting
or via a hook.
Cheers,
Dan
Nicolas Bock <nicolasbock@gmail.com> writes:
> Hi,
>
> I can't figure out how to configure notmuch (in Emacs) to properly
> wrap emails that are format=flowed. Right now long lines are
> wrapped somewhere at around 70 some width.
>
> Thanks already,
>
> Nick
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: format=flowed incorrect line wrapping
2018-12-19 23:02 ` Dan Čermák
@ 2018-12-20 14:00 ` Nicolas Bock
2018-12-21 11:54 ` David Edmondson
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Bock @ 2018-12-20 14:00 UTC (permalink / raw)
To: notmuch
Hi Dan,
sorry I didn't explain my problem very well. What I am looking for
is to reflow (to borrow a term from NeoMutt [1]) an email message
that I am _reading_ to the buffer width. Currently format=flowed
emails are simply shown as they are in the raw email body. Editing
and sending emails in format=flowed works fine.
Best,
Nick
[1]
https://neomutt.org/guide/reference.html#3-287-%C2%A0reflow_text
On Thu, Dec 20 2018, Dan Čermák wrote:
> Hi Nick,
>
> I can turn that behavior off by disabling auto-fill-mode (M-x
> auto-fill-mode). You can probably disable that globally via some setting
> or via a hook.
>
>
> Cheers,
>
> Dan
>
> Nicolas Bock <nicolasbock@gmail.com> writes:
>
>> Hi,
>>
>> I can't figure out how to configure notmuch (in Emacs) to properly
>> wrap emails that are format=flowed. Right now long lines are
>> wrapped somewhere at around 70 some width.
>>
>> Thanks already,
>>
>> Nick
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> https://notmuchmail.org/mailman/listinfo/notmuch
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: format=flowed incorrect line wrapping
2018-12-20 14:00 ` Nicolas Bock
@ 2018-12-21 11:54 ` David Edmondson
2018-12-21 12:39 ` David Edmondson
0 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2018-12-21 11:54 UTC (permalink / raw)
To: Nicolas Bock, notmuch
On Thursday, 2018-12-20 at 07:00:08 -07, Nicolas Bock wrote:
> sorry I didn't explain my problem very well. What I am looking for
> is to reflow (to borrow a term from NeoMutt [1]) an email message
> that I am _reading_ to the buffer width. Currently format=flowed
> emails are simply shown as they are in the raw email body. Editing
> and sending emails in format=flowed works fine.
Currently emacs doesn't know that the text/plain part has the
format=flowed attribute, so it can't do anything about it.
Two options occur to me:
- ensure that emacs knows the attributes of the part so that it could be
extended to do something useful,
- have notmuch remove newlines as appropriate from the part so that
the long line wrapping done by `notmuch-wash-wrap-long-lines' takes
effect.
Does anyone have suggestions as to which might be a better approach?
dme.
--
Another lonely day, no one here but me-o.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: format=flowed incorrect line wrapping
2018-12-21 11:54 ` David Edmondson
@ 2018-12-21 12:39 ` David Edmondson
2018-12-21 13:18 ` Nicolas Bock
0 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2018-12-21 12:39 UTC (permalink / raw)
To: Nicolas Bock, notmuch
[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]
On Friday, 2018-12-21 at 11:54:46 GMT, David Edmondson wrote:
> On Thursday, 2018-12-20 at 07:00:08 -07, Nicolas Bock wrote:
>
>> sorry I didn't explain my problem very well. What I am looking for
>> is to reflow (to borrow a term from NeoMutt [1]) an email message
>> that I am _reading_ to the buffer width. Currently format=flowed
>> emails are simply shown as they are in the raw email body. Editing
>> and sending emails in format=flowed works fine.
>
> Currently emacs doesn't know that the text/plain part has the
> format=flowed attribute, so it can't do anything about it.
>
> Two options occur to me:
> - ensure that emacs knows the attributes of the part so that it could be
> extended to do something useful,
Here's a hacky patch that takes this approach. Does it do what you would
expect?
A complication is the indentation of parts, which makes it hard to set a
good value for `fill-flowed-display-column' (because you don't know the
indentation depth).
A wash function (which would be the cleaner approach, presuming that we
passed the part to all wash functions) *does* know the indentation
depth, and so could perhaps adjust the value of
`fill-flowed-encode-column' appropriately.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: format=flowed.patch --]
[-- Type: text/x-diff, Size: 1499 bytes --]
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 78f1af47..18cbc690 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -744,6 +744,11 @@ will return nil if the CID is unknown or cannot be retrieved."
(save-excursion
(save-restriction
(narrow-to-region start (point-max))
+ ;; XXX dme: It would be much nicer to do this using a wash
+ ;; function attached to the hook, but that doesn't currently
+ ;; get access to the part and so cannot check the format.
+ (when (string= (plist-get part :format) "flowed")
+ (fill-flowed))
(run-hook-with-args 'notmuch-show-insert-text/plain-hook msg depth))))
t)
diff --git a/notmuch-show.c b/notmuch-show.c
index 07e9a5db..92d18bb8 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -708,6 +708,19 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
}
if (GMIME_IS_PART (node->part)) {
+ /* Include the format parameter of text/plain parts if it
+ * exists, allowing the UI to adapt the display of the part as
+ * appropriate.
+ */
+ if (g_mime_content_type_is_type (content_type, "text", "plain")) {
+ const char *format =
+ g_mime_object_get_content_type_parameter (node->part, "format");
+ if (format) {
+ sp->map_key (sp, "format");
+ sp->string (sp, format);
+ }
+ }
+
/* For non-HTML text parts, we include the content in the
* JSON. Since JSON must be Unicode, we handle charset
* decoding here and do not report a charset to the caller.
[-- Attachment #3: Type: text/plain, Size: 41 bytes --]
dme.
--
When I grow up I'll be stable.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: format=flowed incorrect line wrapping
2018-12-21 12:39 ` David Edmondson
@ 2018-12-21 13:18 ` Nicolas Bock
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Bock @ 2018-12-21 13:18 UTC (permalink / raw)
To: notmuch
On Fri, Dec 21 2018, David Edmondson wrote:
> On Friday, 2018-12-21 at 11:54:46 GMT, David Edmondson wrote:
>
>> On Thursday, 2018-12-20 at 07:00:08 -07, Nicolas Bock wrote:
>>
>>> sorry I didn't explain my problem very well. What I am looking
>>> for is to reflow (to borrow a term from NeoMutt [1]) an email
>>> message that I am _reading_ to the buffer width. Currently
>>> format=flowed emails are simply shown as they are in the raw
>>> email body. Editing and sending emails in format=flowed works
>>> fine.
>>
>> Currently emacs doesn't know that the text/plain part has the
>> format=flowed attribute, so it can't do anything about it.
>>
>> Two options occur to me: - ensure that emacs knows the
>> attributes of the part so that it could be
>> extended to do something useful,
>
> Here's a hacky patch that takes this approach. Does it do what
> you would expect?
Hi David,
thanks for the patch! I applied it but it's not doing anything. I
am not sure though that I am actually using the patch, so the fact
that there is no change shouldn't be taken too seriously :) Are
you on IRC? Maybe moving our discussion there would make it
easier.
Thanks!
Nick
> A complication is the indentation of parts, which makes it hard to set a
> good value for `fill-flowed-display-column' (because you don't know the
> indentation depth).
>
> A wash function (which would be the cleaner approach, presuming that we
> passed the part to all wash functions) *does* know the indentation
> depth, and so could perhaps adjust the value of
> `fill-flowed-encode-column' appropriately.
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 78f1af47..18cbc690 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -744,6 +744,11 @@ will return nil if the CID is unknown or cannot be retrieved."
> (save-excursion
> (save-restriction
> (narrow-to-region start (point-max))
> + ;; XXX dme: It would be much nicer to do this using a wash
> + ;; function attached to the hook, but that doesn't currently
> + ;; get access to the part and so cannot check the format.
> + (when (string= (plist-get part :format) "flowed")
> + (fill-flowed))
> (run-hook-with-args 'notmuch-show-insert-text/plain-hook msg depth))))
> t)
>
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 07e9a5db..92d18bb8 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -708,6 +708,19 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
> }
>
> if (GMIME_IS_PART (node->part)) {
> + /* Include the format parameter of text/plain parts if it
> + * exists, allowing the UI to adapt the display of the part as
> + * appropriate.
> + */
> + if (g_mime_content_type_is_type (content_type, "text", "plain")) {
> + const char *format =
> + g_mime_object_get_content_type_parameter (node->part, "format");
> + if (format) {
> + sp->map_key (sp, "format");
> + sp->string (sp, format);
> + }
> + }
> +
> /* For non-HTML text parts, we include the content in the
> * JSON. Since JSON must be Unicode, we handle charset
> * decoding here and do not report a charset to the caller.
>
> dme.
> --
> When I grow up I'll be stable.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-12-21 13:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-19 22:15 format=flowed incorrect line wrapping Nicolas Bock
2018-12-19 23:02 ` Dan Čermák
2018-12-20 14:00 ` Nicolas Bock
2018-12-21 11:54 ` David Edmondson
2018-12-21 12:39 ` David Edmondson
2018-12-21 13:18 ` Nicolas Bock
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).