changeset 7371:099233e3a3be

(precompute-menubar-bindings): New function, formerly in loadup.el. (normal-top-level): Call it here, after loading user files. (command-line-1): Or here, if displaying startup message.
author Karl Heuer <kwzh@gnu.org>
date Sat, 07 May 1994 00:21:24 +0000
parents ecb09a00d330
children fb05d6911dcc
files lisp/startup.el
diffstat 1 files changed, 36 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/startup.el	Sat May 07 00:19:23 1994 +0000
+++ b/lisp/startup.el	Sat May 07 00:21:24 1994 +0000
@@ -163,22 +163,37 @@
 			   (delete (concat "PWD=" pwd)
 				   process-environment)))))))
     (setq default-directory (abbreviate-file-name default-directory))
-    (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)))))
+    (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 (fboundp 'x-popup-menu)
+      (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))))))
 
 (defun command-line ()
   (setq command-line-default-directory default-directory)
@@ -422,6 +437,11 @@
 You may give out copies of Emacs; type \\[describe-copying] to see the conditions.
 Type \\[describe-distribution] for information on getting the latest version.")))
 		   (set-buffer-modified-p nil)
+		   ;; Do this now to avoid an annoying delay if the user
+		   ;; clicks the menu bar during the sit-for.
+		   (sit-for 0)
+		   (precompute-menubar-bindings)
+		   (setq menubar-bindings-done t)
 		   (sit-for 120))
 	       (save-excursion
 		 ;; In case the Emacs server has already selected