diff lisp/font-menu.el @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 1ccc32a20af4
children 79c6ff3eef26
line wrap: on
line diff
--- a/lisp/font-menu.el	Fri Mar 08 13:33:14 2002 +0000
+++ b/lisp/font-menu.el	Wed Mar 13 08:54:06 2002 +0000
@@ -136,27 +136,8 @@
   :type 'boolean
   :group 'font-menu)
 
-(defcustom font-menu-max-items 25
-  "*Maximum number of items in the font menu
-If number of entries in a menu is larger than this value, split menu
-into submenus of nearly equal length.  If nil, never split menu into
-submenus."
-  :group 'font-menu
-  :type '(choice (const :tag "no submenus" nil)
-		 (integer)))
-
-(defcustom font-menu-submenu-name-format "%-12.12s ... %.12s"
-  "*Format specification of the submenu name.
-Used by `font-menu-split-long-menu' if the number of entries in a menu is
-larger than `font-menu-menu-max-items'.
-This string should contain one %s for the name of the first entry and
-one %s for the name of the last entry in the submenu.
-If the value is a function, it should return the submenu name.  The
-function is be called with two arguments, the names of the first and
-the last entry in the menu."
-  :group 'font-menu
-  :type '(choice (string :tag "Format string")
-		 (function)))
+(defvaralias 'font-menu-max-items 'menu-max-items)
+(defvaralias 'font-menu-submenu-name-format 'menu-submenu-name-format)
 
 (defvar font-menu-preferred-resolution
   (make-specifier-and-init 'generic '((global ((mswindows) . ":")
@@ -196,46 +177,6 @@
     (call-device-method 'reset-device-font-menus device device debug)
     (message "Getting list of fonts from server... done.")))
 
-(defun font-menu-split-long-menu (menu)
-  "Split MENU according to `font-menu-max-items' and add accelerator specs."
-  (let ((len (length menu)))
-    (if (or (null font-menu-max-items)
-	    (null (featurep 'lisp-float-type))
-	    (<= len font-menu-max-items))
-	(submenu-generate-accelerator-spec menu)
-      ;; Submenu is max 2 entries longer than menu, never shorter, number of
-      ;; entries in submenus differ by at most one (with longer submenus first)
-      (let* ((outer (floor (sqrt len)))
-	     (inner (/ len outer))
-	     (rest (% len outer))
-	     (result nil))
-	(setq menu (reverse menu))
-	(while menu
-	  (let ((in inner)
-		(sub nil)
-		(to (car menu)))
-	    (while (> in 0)
-	      (setq in   (1- in)
-		    sub  (cons (car menu) sub)
-		    menu (cdr menu)))
-	    (setq result
-		  (cons (cons (if (stringp font-menu-submenu-name-format)
-				  (format font-menu-submenu-name-format
-					  (menu-item-strip-accelerator-spec
-					   (aref (car sub) 0))
-					  (menu-item-strip-accelerator-spec
-					   (aref to 0)))
-				(funcall font-menu-submenu-name-format
-					 (menu-item-strip-accelerator-spec
-					  (aref (car sub) 0))
-					 (menu-item-strip-accelerator-spec
-					  (aref to 0))))
-			      (submenu-generate-accelerator-spec sub))
-			result)
-		  rest  (1+ rest))
-	    (if (= rest outer) (setq inner (1+ inner)))))
-	(submenu-generate-accelerator-spec result)))))
-
 ;;;###autoload
 (defun font-menu-family-constructor (ignored)
   (catch 'menu
@@ -254,7 +195,7 @@
       ;; the same size and weight as the current font (scalable fonts
       ;; exist in every size).  Only the current font is marked as
       ;; selected.
-      (font-menu-split-long-menu
+      (menu-split-long-menu
        (mapcar
 	(lambda (item)
 	  (setq f (menu-item-strip-accelerator-spec (aref item 0))