about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+util.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/+util.el b/lisp/+util.el index 45d1e6d..a87eae9 100644 --- a/lisp/+util.el +++ b/lisp/+util.el
@@ -34,12 +34,12 @@
34(defun +string-truncate (s length &optional ellipsis alignment) 34(defun +string-truncate (s length &optional ellipsis alignment)
35 "Return S, shortened to LENGTH including ELLIPSIS and aligned to ALIGNMENT. 35 "Return S, shortened to LENGTH including ELLIPSIS and aligned to ALIGNMENT.
36 36
37ELLIPSIS defaults to \"...\". 37ELLIPSIS defaults to `truncate-string-ellipsis', or \"...\".
38 38
39ALIGNMENT defaults to `+string-default-alignment'." 39ALIGNMENT defaults to `+string-default-alignment'."
40 (declare (pure t) 40 (declare (pure t)
41 (side-effect-free t)) 41 (side-effect-free t))
42 (let ((ellipsis (or ellipsis "...")) 42 (let ((ellipsis (or ellipsis truncate-string-ellipsis "..."))
43 (alignment (or alignment +string-default-alignment))) 43 (alignment (or alignment +string-default-alignment)))
44 (if (> (length s) length) 44 (if (> (length s) length)
45 (format "%s%s" 45 (format "%s%s"
@@ -50,7 +50,7 @@ ALIGNMENT defaults to `+string-default-alignment'."
50(cl-defun +string-align (s len 50(cl-defun +string-align (s len
51 &key 51 &key
52 (before "") (after "") (fill " ") 52 (before "") (after "") (fill " ")
53 (ellipsis "...") 53 (ellipsis (or truncate-string-ellipsis "..."))
54 (alignment +string-default-alignment)) 54 (alignment +string-default-alignment))
55 "Print S to fit in LEN characters. 55 "Print S to fit in LEN characters.
56Optional arguments BEFORE and AFTER specify strings to go on 56Optional arguments BEFORE and AFTER specify strings to go on
@@ -59,7 +59,8 @@ either side of S.
59FILL is the string to fill extra space with (default \" \"). 59FILL is the string to fill extra space with (default \" \").
60 60
61ELLIPSIS is the string to show when S is too long to fit (default 61ELLIPSIS is the string to show when S is too long to fit (default
62\"...\"). If nil, don't truncate the string. 62`truncate-string-ellipsis' or \"...\"). If nil, don't truncate
63the string.
63 64
64ALIGNMENT can be one of these: 65ALIGNMENT can be one of these:
65- nil: align to `+string-default-alignment' 66- nil: align to `+string-default-alignment'