Commit 6f2c86fa authored by Karl Heuer's avatar Karl Heuer
Browse files

(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.
parent 80056f3d
...@@ -163,22 +163,37 @@ this variable, if non-nil; 2. `~/.emacs'; 3. `default.el'.") ...@@ -163,22 +163,37 @@ this variable, if non-nil; 2. `~/.emacs'; 3. `default.el'.")
(delete (concat "PWD=" pwd) (delete (concat "PWD=" pwd)
process-environment))))))) process-environment)))))))
(setq default-directory (abbreviate-file-name default-directory)) (setq default-directory (abbreviate-file-name default-directory))
(unwind-protect (let ((menubar-bindings-done nil))
(command-line) (unwind-protect
;; Do this again, in case .emacs defined more abbreviations. (command-line)
(setq default-directory (abbreviate-file-name default-directory)) ;; Do this again, in case .emacs defined more abbreviations.
(run-hooks 'emacs-startup-hook) (setq default-directory (abbreviate-file-name default-directory))
(and term-setup-hook (run-hooks 'emacs-startup-hook)
(run-hooks 'term-setup-hook)) (and term-setup-hook
;; Modify the initial frame based on what .emacs puts into (run-hooks 'term-setup-hook))
;; ...-frame-alist. ;; Modify the initial frame based on what .emacs puts into
(if (fboundp 'frame-notice-user-settings) ;; ...-frame-alist.
(frame-notice-user-settings)) (if (fboundp 'frame-notice-user-settings)
;; Now we know the user's default font, so add it to the menu. (frame-notice-user-settings))
(if (fboundp 'font-menu-add-default) ;; Now we know the user's default font, so add it to the menu.
(font-menu-add-default)) (if (fboundp 'font-menu-add-default)
(and window-setup-hook (font-menu-add-default))
(run-hooks 'window-setup-hook))))) (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 () (defun command-line ()
(setq command-line-default-directory default-directory) (setq command-line-default-directory default-directory)
...@@ -422,6 +437,11 @@ GNU Emacs comes with ABSOLUTELY NO WARRANTY; type \\[describe-no-warranty] for f ...@@ -422,6 +437,11 @@ GNU Emacs comes with ABSOLUTELY NO WARRANTY; type \\[describe-no-warranty] for f
You may give out copies of Emacs; type \\[describe-copying] to see the conditions. You may give out copies of Emacs; type \\[describe-copying] to see the conditions.
Type \\[describe-distribution] for information on getting the latest version."))) Type \\[describe-distribution] for information on getting the latest version.")))
(set-buffer-modified-p nil) (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)) (sit-for 120))
(save-excursion (save-excursion
;; In case the Emacs server has already selected ;; In case the Emacs server has already selected
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment