diff lisp/menubar-items.el @ 464:5aa1854ad537 r21-2-47

Import from CVS: tag r21-2-47
author cvs
date Mon, 13 Aug 2007 11:45:51 +0200
parents 0784d089fdc9
children 52626a2f02ef
line wrap: on
line diff
--- a/lisp/menubar-items.el	Mon Aug 13 11:44:39 2007 +0200
+++ b/lisp/menubar-items.el	Mon Aug 13 11:45:51 2007 +0200
@@ -54,10 +54,12 @@
 
 ;;; Code:
 
-(defun menu-truncate-list (list n)
-  (if (<= (length list) n)
-      list
-    (butlast list (- (length list) n))))
+(defun Menubar-items-truncate-list (list n)
+  (mapcar #'(lambda (x)
+	      (if (<= (length x) 50) x (concat "..." (substring x -50))))
+	  (if (<= (length list) n)
+	      list
+	    (butlast list (- (length list) n)))))
 
 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list)
   "Add auto-generated accelerator specifications to a submenu.
@@ -432,7 +434,7 @@
 		   (mapcar #'(lambda (string)
 			       (vector string
 				       (list 'grep string)))
-			   (menu-truncate-list grep-history 10)))))
+			   (Menubar-items-truncate-list grep-history 10)))))
 	     (append menu '("---") items))))
        ["%_Grep..." grep :active (fboundp 'grep)]
        ["%_Kill Grep" kill-compilation
@@ -540,7 +542,7 @@
 		   (mapcar #'(lambda (string)
 			       (vector string
 				       (list 'compile string)))
-			   (menu-truncate-list compile-history 10)))))
+			   (Menubar-items-truncate-list compile-history 10)))))
 	     (append menu '("---") items))))
        ["%_Compile..." compile :active (fboundp 'compile)]
        ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]