mu4e: honor truncate-string-ellipsis

Use truncate-string-to-width and thus honor truncate-string-ellipsis; so
to get 'fancy' ellipsis, one can set:
   (setq truncate-string-ellipsis "…")
This commit is contained in:
Dirk-Jan C. Binnema 2020-05-25 15:43:06 +03:00
parent 7e530f265f
commit 57d38aa707
3 changed files with 14 additions and 13 deletions

View File

@ -1,6 +1,14 @@
#+STARTUP:showall
* NEWS (user visible changes)
* 1.5.x (unreleased, development version)
*** mu4e
- Honor ~truncate-string-ellipsis~ so you can now use 'fancy' ellipses for
truncated strings with ~(setq truncate-string-ellipsis "…")~
* 1.4 (released, as of April 18 2020)
*** mu

View File

@ -1221,17 +1221,9 @@ the view and compose modes and will color each signature in digest messages adhe
"Quote a string to be used literally in the modeline. The
string will be shortened to fit if its length exceeds
`mu4e-modeline-max-width'."
(let* (;; Adjust the max-width to include the length of the " ..." string
(width (let ((w (- mu4e-modeline-max-width 4)))
(if (> w 0) w 0)))
(str (let* ((l (length str))
;; If the input str is longer than the max-width, then will shorten
(w (if (> l width) width l))
;; If the input str is longer than the max-width, then append " ..."
(a (if (> l width) " ..." "")))
(concat (substring str 0 w) a))))
;; Escape the % character
(replace-regexp-in-string "%" "%%" str t t)))
(replace-regexp-in-string
"%" "%%"
(truncate-string-to-width str mu4e-modeline-max-width 0 nil t)))
(defun mu4e~active-composition-buffers ()
"Return all active mu4e composition buffers"

View File

@ -536,7 +536,7 @@ add text-properties to VAL."
"")))
(defun mu4e~view-header-field-fold ()
"Fold/unfold headers' value if there are more than one line."
"Fold/unfold headers' value if there is more than one line."
(interactive)
(let ((name-pos (field-beginning))
(value-pos (1+ (field-end))))
@ -554,7 +554,8 @@ add text-properties to VAL."
(vals (split-string (field-string value-pos) "\n" t))
(val (if (= (length vals) 1)
(car vals)
(concat (substring (car vals) 0 -3) "..."))))
(truncate-string-to-width (car vals)
(- (length (car vals)) 1) 0 nil t))))
(overlay-put o 'mu4e~view-header-field-folded t)
(overlay-put o 'display val))))))))