diff --git a/NEWS.org b/NEWS.org index 2b62df95..0d411163 100644 --- a/NEWS.org +++ b/NEWS.org @@ -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 diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index 39243bce..2c594cc4 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -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" diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index e3f61717..d35f3153 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -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))))))))