diff options
| author | Sean Whitton | 2025-06-24 17:33:39 +0100 |
|---|---|---|
| committer | Sean Whitton | 2025-06-24 17:33:39 +0100 |
| commit | 192066d3b92a64a894def9dd9d5bd3040cc257ba (patch) | |
| tree | 31f6ab0ab35ecf02f3c8ea27f6c9227037cd736c | |
| parent | baf0c8220261a71da4b58806eb41dd014709561e (diff) | |
| download | emacs-192066d3b92a64a894def9dd9d5bd3040cc257ba.tar.gz emacs-192066d3b92a64a894def9dd9d5bd3040cc257ba.zip | |
Load site-start.el before early-init.el
* lisp/startup.el (command-line): Load site-start.el before
early-init.el.
(site-run-file):
* doc/lispref/os.texi (Startup Summary, Init File):
* etc/NEWS: Document the change.
| -rw-r--r-- | doc/lispref/os.texi | 16 | ||||
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/startup.el | 33 |
3 files changed, 33 insertions, 23 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 8eeddf20b12..1591cbd7be0 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -94,6 +94,11 @@ if requested by environment variables such as @env{LANG}. | |||
| 94 | It does some basic parsing of the command-line arguments. | 94 | It does some basic parsing of the command-line arguments. |
| 95 | 95 | ||
| 96 | @item | 96 | @item |
| 97 | It loads the library @file{site-start}, if it exists. This is not | ||
| 98 | done if the options @samp{-Q} or @samp{--no-site-file} were specified. | ||
| 99 | @cindex @file{site-start.el} | ||
| 100 | |||
| 101 | @item | ||
| 97 | It loads your early init file (@pxref{Early Init File,,, emacs, The | 102 | It loads your early init file (@pxref{Early Init File,,, emacs, The |
| 98 | GNU Emacs Manual}). This is not done if the options @samp{-q}, | 103 | GNU Emacs Manual}). This is not done if the options @samp{-q}, |
| 99 | @samp{-Q}, or @samp{--batch} were specified. If the @samp{-u} option | 104 | @samp{-Q}, or @samp{--batch} were specified. If the @samp{-u} option |
| @@ -151,11 +156,6 @@ rather than build-time, context. | |||
| 151 | @c It registers the colors available for tty frames. | 156 | @c It registers the colors available for tty frames. |
| 152 | 157 | ||
| 153 | @item | 158 | @item |
| 154 | It loads the library @file{site-start}, if it exists. This is not | ||
| 155 | done if the options @samp{-Q} or @samp{--no-site-file} were specified. | ||
| 156 | @cindex @file{site-start.el} | ||
| 157 | |||
| 158 | @item | ||
| 159 | It loads your init file (@pxref{Init File}). This is not done if the | 159 | It loads your init file (@pxref{Init File}). This is not done if the |
| 160 | options @samp{-q}, @samp{-Q}, or @samp{--batch} were specified. If | 160 | options @samp{-q}, @samp{-Q}, or @samp{--batch} were specified. If |
| 161 | the @samp{-u} option was specified, Emacs looks for the init file in | 161 | the @samp{-u} option was specified, Emacs looks for the init file in |
| @@ -432,9 +432,9 @@ loading of this file with the option @samp{--no-site-file}. | |||
| 432 | 432 | ||
| 433 | @defopt site-run-file | 433 | @defopt site-run-file |
| 434 | This variable specifies the site-customization file to load before the | 434 | This variable specifies the site-customization file to load before the |
| 435 | user's init file. Its normal value is @code{"site-start"}. The only | 435 | user's early init file and regular init file. Its normal value is |
| 436 | way you can change it with real effect is to do so before dumping | 436 | @code{"site-start"}. The only way you can change it with real effect is |
| 437 | Emacs. | 437 | to do so before dumping Emacs. |
| 438 | @c So why even mention it here. I imagine it is almost never changed. | 438 | @c So why even mention it here. I imagine it is almost never changed. |
| 439 | @end defopt | 439 | @end defopt |
| 440 | 440 | ||
| @@ -61,6 +61,13 @@ OS selection instead of terminal-specific keybindings. | |||
| 61 | You can keep the old behavior by putting '(xterm-mouse-mode -1)' in your | 61 | You can keep the old behavior by putting '(xterm-mouse-mode -1)' in your |
| 62 | init file. | 62 | init file. |
| 63 | 63 | ||
| 64 | +++ | ||
| 65 | ** 'site-start.el' is now loaded before the user's early init file. | ||
| 66 | Previously the order was early-init.el, site-start.el and then the | ||
| 67 | user's regular init file, but now site-start.el comes first. This | ||
| 68 | allows site administrators to customize things that can normally only be | ||
| 69 | done from early-init.el, such as adding to 'package-directory-list'. | ||
| 70 | |||
| 64 | 71 | ||
| 65 | * Changes in Emacs 31.1 | 72 | * Changes in Emacs 31.1 |
| 66 | 73 | ||
diff --git a/lisp/startup.el b/lisp/startup.el index 3d38f68098b..030139b3c53 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -361,7 +361,8 @@ This file is loaded at run-time before `user-init-file'. It contains | |||
| 361 | inits that need to be in place for the entire site, but which, due to | 361 | inits that need to be in place for the entire site, but which, due to |
| 362 | their higher incidence of change, don't make sense to put into Emacs's | 362 | their higher incidence of change, don't make sense to put into Emacs's |
| 363 | dump file. Thus, the run-time load order is: 1. file described in | 363 | dump file. Thus, the run-time load order is: 1. file described in |
| 364 | this variable, if non-nil; 2. `user-init-file'; 3. `default.el'. | 364 | this variable, if non-nil; 2. `early-init-file', 3. `user-init-file'; |
| 365 | 4. `default.el'. | ||
| 365 | 366 | ||
| 366 | Don't use the `site-start.el' file for things some users may not like. | 367 | Don't use the `site-start.el' file for things some users may not like. |
| 367 | Put them in `default.el' instead, so that users can more easily | 368 | Put them in `default.el' instead, so that users can more easily |
| @@ -1426,6 +1427,21 @@ please check its value") | |||
| 1426 | (setq xdg-dir (concat "~" init-file-user "/.config/emacs/")) | 1427 | (setq xdg-dir (concat "~" init-file-user "/.config/emacs/")) |
| 1427 | (startup--xdg-or-homedot xdg-dir init-file-user))) | 1428 | (startup--xdg-or-homedot xdg-dir init-file-user))) |
| 1428 | 1429 | ||
| 1430 | ;; Run the site-start library if it exists. | ||
| 1431 | ;; This used to come after the early init file, but was moved here to | ||
| 1432 | ;; make it possible for sites to do early init things on behalf of | ||
| 1433 | ;; their users, such as adding to `package-directory-list'. | ||
| 1434 | ;; This certainly has to come before loading the regular init file. | ||
| 1435 | ;; Note that `user-init-file' is nil at this point. Code that might | ||
| 1436 | ;; be loaded from `site-run-file' and wants to test if -q was given | ||
| 1437 | ;; should check `init-file-user' instead, since that is already set. | ||
| 1438 | ;; See cus-edit.el for an example. | ||
| 1439 | (when site-run-file | ||
| 1440 | ;; Sites should not disable the startup screen. | ||
| 1441 | ;; Only individuals may disable the startup screen. | ||
| 1442 | (let ((inhibit-startup-screen inhibit-startup-screen)) | ||
| 1443 | (load site-run-file t t))) | ||
| 1444 | |||
| 1429 | ;; Load the early init file, if found. | 1445 | ;; Load the early init file, if found. |
| 1430 | (startup--load-user-init-file | 1446 | (startup--load-user-init-file |
| 1431 | (lambda () | 1447 | (lambda () |
| @@ -1537,20 +1553,7 @@ please check its value") | |||
| 1537 | (let ((old-scalable-fonts-allowed scalable-fonts-allowed) | 1553 | (let ((old-scalable-fonts-allowed scalable-fonts-allowed) |
| 1538 | (old-face-ignored-fonts face-ignored-fonts)) | 1554 | (old-face-ignored-fonts face-ignored-fonts)) |
| 1539 | 1555 | ||
| 1540 | ;; Run the site-start library if it exists. The point of this file is | 1556 | ;; Load the user's init file, or the default one, or none. |
| 1541 | ;; that it is run before .emacs. There is no point in doing this after | ||
| 1542 | ;; .emacs; that is useless. | ||
| 1543 | ;; Note that user-init-file is nil at this point. Code that might | ||
| 1544 | ;; be loaded from site-run-file and wants to test if -q was given | ||
| 1545 | ;; should check init-file-user instead, since that is already set. | ||
| 1546 | ;; See cus-edit.el for an example. | ||
| 1547 | (if site-run-file | ||
| 1548 | ;; Sites should not disable the startup screen. | ||
| 1549 | ;; Only individuals should disable the startup screen. | ||
| 1550 | (let ((inhibit-startup-screen inhibit-startup-screen)) | ||
| 1551 | (load site-run-file t t))) | ||
| 1552 | |||
| 1553 | ;; Load that user's init file, or the default one, or none. | ||
| 1554 | (startup--load-user-init-file | 1557 | (startup--load-user-init-file |
| 1555 | (lambda () | 1558 | (lambda () |
| 1556 | (cond | 1559 | (cond |