Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guile: Fix the mu:body message method #2801

Merged
merged 3 commits into from
Jan 8, 2025
Merged

Conversation

bauermann
Copy link
Contributor

Hello,

I wanted to use the mu:body-txt method mentioned in the mu-guile documentation, but it didn't work.

This branch renames it to mu:body, removes mu:body-html (since the BodyHtml field doesn't exist anymore) and updates the test and documentation.

Please let me know if there are any changes or improvements that should be made.

It's stated to be US-ASCII with 7-bit encoding, but it contains the
UTF-8 character '—'.

Fixing the encoding very slightly changes the average size of messages
reported by mu:average, so adjust the new expected value.
Copy link
Owner

@djcb djcb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with a few changes.

@@ -38,8 +38,7 @@
mu:header
;; message accessors
mu:field:bcc
mu:field:body-html
mu:field:body-txt
mu:field:body
mu:field:cc
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the Mu Guile API is deprecated, people may depend on it, so wouldn't want to add backward-incompatibilities if it can be avoided.

So, it's okay to remove body-txt/body-html from the documentation, but keep the functions around; the former as a synonym for body and the latter always returning #f.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I'll send an updated version with that change.
Is it ok if I force-push to this branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just force-pushed a version implementing the change.

Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Precedence: high

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise the msg:body test fails, because with the wrong charset the em dash is skipped.
There are two alternatives:

  1. Substitute the em dash with a regular hyphen.
  2. Change the test to expect the wrong text, with the em dash omitted.

Is the charset wrong on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't change this part in the new version.

Somewhere along the way, the body-txt and body-html fields were merged
into a single body field. Later, commit 8eac392 ("guile: re-enable
the guile support") finally removed support for Field::Id::BodyHtml from
mu:c:get-field.

Unfortunately mu.scm and the documentation are still stuck in the past, so
update them. mu:body-txt is now a synonym for mu:body, and mu:body-html
always returns #f.

I wanted to add a mu:body test also for the rfc822.1 message, but there's
currently a bug where its body text is is duplicated (issue djcb#2802), so the
test would fail.
Most are in comments, but one is in code.
@djcb djcb merged commit fc246f7 into djcb:master Jan 8, 2025
@djcb
Copy link
Owner

djcb commented Jan 8, 2025

Thanks, looks good! Merged.

@bauermann bauermann deleted the fix-msg-body branch January 9, 2025 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants