mirror of https://github.com/djcb/mu.git
* mu4e: add functions mu4e-message-field-at-point, mu4e-message-has-field
This commit is contained in:
parent
d5d0b11b98
commit
5630273d51
|
@ -106,11 +106,17 @@ Thus, function will return nil for empty lists, non-existing body-txt or body-ht
|
||||||
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-txt, body-html: nil -> ""
|
||||||
|
((member field '(:body-html :body-txt))
|
||||||
|
val)
|
||||||
((member field '(:docid :size))
|
((member field '(:docid :size))
|
||||||
0) ;; numeric type: nil -> 0
|
0) ;; numeric type: nil -> 0
|
||||||
(t
|
(t
|
||||||
val)))) ;; otherwise, just return nil
|
val)))) ;; otherwise, just return nil
|
||||||
|
|
||||||
|
(defsubst mu4e-message-has-field (msg field)
|
||||||
|
"Return t if MSG contains FIELD, nil otherwise."
|
||||||
|
(plist-member msg field))
|
||||||
|
|
||||||
(defsubst mu4e-message-at-point (&optional noerror)
|
(defsubst mu4e-message-at-point (&optional noerror)
|
||||||
"Get the message s-expression for the message at point in either
|
"Get the message s-expression for the message at point in either
|
||||||
the headers buffer or the view buffer, or nil if there is no such
|
the headers buffer or the view buffer, or nil if there is no such
|
||||||
|
@ -120,7 +126,12 @@ there is no message at point."
|
||||||
(if msg
|
(if msg
|
||||||
msg
|
msg
|
||||||
(unless noerror (mu4e-warn "No message at point")))))
|
(unless noerror (mu4e-warn "No message at point")))))
|
||||||
|
|
||||||
|
(defsubst mu4e-message-field-at-point (field)
|
||||||
|
"Get the field FIELD from the message at point; equivalent to
|
||||||
|
(mu4e-message-field (mu4e-message-at-point FIELD))."
|
||||||
|
(mu4e-message-field (mu4e-message-at-point) field))
|
||||||
|
|
||||||
(defun mu4e-message-body-text (msg)
|
(defun mu4e-message-body-text (msg)
|
||||||
"Get the body in text form for this message, which is either :body-txt,
|
"Get the body in text form for this message, which is either :body-txt,
|
||||||
or if not available, :body-html converted to text. By default, it
|
or if not available, :body-html converted to text. By default, it
|
||||||
|
|
Loading…
Reference in New Issue