]> git.eshelyaron.com Git - emacs.git/commitdiff
Make sure elided long buffer names have ellipses added (Bug#24972)
authorMark Oteiza <mvoteiza@udel.edu>
Tue, 22 Nov 2016 07:42:47 +0000 (02:42 -0500)
committerMark Oteiza <mvoteiza@udel.edu>
Tue, 22 Nov 2016 07:42:47 +0000 (02:42 -0500)
* 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.

lisp/ibuffer.el

index faadb67408a5b0136085ce97bf80ad1229f3fc95..dc5681c465919309f04418c6f1c0be1a4e90fbbd 100644 (file)
@@ -1556,19 +1556,23 @@ If point is on a group name, this function operates on that group."
     (if (or elide (with-no-warnings ibuffer-elide-long-columns))
        `(if (> strlen 5)
             ,(if from-end-p
+                  ;; FIXME: this should probably also be using
+                  ;; `truncate-string-to-width' (Bug#24972)
                  `(concat ,ellipsis
                           (substring ,strvar
                                      (string-width ibuffer-eliding-string)))
-               `(truncate-string-to-width
-                 ,strvar strlen nil nil
-                 ,ellipsis))
+               `(concat
+                 (truncate-string-to-width
+                   ,strvar (- strlen (string-width ,ellipsis)) nil ?.)
+                  ,ellipsis))
           ,strvar)
       strvar)))
 
 (defun ibuffer-compile-make-substring-form (strvar maxvar from-end-p)
   (if from-end-p
-      `(truncate-string-to-width str (string-width str) (- strlen ,maxvar))
-    `(truncate-string-to-width ,strvar ,maxvar)))
+      ;; FIXME: not sure if this case is correct (Bug#24972)
+      `(truncate-string-to-width str (string-width str) (- strlen ,maxvar) nil ?\s)
+    `(truncate-string-to-width ,strvar ,maxvar nil ?\s)))
 
 (defun ibuffer-compile-make-format-form (strvar widthform alignment)
   (let* ((left `(make-string tmp2 ?\s))