From: Nicolas Bock <nicolasbock@gmail.com>
To: notmuch@notmuchmail.org
Subject: Re: format=flowed incorrect line wrapping
Date: Fri, 21 Dec 2018 06:18:56 -0700 [thread overview]
Message-ID: <871s6b9fwf.fsf@gmail.com> (raw)
In-Reply-To: <cund0pvcauy.fsf@disaster-area.hh.sledj.net>
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.
prev parent reply other threads:[~2018-12-21 13:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871s6b9fwf.fsf@gmail.com \
--to=nicolasbock@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).