From: Eli Zaretskii Date: Sun, 19 Jun 2011 18:27:03 +0000 (+0300) Subject: Fix display of R2L buffer names in Buffer-menu. X-Git-Url: http://git.hcoop.net/bpt/emacs.git/commitdiff_plain/cce4b0a79a5439c6f2f474c0c06d0def93dde5e5 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ccfff54529..9a4468d8b4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2011-06-19 Eli Zaretskii + + * 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. + 2011-06-18 Eli Zaretskii * buff-menu.el (Buffer-menu-mode, list-buffers-noselect): Force diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index cd1c8d7124..00340e5937 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)