Merge pull request #224 from tuxella/master
* allow the customization of the plaintext / html length ratio
This commit is contained in:
@ -51,6 +51,13 @@ is always used."
|
|||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'mu4e-view)
|
:group 'mu4e-view)
|
||||||
|
|
||||||
|
(defcustom mu4e-view-html-plaintext-ratio-heuristic 10
|
||||||
|
"Ratio between the length of the html and the plain text part
|
||||||
|
under which mu4e will consider the plain text part to be
|
||||||
|
'This messages requires html' text bodies."
|
||||||
|
:type 'integer
|
||||||
|
:group 'mu4e-view)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defsubst mu4e-message-field-raw (msg field)
|
(defsubst mu4e-message-field-raw (msg field)
|
||||||
@ -148,10 +155,13 @@ part, but this can be changed by setting
|
|||||||
(html (mu4e-message-field msg :body-html))
|
(html (mu4e-message-field msg :body-html))
|
||||||
(body
|
(body
|
||||||
(cond
|
(cond
|
||||||
;; does it look like some text? ie., 10x the length of the text
|
;; does it look like some text? ie., if the text part is more than
|
||||||
;; should be longer than the html, an heuristic to guard against
|
;; mu4e-view-html-plaintext-ratio-heuristic times shorter than the
|
||||||
;; 'This messages requires html' text bodies.
|
;; html part, it should't be used
|
||||||
((and (> (* 10 (length txt)) (length html))
|
;; This is an heuristic to guard against 'This messages requires
|
||||||
|
;; html' text bodies.
|
||||||
|
((and (> (* mu4e-view-html-plaintext-ratio-heuristic
|
||||||
|
(length txt)) (length html))
|
||||||
;; use html if it's prefered, unless there is no html
|
;; use html if it's prefered, unless there is no html
|
||||||
(or (not mu4e-view-prefer-html) (not html)))
|
(or (not mu4e-view-prefer-html) (not html)))
|
||||||
txt)
|
txt)
|
||||||
|
|||||||
Reference in New Issue
Block a user