diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-11-20 15:35:30 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-11-20 15:35:30 +0000 |
commit | 31e02fabc0e1c2e44fcf2f6bbf3a390ceece3e5a (patch) | |
tree | 8fc37ef20d22260ae584f190d9c4acd7af7a2f69 /lisp/buff-menu.el | |
parent | a3e5a6032aff3b93f31713d51351cda5a49f9bd3 (diff) | |
download | emacs-31e02fabc0e1c2e44fcf2f6bbf3a390ceece3e5a.tar.gz emacs-31e02fabc0e1c2e44fcf2f6bbf3a390ceece3e5a.tar.bz2 emacs-31e02fabc0e1c2e44fcf2f6bbf3a390ceece3e5a.zip |
(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.
Diffstat (limited to 'lisp/buff-menu.el')
-rw-r--r-- | lisp/buff-menu.el | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 7e94b8f0ac2..b028f699bed 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -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 |