]> git.eshelyaron.com Git - emacs.git/commitdiff
* buff-menu.el (Buffer-menu-buffer+size): Use display property to
authorChong Yidong <cyd@stupidchicken.com>
Fri, 6 Nov 2009 19:15:25 +0000 (19:15 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Fri, 6 Nov 2009 19:15:25 +0000 (19:15 +0000)
align size column (Bug#4839).

lisp/ChangeLog
lisp/buff-menu.el

index 2ac43c5812595f66b1b72b7106647fd7ba7d9ac5..04fff3dfcc1a5419a14abf8bee55834441c86ee2 100644 (file)
@@ -1,5 +1,8 @@
 2009-11-06  Chong Yidong  <cyd@stupidchicken.com>
 
+       * buff-menu.el (Buffer-menu-buffer+size): Use display property to
+       align size column (Bug#4839).
+
        * emacs-lisp/autoload.el (autoload-rubric): Always issue a provide
        statement.
 
index d838f5ee18f29263066b90a52dece5e281ccff1c..6ef7195c4268cb6a9e1dcee1cae5f4fc6d06078f 100644 (file)
@@ -678,12 +678,13 @@ For more information, see the function `buffer-menu'."
     (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))
+  (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."
@@ -889,7 +890,7 @@ For more information, see the function `buffer-menu'."
                ;; This way we avoid problems with unusual buffer names.
                (let ((name (nth 2 buffer))
                      (size (int-to-string (nth 3 buffer))))
-                     (Buffer-menu-buffer+size name size
+                 (Buffer-menu-buffer+size name size
                         `(buffer-name ,name
                                       buffer ,(car buffer)
                                       font-lock-face buffer-menu-buffer