diff lisp/custom/cus-edit.el @ 34:d620409f5eb8 r19-15b100

Import from CVS: tag r19-15b100
author cvs
date Mon, 13 Aug 2007 08:53:20 +0200
parents e04119814345
children c53a95d3c46d
line wrap: on
line diff
--- a/lisp/custom/cus-edit.el	Mon Aug 13 08:52:58 2007 +0200
+++ b/lisp/custom/cus-edit.el	Mon Aug 13 08:53:20 2007 +0200
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: help, faces
-;; Version: 1.63
+;; Version: 1.64
 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
 
 ;;; Commentary:
@@ -1803,9 +1803,19 @@
 				   ':style 'toggle
 				   ':selected symbol)))
 
-(defun custom-group-menu-create (widget symbol)
-  "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
-  (custom-menu-create symbol))
+(if (string-match "XEmacs" emacs-version)
+    ;; XEmacs can create menus dynamically.
+    (defun custom-group-menu-create (widget symbol)
+      "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
+      `( ,(custom-unlispify-menu-entry symbol t)
+	  :filter (lambda (&rest junk)
+		    (cdr (custom-menu-create ',symbol)))))
+  ;; But emacs can't.
+  (defun custom-group-menu-create (widget symbol)
+    "Ignoring WIDGET, create a menu entry for customization group SYMBOL."
+    ;; Limit the nesting.
+    (let ((custom-menu-nesting (1- custom-menu-nesting)))
+      (custom-menu-create symbol))))
 
 (defun custom-menu-create (symbol &optional name)
   "Create menu for customization group SYMBOL.
@@ -1817,10 +1827,9 @@
   (let ((item (vector name
 		      `(custom-buffer-create '((,symbol custom-group)))
 		      t)))
-    (if (and (> custom-menu-nesting 0)
+    (if (and (>= custom-menu-nesting 0)
 	     (< (length (get symbol 'custom-group)) widget-menu-max-size))
-	(let ((custom-menu-nesting (1- custom-menu-nesting))
-	      (custom-prefix-list (custom-prefix-add symbol
+	(let ((custom-prefix-list (custom-prefix-add symbol
 						     custom-prefix-list)))
 	  (custom-load-symbol symbol)
 	  `(,(custom-unlispify-menu-entry symbol t)
@@ -1841,17 +1850,11 @@
   (add-hook 'custom-define-hook 'custom-menu-reset)
   (let* ((emacs (widget-apply '(custom-group) :custom-menu 'emacs))
 	 (menu `(,(car custom-help-menu)
-		,emacs
-		,@(cdr (cdr custom-help-menu)))))
-    (if (fboundp 'add-submenu)
-	(progn 
-	  (add-submenu '("Options") menu)
-	  (cdr emacs))
-      (let ((map (easy-menu-create-keymaps (car menu) (cdr menu))))
-	(define-key global-map [menu-bar help-menu customize-menu]
-	  (cons (car menu) map))
-	(when (fboundp 'x-popup-menu)
-	  (x-popup-menu event map))))))
+		 ,emacs
+		 ,@(cdr (cdr custom-help-menu)))))
+    (let ((map (easy-menu-create-keymaps (car menu) (cdr menu))))
+      (define-key global-map [menu-bar help-menu customize-menu]
+	(cons (car menu) map)))))
 
 ;;; Dependencies.