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

From: Chong Yidong <[email-masked]>
Date: Tue, 03 Nov 2009 11:05:13 -0500

> > If the double width characters are not exactly twice as wide as the
> > single width characters there is not much that can be done about that.
> >
>
> The columns should be aligned using tab-stops rather than spaces. (tab
> characters within file names would need special handling, but these
> are rare).

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."