From: Glenn Morris Date: Thu, 27 Mar 2014 20:57:23 +0000 (-0400) Subject: Simplify treatment of some startup hooks X-Git-Tag: emacs-25.0.90~2640^2~317 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=862a4e4ae76df49444489108d2a58f9cfc36fad7;p=emacs.git Simplify treatment of some startup hooks * lisp/startup.el (inhibit-startup-hooks): Doc tweak. (normal-top-level): Simplify running of hooks. For window-setup-hook, respect inhibit-startup-hooks. (command-line-1): Don't set window-setup-hook to nil. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2553fea6a4d..1054db7c118 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2014-03-27 Glenn Morris + * startup.el (inhibit-startup-hooks): Doc tweak. + (normal-top-level): Simplify running of hooks. + For window-setup-hook, respect inhibit-startup-hooks. + (command-line-1): Don't set window-setup-hook to nil. + Allow selective autoloading from obsolete/ directory. * Makefile.in (obsolete-autoloads): New rule. (autoloads): Run obsolete-autoloads. diff --git a/lisp/startup.el b/lisp/startup.el index a37245ae01e..ef531af12df 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -292,8 +292,9 @@ see `tty-setup-hook'.") `tty-setup-hook' instead." "24.4") (defvar inhibit-startup-hooks nil - "Non-nil means don't run `term-setup-hook' and `emacs-startup-hook'. -This is because we already did so.") + "Non-nil means don't run some startup hooks, because we already did. +Currently this applies to: `emacs-startup-hook', `term-setup-hook', +and `window-setup-hook'.") (defvar keyboard-type nil "The brand of keyboard you are using. @@ -644,9 +645,7 @@ It is the default value of the variable `top-level'." (emacs-pid) (system-name)))))))) (unless inhibit-startup-hooks - (run-hooks 'emacs-startup-hook) - (and term-setup-hook - (run-hooks 'term-setup-hook))) + (run-hooks 'emacs-startup-hook 'term-setup-hook)) ;; Don't do this if we failed to create the initial frame, ;; for instance due to a dense colormap. @@ -682,8 +681,8 @@ It is the default value of the variable `top-level'." ;; 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)))) + (unless inhibit-startup-hooks + (run-hooks 'window-setup-hook)))) ;; Subprocesses of Emacs do not have direct access to the terminal, so ;; unless told otherwise they should only assume a dumb terminal. ;; We are careful to do it late (after term-setup-hook), although the @@ -2431,10 +2430,7 @@ A fancy display is used on graphic displays, normal otherwise." ;; If there are no switches to process, we might as well ;; run this hook now, and there may be some need to do it ;; before doing any output. - (run-hooks 'emacs-startup-hook) - (and term-setup-hook - (run-hooks 'term-setup-hook)) - (setq inhibit-startup-hooks t) + (run-hooks 'emacs-startup-hook 'term-setup-hook) ;; It's important to notice the user settings before we ;; display the startup message; otherwise, the settings @@ -2446,10 +2442,9 @@ A fancy display is used on graphic displays, normal otherwise." ;; If there are no switches to process, we might as well ;; run this hook now, and there may be some need to do it ;; before doing any output. - (when window-setup-hook - (run-hooks 'window-setup-hook) - ;; Don't let the hook be run twice. - (setq window-setup-hook nil)) + (run-hooks 'window-setup-hook) + + (setq inhibit-startup-hooks t) ;; ;; Do this now to avoid an annoying delay if the user ;; ;; clicks the menu bar during the sit-for.