+;; The "Tools" menu items
+
+(defun send-mail-item-name ()
+ (let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail")
+ (mh-e-user-agent . "MH")
+ (message-user-agent . "Gnus Message")
+ (gnus-user-agent . "Gnus")))
+ (name (assq mail-user-agent known-send-mail-commands)))
+ (if name
+ (setq name (cdr name))
+ (setq name (symbol-name mail-user-agent))
+ (if (string-match "\\(.+\\)-user-agent" name)
+ (setq name (match-string 1 name))))
+ name))
+
+(defun read-mail-item-name ()
+ (let* ((known-rmail-commands '((rmail . "RMAIL")
+ (mh-rmail . "MH")
+ (gnus . "Gnus")))
+ (known (assq read-mail-command known-rmail-commands)))
+ (if known (cdr known) (symbol-name read-mail-command))))
+
+(defvar menu-bar-games-menu (make-sparse-keymap "Games"))
+
+(define-key menu-bar-tools-menu [games]
+ (list 'menu-item "Games" menu-bar-games-menu))
+
+(define-key menu-bar-tools-menu [separator-games]
+ '("--"))
+
+(define-key menu-bar-games-menu [zone]
+ '(menu-item "Zone Out" zone
+ :help "Play tricks with Emacs display when Emacs is idle"))
+(define-key menu-bar-games-menu [yow]
+ '(menu-item "Random Quotation" yow
+ :help "Display a random Zippy quotation"))
+(define-key menu-bar-games-menu [tetris]
+ '(menu-item "Tetris" tetris))
+(define-key menu-bar-games-menu [solitaire]
+ '(menu-item "Solitaire" solitaire))
+(define-key menu-bar-games-menu [snake]
+ '(menu-item "Snake" snake
+ :help "Move snake around avoiding collisions"))
+(define-key menu-bar-games-menu [mult]
+ '(menu-item "Multiplication Puzzle" mpuz
+ :help "Excercise brain with multiplication"))
+(define-key menu-bar-games-menu [life]
+ '(menu-item "Life" life
+ :help "Watch how John Conway's cellular automaton evolves"))
+(define-key menu-bar-games-menu [hanoi]
+ '(menu-item "Towers of Hanoi" hanoi
+ :help "Watch Towers-of-Hanoi puzzle solved by Emacs"))
+(define-key menu-bar-games-menu [gomoku]
+ '(menu-item "Gomoku" gomoku
+ :help "Mark 5 contiguous squares (like tic-tac-toe)"))
+(define-key menu-bar-games-menu [black-box]
+ '(menu-item "Blackbox" blackbox
+ :help "Find balls in a black box by shooting rays"))
+(define-key menu-bar-games-menu [adventure]
+ '(menu-item "Adventure" dunnet
+ :help "Dunnet, a text Adventure game for Emacs"))
+(define-key menu-bar-games-menu [5x5]
+ '(menu-item "5x5" 5x5
+ :help "Fill in all the squares on a 5x5 board"))
+
+(define-key menu-bar-tools-menu [calendar]
+ '(menu-item "Display Calendar" calendar))
+(define-key menu-bar-tools-menu [speedbar]
+ '(menu-item "Display Speedbar" speedbar-frame-mode))
+(define-key menu-bar-tools-menu [directory-search]
+ '(menu-item "Directory Search" eudc-tools-menu
+ :help "Query directory servers via LDAP, CCSO PH/QI or BBDB"))
+(define-key menu-bar-tools-menu [compose-mail]
+ (list
+ 'menu-item `(format "Send Mail (with %s)" (send-mail-item-name))
+ 'compose-mail
+ :visible `(and mail-user-agent (not (eq mail-user-agent 'ignore)))
+ :help "Send a mail message"))
+(define-key menu-bar-tools-menu [rmail]
+ (list
+ 'menu-item `(format "Read Mail (with %s)" (read-mail-item-name))
+ (lambda ()
+ (interactive)
+ (call-interactively read-mail-command))
+ :visible `(and read-mail-command (not (eq read-mail-command 'ignore)))
+ :help "Read your mail and reply to it"))
+(define-key menu-bar-tools-menu [gnus]
+ '(menu-item "Read Net News (Gnus)" gnus
+ :help "Read network news groups"))
+
+(define-key menu-bar-tools-menu [separator-vc]
+ '("--"))
+
+(defvar vc-menu-map (make-sparse-keymap "Version Control"))
+(define-key menu-bar-tools-menu [pcl-cvs]
+ `(menu-item "PCL-CVS" ,cvs-global-menu
+ :help "Module-level interface to CVS"))
+(define-key menu-bar-tools-menu [vc]
+ (list 'menu-item "Version Control" vc-menu-map
+ :help "Interface to RCS, CVS, SCCS"))
+
+(define-key menu-bar-tools-menu [separator-compare]
+ '("--"))
+
+(define-key menu-bar-tools-menu [ediff-misc]
+ '(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu
+ :help "Ediff manual, customization, sessions, etc."))
+(define-key menu-bar-tools-menu [epatch]
+ '(menu-item "Apply Patch" menu-bar-epatch-menu))
+(define-key menu-bar-tools-menu [ediff-merge]
+ '(menu-item "Merge" menu-bar-ediff-merge-menu
+ :help "Merge different revisions of files/directories"))
+(define-key menu-bar-tools-menu [compare]
+ '(menu-item "Compare (Ediff)" menu-bar-ediff-menu
+ :help "Display differences between files/directories"))
+
+
+(define-key menu-bar-tools-menu [separator-spell]
+ '("--"))
+
+(define-key menu-bar-tools-menu [spell]
+ '(menu-item "Spell Checking" ispell-menu-map))
+
+(define-key menu-bar-tools-menu [separator-prog]
+ '("--"))
+
+(define-key menu-bar-tools-menu [gdb]
+ '(menu-item "Debugger (GUD)..." gdb
+ :help "Debug a program from within Emacs"))
+(define-key menu-bar-tools-menu [shell-on-region]
+ '(menu-item "Shell Command on Region..." shell-command-on-region
+ :enable mark-active
+ :help "Pass marked region to a shell command"))
+(define-key menu-bar-tools-menu [shell]
+ '(menu-item "Shell Command..." shell-command
+ :help "Invoke a shell command and catch its output"))
+(define-key menu-bar-tools-menu [compile]
+ '(menu-item "Compile..." compile
+ :help "Invoke compiler or Make, view compilation errors"))
+(define-key menu-bar-tools-menu [grep]
+ '(menu-item "Search Files (Grep)..." grep
+ :help "Search files for strings or regexps (with Grep)"))
+
+\f
+;; The "Help" menu items
+