]> git.eshelyaron.com Git - emacs.git/commitdiff
(Buffer-menu-short-ellipsis): New constant.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 20 Nov 2008 15:35:30 +0000 (15:35 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 20 Nov 2008 15:35:30 +0000 (15:35 +0000)
(Buffer-menu-buffer+size): Use it, fix last change, and simplify.
(list-buffers-noselect): Don't need to pad.

lisp/ChangeLog
lisp/buff-menu.el

index c892c6f30b0a0a3f372ace193bde98c0e7d1bbc5..421c2a2068093323aa9f9b2ed903dbfb98e779fe 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * buff-menu.el (Buffer-menu-short-ellipsis): New constant.
+       (Buffer-menu-buffer+size): Use it, fix last change, and simplify.
+       (list-buffers-noselect): Don't need to pad.
+
 2008-11-20   Toru TSUNEYOSHI  <t_tuneyosi@hotmail.com>
 
        * buff-menu.el (Buffer-menu-buffer+size, list-buffers-noselect):
index 7e94b8f0ac292467f7ecfadf656f7af46096f63a..b028f699bedbd2ce34af8dda482da7480a40b634 100644 (file)
@@ -596,26 +596,24 @@ For more information, see the function `buffer-menu'."
   (interactive "P")
   (display-buffer (list-buffers-noselect files-only)))
 
+(defconst Buffer-menu-short-ellipsis (if (char-displayable-p ?…) "…" ":"))
+
 (defun Buffer-menu-buffer+size (name size &optional name-props size-props)
-  (if (> (+ (string-width name) (string-width size) 2) Buffer-menu-buffer+size-width)
+  (if (> (+ (string-width name) (string-width size) 2)
+         Buffer-menu-buffer+size-width)
       (setq name
-           (if (string-match "<[0-9]+>$" name)
-               (concat (truncate-string-to-width name
-                                                 (- Buffer-menu-buffer+size-width
-                                                    (max (string-width size) 3)
-                                                    (string-width (match-string 0))
-                                                    2)
-                                                 0
-                                                 ?\s)
-                       ":"             ; narrow ellipsis
-                       (match-string 0 name))
-             (concat (truncate-string-to-width name
-                                               (- Buffer-menu-buffer+size-width
-                                                  (max (string-width size) 3)
-                                                  2)
-                                               0
-                                               ?\s)
-                     ":")))            ; narrow ellipsis
+            (let ((tail
+                   (if (string-match "<[0-9]+>$" name)
+                       (match-string 0 name)
+                     "")))
+              (concat (truncate-string-to-width
+                       name
+                       (- Buffer-menu-buffer+size-width
+                          (max (string-width size) 3)
+                          (string-width tail)
+                          2))
+                      Buffer-menu-short-ellipsis
+                      tail)))
     ;; Don't put properties on (buffer-name).
     (setq name (copy-sequence name)))
   (add-text-properties 0 (length name) name-props name)
@@ -846,9 +844,7 @@ For more information, see the function `buffer-menu'."
                "  "
                (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width)
                    (truncate-string-to-width (nth 4 buffer)
-                                             Buffer-menu-mode-width
-                                             0
-                                             ?\s)
+                                             Buffer-menu-mode-width)
                  (nth 4 buffer)))
        (when (nth 5 buffer)
          (indent-to (+ Buffer-menu-buffer-column Buffer-menu-buffer+size-width