Subject: Re: bug#24972: 26.0.50; Multibyte characters are misaligned in ibuffer

From: Mark Oteiza <[email-masked]>
Date: Tue, 22 Nov 2016 00:12:16 -0500

On 22/11/16 at 11:51am, Liu Hui wrote:
> Thank you, but the trailing "..." is missing for long buffer names, no
> matter whether they contain multibyte characters. For example,
> "01234567890123456789" becomes "012345678901234567". The normal result
> should be "012345678901234...".

Would you try the following?

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index faadb67..c550b7d 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1559,16 +1559,17 @@ ibuffer-compile-make-eliding-form
 		  `(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)))
+      `(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))