aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Oteiza2016-11-22 02:42:47 -0500
committerMark Oteiza2016-11-22 02:42:47 -0500
commit16e705bb56dc09278cd537a3763d867ab66f20a4 (patch)
tree148e2ef88b4e6a003ce64418d942f8e5e51e923a
parent4940e0f9111731d8917bd98f885c34291cea04eb (diff)
downloademacs-16e705bb56dc09278cd537a3763d867ab66f20a4.tar.gz
emacs-16e705bb56dc09278cd537a3763d867ab66f20a4.zip
Make sure elided long buffer names have ellipses added (Bug#24972)
* lisp/ibuffer.el (ibuffer-compile-make-eliding-form): Restore the string concat, and chop "strvar" less the width of the ellipsis. (ibuffer-compile-make-substring-form): Add space as padding, to fix off-by-one in alignment.
-rw-r--r--lisp/ibuffer.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index faadb67408a..dc5681c4659 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1556,19 +1556,23 @@ If point is on a group name, this function operates on that group."
1556 (if (or elide (with-no-warnings ibuffer-elide-long-columns)) 1556 (if (or elide (with-no-warnings ibuffer-elide-long-columns))
1557 `(if (> strlen 5) 1557 `(if (> strlen 5)
1558 ,(if from-end-p 1558 ,(if from-end-p
1559 ;; FIXME: this should probably also be using
1560 ;; `truncate-string-to-width' (Bug#24972)
1559 `(concat ,ellipsis 1561 `(concat ,ellipsis
1560 (substring ,strvar 1562 (substring ,strvar
1561 (string-width ibuffer-eliding-string))) 1563 (string-width ibuffer-eliding-string)))
1562 `(truncate-string-to-width 1564 `(concat
1563 ,strvar strlen nil nil 1565 (truncate-string-to-width
1564 ,ellipsis)) 1566 ,strvar (- strlen (string-width ,ellipsis)) nil ?.)
1567 ,ellipsis))
1565 ,strvar) 1568 ,strvar)
1566 strvar))) 1569 strvar)))
1567 1570
1568(defun ibuffer-compile-make-substring-form (strvar maxvar from-end-p) 1571(defun ibuffer-compile-make-substring-form (strvar maxvar from-end-p)
1569 (if from-end-p 1572 (if from-end-p
1570 `(truncate-string-to-width str (string-width str) (- strlen ,maxvar)) 1573 ;; FIXME: not sure if this case is correct (Bug#24972)
1571 `(truncate-string-to-width ,strvar ,maxvar))) 1574 `(truncate-string-to-width str (string-width str) (- strlen ,maxvar) nil ?\s)
1575 `(truncate-string-to-width ,strvar ,maxvar nil ?\s)))
1572 1576
1573(defun ibuffer-compile-make-format-form (strvar widthform alignment) 1577(defun ibuffer-compile-make-format-form (strvar widthform alignment)
1574 (let* ((left `(make-string tmp2 ?\s)) 1578 (let* ((left `(make-string tmp2 ?\s))