aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2011-06-19 21:27:03 +0300
committerEli Zaretskii2011-06-19 21:27:03 +0300
commitcce4b0a79a5439c6f2f474c0c06d0def93dde5e5 (patch)
tree068986adadcb3de2bb0f113f1528c7ee09fd9fb6
parentacb288185281f8030279fd81705bb54fa16ca84a (diff)
downloademacs-cce4b0a79a5439c6f2f474c0c06d0def93dde5e5.tar.gz
emacs-cce4b0a79a5439c6f2f474c0c06d0def93dde5e5.zip
Fix display of R2L buffer names in Buffer-menu.
lisp/buff-menu.el (Buffer-menu-buffer+size): Accept an additional argument LRM; if non-nil, append an invisible LRM character to the buffer name. (list-buffers-noselect): Call Buffer-menu-buffer+size with the last argument non-nil, when formatting buffer names.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/buff-menu.el17
2 files changed, 21 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ccfff545293..9a4468d8b43 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-06-19 Eli Zaretskii <eliz@gnu.org>
2
3 * buff-menu.el (Buffer-menu-buffer+size): Accept an additional
4 argument LRM; if non-nil, append an invisible LRM character to the
5 buffer name.
6 (list-buffers-noselect): Call Buffer-menu-buffer+size with the
7 last argument non-nil, when formatting buffer names.
8
12011-06-18 Eli Zaretskii <eliz@gnu.org> 92011-06-18 Eli Zaretskii <eliz@gnu.org>
2 10
3 * buff-menu.el (Buffer-menu-mode, list-buffers-noselect): Force 11 * buff-menu.el (Buffer-menu-mode, list-buffers-noselect): Force
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index cd1c8d71243..00340e5937b 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -666,7 +666,7 @@ For more information, see the function `buffer-menu'."
666 ":" ;; (if (char-displayable-p ?…) "…" ":") 666 ":" ;; (if (char-displayable-p ?…) "…" ":")
667 ) 667 )
668 668
669(defun Buffer-menu-buffer+size (name size &optional name-props size-props) 669(defun Buffer-menu-buffer+size (name size &optional name-props size-props lrm)
670 (if (> (+ (string-width name) (string-width size) 2) 670 (if (> (+ (string-width name) (string-width size) 2)
671 Buffer-menu-buffer+size-width) 671 Buffer-menu-buffer+size-width)
672 (setq name 672 (setq name
@@ -681,9 +681,17 @@ For more information, see the function `buffer-menu'."
681 (string-width tail) 681 (string-width tail)
682 2)) 682 2))
683 Buffer-menu-short-ellipsis 683 Buffer-menu-short-ellipsis
684 tail))) 684 tail
685 ;; Append an invisible LRM character to the
686 ;; buffer's name to avoid ugly display with the
687 ;; buffer size to the left of the name, when the
688 ;; name begins with R2L character.
689 (if lrm (propertize (string ?\x200e) 'invisible t) ""))))
685 ;; Don't put properties on (buffer-name). 690 ;; Don't put properties on (buffer-name).
686 (setq name (copy-sequence name))) 691 (setq name (concat (copy-sequence name)
692 (if lrm
693 (propertize (string ?\x200e) 'invisible t)
694 ""))))
687 (add-text-properties 0 (length name) name-props name) 695 (add-text-properties 0 (length name) name-props name)
688 (add-text-properties 0 (length size) size-props size) 696 (add-text-properties 0 (length size) size-props size)
689 (let ((name+space-width (- Buffer-menu-buffer+size-width 697 (let ((name+space-width (- Buffer-menu-buffer+size-width
@@ -913,7 +921,8 @@ For more information, see the function `buffer-menu'."
913 (max (length size) 3) 921 (max (length size) 3)
914 2)) 922 2))
915 name 923 name
916 "mouse-2: select this buffer")))) 924 "mouse-2: select this buffer"))
925 nil t))
917 " " 926 " "
918 (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width) 927 (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width)
919 (truncate-string-to-width (nth 4 buffer) 928 (truncate-string-to-width (nth 4 buffer)