- (unwind-protect
- (command-line)
- ;; Do this again, in case .emacs defined more abbreviations.
- (setq default-directory (abbreviate-file-name default-directory))
- (run-hooks 'emacs-startup-hook)
- (and term-setup-hook
- (run-hooks 'term-setup-hook))
- ;; Modify the initial frame based on what .emacs puts into
- ;; ...-frame-alist.
- (if (fboundp 'frame-notice-user-settings)
- (frame-notice-user-settings))
- ;; Now we know the user's default font, so add it to the menu.
- (if (fboundp 'font-menu-add-default)
- (font-menu-add-default))
- (and window-setup-hook
- (run-hooks 'window-setup-hook)))))
+ (setq user-mail-address (concat (user-login-name) "@"
+ (or mail-host-address
+ (system-name))))
+ (let ((menubar-bindings-done nil))
+ (unwind-protect
+ (command-line)
+ ;; Do this again, in case .emacs defined more abbreviations.
+ (setq default-directory (abbreviate-file-name default-directory))
+ (run-hooks 'emacs-startup-hook)
+ (and term-setup-hook
+ (run-hooks 'term-setup-hook))
+ ;; Modify the initial frame based on what .emacs puts into
+ ;; ...-frame-alist.
+ (if (fboundp 'frame-notice-user-settings)
+ (frame-notice-user-settings))
+ ;; Now we know the user's default font, so add it to the menu.
+ (if (fboundp 'font-menu-add-default)
+ (font-menu-add-default))
+ (and window-setup-hook
+ (run-hooks 'window-setup-hook))
+ (or menubar-bindings-done
+ (precompute-menubar-bindings))))))
+
+;; Precompute the keyboard equivalents in the menu bar items.
+(defun precompute-menubar-bindings ()
+ (if (eq window-system 'x)
+ (let ((submap (lookup-key global-map [menu-bar])))
+ (while submap
+ (and (consp (car submap))
+ (symbolp (car (car submap)))
+ (stringp (car-safe (cdr (car submap))))
+ (keymapp (cdr (cdr (car submap))))
+ (x-popup-menu nil (cdr (cdr (car submap)))))
+ (setq submap (cdr submap))))))