aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-11-20 15:35:30 +0000
committerStefan Monnier2008-11-20 15:35:30 +0000
commit31e02fabc0e1c2e44fcf2f6bbf3a390ceece3e5a (patch)
tree8fc37ef20d22260ae584f190d9c4acd7af7a2f69
parenta3e5a6032aff3b93f31713d51351cda5a49f9bd3 (diff)
downloademacs-31e02fabc0e1c2e44fcf2f6bbf3a390ceece3e5a.tar.gz
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.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/buff-menu.el38
2 files changed, 23 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c892c6f30b0..421c2a20680 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12008-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * buff-menu.el (Buffer-menu-short-ellipsis): New constant.
4 (Buffer-menu-buffer+size): Use it, fix last change, and simplify.
5 (list-buffers-noselect): Don't need to pad.
6
12008-11-20 Toru TSUNEYOSHI <t_tuneyosi@hotmail.com> 72008-11-20 Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
2 8
3 * buff-menu.el (Buffer-menu-buffer+size, list-buffers-noselect): 9 * buff-menu.el (Buffer-menu-buffer+size, list-buffers-noselect):
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'."
596 (interactive "P") 596 (interactive "P")
597 (display-buffer (list-buffers-noselect files-only))) 597 (display-buffer (list-buffers-noselect files-only)))
598 598
599(defconst Buffer-menu-short-ellipsis (if (char-displayable-p ?…) "…" ":"))
600
599(defun Buffer-menu-buffer+size (name size &optional name-props size-props) 601(defun Buffer-menu-buffer+size (name size &optional name-props size-props)
600 (if (> (+ (string-width name) (string-width size) 2) Buffer-menu-buffer+size-width) 602 (if (> (+ (string-width name) (string-width size) 2)
603 Buffer-menu-buffer+size-width)
601 (setq name 604 (setq name
602 (if (string-match "<[0-9]+>$" name) 605 (let ((tail
603 (concat (truncate-string-to-width name 606 (if (string-match "<[0-9]+>$" name)
604 (- Buffer-menu-buffer+size-width 607 (match-string 0 name)
605 (max (string-width size) 3) 608 "")))
606 (string-width (match-string 0)) 609 (concat (truncate-string-to-width
607 2) 610 name
608 0 611 (- Buffer-menu-buffer+size-width
609 ?\s) 612 (max (string-width size) 3)
610 ":" ; narrow ellipsis 613 (string-width tail)
611 (match-string 0 name)) 614 2))
612 (concat (truncate-string-to-width name 615 Buffer-menu-short-ellipsis
613 (- Buffer-menu-buffer+size-width 616 tail)))
614 (max (string-width size) 3)
615 2)
616 0
617 ?\s)
618 ":"))) ; narrow ellipsis
619 ;; Don't put properties on (buffer-name). 617 ;; Don't put properties on (buffer-name).
620 (setq name (copy-sequence name))) 618 (setq name (copy-sequence name)))
621 (add-text-properties 0 (length name) name-props name) 619 (add-text-properties 0 (length name) name-props name)
@@ -846,9 +844,7 @@ For more information, see the function `buffer-menu'."
846 " " 844 " "
847 (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width) 845 (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width)
848 (truncate-string-to-width (nth 4 buffer) 846 (truncate-string-to-width (nth 4 buffer)
849 Buffer-menu-mode-width 847 Buffer-menu-mode-width)
850 0
851 ?\s)
852 (nth 4 buffer))) 848 (nth 4 buffer)))
853 (when (nth 5 buffer) 849 (when (nth 5 buffer)
854 (indent-to (+ Buffer-menu-buffer-column Buffer-menu-buffer+size-width 850 (indent-to (+ Buffer-menu-buffer-column Buffer-menu-buffer+size-width