11
Emacs RFC 2646 email flowing (idiomdrottning.org)
submitted 4 months ago* (last edited 4 months ago) by Sandra@idiomdrottning.org to c/emacs@lemmy.ml

Emacs RFC 2646 email flowing

Heck it Emacs!

A few months ago I fixed a bug in RFC 2646 handling where the last paragraph wouldn't get reflowed unless I remembered to add a hard newline (that is, a newline with the 'hard text property) after it, at EOT. I needed to hit one extra RET at the end. All other paragraphs would be wrapped, not just the last one.

(I even bugged @jas@fosstodon.org about it.)

But it still didn't always work and today I tried to get to the bottom of why, spending the entire day debugging it, finally realizing that... It's not even being called when there's only one paragraph in the email. I wasted so much time before realizing that! And then getting to the bottom of why that wasn't happening was the opposite of easy but it turnes out that Gnus by design doesn't call the fill-flowed-encode function when there aren't any hard newlines in the buffer. Which there aren't gonna be if it's a single-paragraph letter ๐Ÿคฆ๐Ÿปโ€โ™€๏ธ

Use-hard-newlines is beyond useless since that's always buffer-local and the text-reflowing is being done in a temp buffer. Instead since 2010 we're supposed to set mml-enable-flowed to true. But don't worry, fans of the messages-are-flowing package, I'm gonna send patches there to reflect that. I have a bunch of other changes to that package too since I've been using that a lot this summer.

This is all in bug#71017 (cursed palindrome!) for people who wanna dig in ๐Ÿ‘ฉ๐Ÿปโ€๐Ÿซ

@emacs@lemmy.ml

top 1 comments
sorted by: hot top controversial new old
[-] Sandra@idiomdrottning.org 1 points 4 months ago

As I noted in my patch message and in the previous post, behavior gets a li'l weird when someone leaves mml-enable-flowed on (the default!) but forgets to turn on use-hard-newlines (not the default! And since it's buffer local, it needs to be turned on every single time, for example with a hook).

So with these two settings kept at their defaults, separate paragraphs will get flowed together with my patch! So I sent a new version of the patch to the same #71017 thread that'll auto-harden according to markdown semantics as a dwimmy fallback.

@emacs@lemmy.ml

this post was submitted on 06 Jul 2024
11 points (100.0% liked)

Emacs

1978 readers
2 users here now

Our infinitely powerful editor.

founded 4 years ago
MODERATORS