mu4e: Update references to :body-txt and :body-html

Most are in comments, but one is in code.
This commit is contained in:
Thiago Jung Bauermann
2025-01-03 14:33:42 -03:00
parent 606f4be74b
commit 51137998db
2 changed files with 9 additions and 10 deletions

View File

@ -71,8 +71,8 @@ Some notes on the format:
the MIME-part), :name (the file name, if any), :mime-type (the the MIME-part), :name (the file name, if any), :mime-type (the
MIME-type, if any) and :size (the size in bytes, if any). 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 - Messages in the Headers view come from the database and do not have
:attachments, :body-txt or :body-html fields. Message in the :attachments or :body fields. Message in the Message view use the
Message view use the actual message file, and do include these fields." actual message file, and do include these fields."
;; after all this documentation, the spectacular implementation ;; after all this documentation, the spectacular implementation
(if msg (if msg
(plist-get msg field) (plist-get msg field)
@ -81,18 +81,17 @@ Some notes on the format:
(defsubst mu4e-message-field (msg field) (defsubst mu4e-message-field (msg field)
"Retrieve FIELD from message plist MSG. "Retrieve FIELD from message plist MSG.
Like `mu4e-message-field-nil', but will sanitize nil values: Like `mu4e-message-field-nil', but will sanitize nil values:
- all string field except body-txt/body-html: nil -> \"\" - all string field except body: nil -> \"\"
- numeric fields + dates : nil -> 0 - numeric fields + dates : nil -> 0
- all others : return the value - all others : return the value
Thus, function will return nil for empty lists, non-existing body-txt Thus, function will return nil for empty lists, or non-existing body."
or body-html."
(let ((val (mu4e-message-field-raw msg field))) (let ((val (mu4e-message-field-raw msg field)))
(cond (cond
(val (val
val) ;; non-nil -> just return it val) ;; non-nil -> just return it
((member field '(:subject :message-id :path :maildir :in-reply-to)) ((member field '(:subject :message-id :path :maildir :in-reply-to))
"") ;; string fields except body-txt, body-html: nil -> "" "") ;; string fields except body: nil -> ""
((member field '(:body-html :body-txt)) ((member field '(:body))
val) val)
((member field '(:docid :size)) ((member field '(:docid :size))
0) ;; numeric type: nil -> 0 0) ;; numeric type: nil -> 0

View File

@ -323,7 +323,7 @@ The server output is as follows:
3. a view looks like: 3. a view looks like:
(:view <msg-sexp>) (:view <msg-sexp>)
=> the <msg-sexp> (see 2.) will be passed to `mu4e-view-func'. => 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: 4. a database update looks like:
(:update <msg-sexp> :move <nil-or-t>) (:update <msg-sexp> :move <nil-or-t>)