Subject: bug#4839: 23.1.50; *Buffer List* -- incorrect handling of multibyte characters?

From: Štěpán Němec <[email-masked]>
Date: Tue, 3 Nov 2009 18:02:55 +0100

On Tue, Nov 03, 2009 at 11:05:13AM -0500, Chong Yidong wrote:
> Or use the :align-to display property, as in this patch below.  Could
> someone test it?
> 
> *** emacs/lisp/buff-menu.el.~1.129.~	2009-11-03 10:38:11.000000000 -0500
> --- emacs/lisp/buff-menu.el	2009-11-03 11:02:21.000000000 -0500
> ***************
> *** 678,689 ****
>       (setq name (copy-sequence name)))
>     (add-text-properties 0 (length name) name-props name)
>     (add-text-properties 0 (length size) size-props size)
> !   (concat name
> ! 	  (make-string (- Buffer-menu-buffer+size-width
> ! 			  (string-width name)
> ! 			  (string-width size))
> ! 		       ?\s)
> ! 	  size))
>   
>   (defun Buffer-menu-sort (column)
>     "Sort the buffer menu by COLUMN."
> --- 678,690 ----
>       (setq name (copy-sequence name)))
>     (add-text-properties 0 (length name) name-props name)
>     (add-text-properties 0 (length size) size-props size)
> !   (let ((name+space-width (- Buffer-menu-buffer+size-width
> ! 			     (string-width size))))
> !     (concat name
> ! 	    (propertize (make-string (- name+space-width (string-width name))
> ! 				     ?\s)
> ! 			'display `(space :align-to ,(+ 4 name+space-width)))
> ! 	    size)))
>   
>   (defun Buffer-menu-sort (column)
>     "Sort the buffer menu by COLUMN."

Tested; with this above change; the alignment is as expected.
Thanks!

Štěpán Němec