changeset 92953:21d63c870839

(list-buffers-noselect): Display buffer name in tooltip instead of mouse binding when it doesn't fit in the list.
author Nick Roberts <nickrob@snap.net.nz>
date Fri, 14 Mar 2008 21:32:47 +0000
parents 5ba6e24d688b
children f0f1c359cd43
files lisp/buff-menu.el
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/buff-menu.el	Fri Mar 14 21:31:07 2008 +0000
+++ b/lisp/buff-menu.el	Fri Mar 14 21:32:47 2008 +0000
@@ -809,14 +809,21 @@
 		;; Put the buffer name into a text property
 		;; so we don't have to extract it from the text.
 		;; This way we avoid problems with unusual buffer names.
-		(Buffer-menu-buffer+size (nth 2 buffer)
-					 (int-to-string (nth 3 buffer))
-					 `(buffer-name ,(nth 2 buffer)
-					   buffer ,(car buffer)
-					   font-lock-face buffer-menu-buffer
-					   mouse-face highlight
-					   help-echo "mouse-2: select this buffer"))
-		"  "
+		(let ((name (nth 2 buffer))
+		      (size (int-to-string (nth 3 buffer))))
+		      (Buffer-menu-buffer+size name size
+		         `(buffer-name ,name
+				       buffer ,(car buffer)
+				       font-lock-face buffer-menu-buffer
+				       mouse-face highlight
+				       help-echo 
+				       ,(if (>= (length name)
+						(- Buffer-menu-buffer+size-width
+						   (max (length size) 3)
+						   2))
+					    name
+					  "mouse-2: select this buffer"))))
+		  "  "
 		(if (> (length (nth 4 buffer)) Buffer-menu-mode-width)
 		    (substring (nth 4 buffer) 0 Buffer-menu-mode-width)
 		  (nth 4 buffer)))