diff options
author | Eli Zaretskii <eliz@gnu.org> | 2011-06-19 21:27:03 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2011-06-19 21:27:03 +0300 |
commit | cce4b0a79a5439c6f2f474c0c06d0def93dde5e5 (patch) | |
tree | 068986adadcb3de2bb0f113f1528c7ee09fd9fb6 /lisp/buff-menu.el | |
parent | acb288185281f8030279fd81705bb54fa16ca84a (diff) | |
download | emacs-cce4b0a79a5439c6f2f474c0c06d0def93dde5e5.tar.gz |
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.
Diffstat (limited to 'lisp/buff-menu.el')
-rw-r--r-- | lisp/buff-menu.el | 17 |
1 files changed, 13 insertions, 4 deletions
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'." ":" ;; (if (char-displayable-p ?…) "…" ":") ) -(defun Buffer-menu-buffer+size (name size &optional name-props size-props) +(defun Buffer-menu-buffer+size (name size &optional name-props size-props lrm) (if (> (+ (string-width name) (string-width size) 2) Buffer-menu-buffer+size-width) (setq name @@ -681,9 +681,17 @@ For more information, see the function `buffer-menu'." (string-width tail) 2)) Buffer-menu-short-ellipsis - tail))) + tail + ;; Append an invisible LRM character to the + ;; buffer's name to avoid ugly display with the + ;; buffer size to the left of the name, when the + ;; name begins with R2L character. + (if lrm (propertize (string ?\x200e) 'invisible t) "")))) ;; Don't put properties on (buffer-name). - (setq name (copy-sequence name))) + (setq name (concat (copy-sequence name) + (if lrm + (propertize (string ?\x200e) 'invisible t) + "")))) (add-text-properties 0 (length name) name-props name) (add-text-properties 0 (length size) size-props size) (let ((name+space-width (- Buffer-menu-buffer+size-width @@ -913,7 +921,8 @@ For more information, see the function `buffer-menu'." (max (length size) 3) 2)) name - "mouse-2: select this buffer")))) + "mouse-2: select this buffer")) + nil t)) " " (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width) (truncate-string-to-width (nth 4 buffer) |