Skip to content

Commit

Permalink
mu4e: Update references to :body-txt and :body-html
Browse files Browse the repository at this point in the history
Most are in comments, but one is in code.
  • Loading branch information
bauermann committed Jan 4, 2025
1 parent 606f4be commit 5113799
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions mu4e/mu4e-message.el
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ Some notes on the format:
the MIME-part), :name (the file name, if any), :mime-type (the
MIME-type, if any) and :size (the size in bytes, if any).
- Messages in the Headers view come from the database and do not have
:attachments, :body-txt or :body-html fields. Message in the
Message view use the actual message file, and do include these fields."
:attachments or :body fields. Message in the Message view use the
actual message file, and do include these fields."
;; after all this documentation, the spectacular implementation
(if msg
(plist-get msg field)
Expand All @@ -81,18 +81,17 @@ Some notes on the format:
(defsubst mu4e-message-field (msg field)
"Retrieve FIELD from message plist MSG.
Like `mu4e-message-field-nil', but will sanitize nil values:
- all string field except body-txt/body-html: nil -> \"\"
- numeric fields + dates : nil -> 0
- all others : return the value
Thus, function will return nil for empty lists, non-existing body-txt
or body-html."
- all string field except body: nil -> \"\"
- numeric fields + dates : nil -> 0
- all others : return the value
Thus, function will return nil for empty lists, or non-existing body."
(let ((val (mu4e-message-field-raw msg field)))
(cond
(val
val) ;; non-nil -> just return it
((member field '(:subject :message-id :path :maildir :in-reply-to))
"") ;; string fields except body-txt, body-html: nil -> ""
((member field '(:body-html :body-txt))
"") ;; string fields except body: nil -> ""
((member field '(:body))
val)
((member field '(:docid :size))
0) ;; numeric type: nil -> 0
Expand Down
2 changes: 1 addition & 1 deletion mu4e/mu4e-server.el
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ The server output is as follows:
3. a view looks like:
(:view <msg-sexp>)
=> the <msg-sexp> (see 2.) will be passed to `mu4e-view-func'.
the <msg-sexp> also contains :body-txt and/or :body-html
the <msg-sexp> also contains :body
4. a database update looks like:
(:update <msg-sexp> :move <nil-or-t>)
Expand Down

0 comments on commit 5113799

Please sign in to comment.