diff options
Diffstat (limited to 'lisp/startup.el')
-rw-r--r-- | lisp/startup.el | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 2269973bd11..f20c61bdfed 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -519,6 +519,7 @@ DIRS are relative." xdg-dir) (t emacs-d-dir)))) +(defvar native-comp-eln-load-path) (defun normal-top-level () "Emacs calls this function when it first starts up. It sets `command-line-processed', processes the command-line, @@ -536,6 +537,26 @@ It is the default value of the variable `top-level'." (setq user-emacs-directory (startup--xdg-or-homedot startup--xdg-config-home-emacs nil)) + (when (featurep 'native-compile) + ;; Form `native-comp-eln-load-path'. + (let ((path-env (getenv "EMACSNATIVELOADPATH"))) + (when path-env + (dolist (path (split-string path-env path-separator)) + (unless (string= "" path) + (push path native-comp-eln-load-path))))) + (push (expand-file-name "eln-cache/" user-emacs-directory) + native-comp-eln-load-path) + ;; When $HOME is set to '/nonexistent' means we are running the + ;; testsuite, add a temporary folder in front to produce there + ;; new compilations. + (when (and (equal (getenv "HOME") "/nonexistent") + ;; We may be running in a chroot environment where we + ;; can't write anything. + (file-writable-p (expand-file-name + (or temporary-file-directory "")))) + (let ((tmp-dir (make-temp-file "emacs-testsuite-" t))) + (add-hook 'kill-emacs-hook (lambda () (delete-directory tmp-dir t))) + (push tmp-dir native-comp-eln-load-path)))) ;; Look in each dir in load-path for a subdirs.el file. If we ;; find one, load it, which will add the appropriate subdirs of ;; that dir into load-path. This needs to be done before setting @@ -622,6 +643,16 @@ It is the default value of the variable `top-level'." (set pathsym (mapcar (lambda (dir) (decode-coding-string dir coding t)) path))))) + (when (featurep 'native-compile) + (let ((npath (symbol-value 'native-comp-eln-load-path))) + (set 'native-comp-eln-load-path + (mapcar (lambda (dir) + ;; Call expand-file-name to remove all the + ;; pesky ".." from the directyory names in + ;; native-comp-eln-load-path. + (expand-file-name + (decode-coding-string dir coding t))) + npath)))) (dolist (filesym '(data-directory doc-directory exec-directory installation-directory invocation-directory invocation-name @@ -1097,7 +1128,7 @@ please check its value") ("--no-x-resources") ("--debug-init") ("--user") ("--iconic") ("--icon-type") ("--quick") ("--no-blinking-cursor") ("--basic-display") - ("--dump-file") ("--temacs"))) + ("--dump-file") ("--temacs") ("--seccomp"))) (argi (pop args)) (orig-argi argi) argval) @@ -1149,7 +1180,8 @@ please check its value") (push '(visibility . icon) initial-frame-alist)) ((member argi '("-nbc" "-no-blinking-cursor")) (setq no-blinking-cursor t)) - ((member argi '("-dump-file" "-temacs")) ; Handled in C + ((member argi '("-dump-file" "-temacs" "-seccomp")) + ;; Handled in C (or argval (pop args)) (setq argval nil)) ;; Push the popped arg back on the list of arguments. @@ -1169,12 +1201,12 @@ please check its value") ;; Re-evaluate predefined variables whose initial value depends on ;; the runtime context. - (setq custom-delayed-init-variables - ;; Initialize them in the same order they were loaded, in case there - ;; are dependencies between them. - (nreverse custom-delayed-init-variables)) - (mapc #'custom-reevaluate-setting custom-delayed-init-variables) - (setq custom-delayed-init-variables nil) + (when (listp custom-delayed-init-variables) + (mapc #'custom-reevaluate-setting + ;; Initialize them in the same order they were loaded, in + ;; case there are dependencies between them. + (reverse custom-delayed-init-variables))) + (setq custom-delayed-init-variables t) ;; Warn for invalid user name. (when init-file-user @@ -2290,6 +2322,9 @@ A fancy display is used on graphic displays, normal otherwise." (set-buffer-major-mode (current-buffer)) (current-buffer)))) +;; This avoids byte-compiler warning in the unexec build. +(declare-function pdumper-stats "pdumper.c" ()) + (defun command-line-1 (args-left) "A subroutine of `command-line'." (display-startup-echo-area-message) @@ -2361,6 +2396,7 @@ nil default-directory" name) (command-line-normalize-file-name name) dir)) (buf (find-file-noselect file))) + (file-name-history--add file) (setq displayable-buffers (cons buf displayable-buffers)) ;; Set the file buffer to the current buffer so ;; that it will be used with "--eval" and @@ -2470,7 +2506,7 @@ nil default-directory" name) (or argval (pop command-line-args-left)))) ;; Take file from default dir if it exists there; ;; otherwise let `load' search for it. - (file-ex (expand-file-name file))) + (file-ex (file-truename (expand-file-name file)))) (when (file-regular-p file-ex) (setq file file-ex)) (load file nil t))) @@ -2481,7 +2517,7 @@ nil default-directory" name) (let* ((file (command-line-normalize-file-name (or argval (pop command-line-args-left)))) ;; Take file from default dir. - (file-ex (expand-file-name file))) + (file-ex (file-truename (expand-file-name file)))) (load file-ex nil t t))) ((equal argi "-insert") |