Use truncate-string-ellipsis by default

This commit is contained in:
Case Duckworth 2021-12-31 15:45:58 -06:00
parent a5d0c182a5
commit 13cb067d7f
1 changed files with 5 additions and 4 deletions

View File

@ -34,12 +34,12 @@
(defun +string-truncate (s length &optional ellipsis alignment)
"Return S, shortened to LENGTH including ELLIPSIS and aligned to ALIGNMENT.
ELLIPSIS defaults to \"...\".
ELLIPSIS defaults to `truncate-string-ellipsis', or \"...\".
ALIGNMENT defaults to `+string-default-alignment'."
(declare (pure t)
(side-effect-free t))
(let ((ellipsis (or ellipsis "..."))
(let ((ellipsis (or ellipsis truncate-string-ellipsis "..."))
(alignment (or alignment +string-default-alignment)))
(if (> (length s) length)
(format "%s%s"
@ -50,7 +50,7 @@ ALIGNMENT defaults to `+string-default-alignment'."
(cl-defun +string-align (s len
&key
(before "") (after "") (fill " ")
(ellipsis "...")
(ellipsis (or truncate-string-ellipsis "..."))
(alignment +string-default-alignment))
"Print S to fit in LEN characters.
Optional arguments BEFORE and AFTER specify strings to go on
@ -59,7 +59,8 @@ either side of S.
FILL is the string to fill extra space with (default \" \").
ELLIPSIS is the string to show when S is too long to fit (default
\"...\"). If nil, don't truncate the string.
`truncate-string-ellipsis' or \"...\"). If nil, don't truncate
the string.
ALIGNMENT can be one of these:
- nil: align to `+string-default-alignment'