2017-06-08 11:47:56 +02:00
|
|
|
;;; core.el --- the heart of the beast -*- lexical-binding: t; -*-
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2019-11-07 12:49:30 -05:00
|
|
|
(when (version< emacs-version "26.1")
|
|
|
|
(error "Detected Emacs %s. Doom only supports Emacs 26.1 and higher"
|
2019-10-17 01:47:58 -04:00
|
|
|
emacs-version))
|
|
|
|
|
2019-09-03 00:42:36 -04:00
|
|
|
(defconst doom-version "2.0.9"
|
|
|
|
"Current version of Doom Emacs.")
|
|
|
|
|
2019-11-17 16:47:56 -05:00
|
|
|
(defconst EMACS27+ (> emacs-major-version 26))
|
2019-09-03 00:42:36 -04:00
|
|
|
(defconst IS-MAC (eq system-type 'darwin))
|
|
|
|
(defconst IS-LINUX (eq system-type 'gnu/linux))
|
|
|
|
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
|
|
|
|
(defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix)))
|
|
|
|
|
2019-10-30 00:02:04 -04:00
|
|
|
;; Ensure `doom-core-dir' is in `load-path'
|
|
|
|
(add-to-list 'load-path (file-name-directory load-file-name))
|
|
|
|
|
|
|
|
(defvar doom--initial-load-path load-path)
|
|
|
|
(defvar doom--initial-process-environment process-environment)
|
|
|
|
(defvar doom--initial-exec-path exec-path)
|
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; `file-name-handler-alist' is consulted on every `require', `load' and various
|
|
|
|
;; path/io functions. You get a minor speed up by nooping this. However, this
|
|
|
|
;; may cause problems on builds of Emacs where its site lisp files aren't
|
|
|
|
;; byte-compiled and we're forced to load the *.el.gz files (e.g. on Alpine)
|
2020-02-21 17:03:47 -05:00
|
|
|
(unless noninteractive
|
2020-03-27 02:33:25 -04:00
|
|
|
(defvar doom--initial-file-name-handler-alist file-name-handler-alist)
|
2019-10-30 00:02:04 -04:00
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
(setq file-name-handler-alist nil)
|
|
|
|
;; Restore `file-name-handler-alist', because it is needed for handling
|
|
|
|
;; encrypted or compressed files, among other things.
|
|
|
|
(defun doom-reset-file-handler-alist-h ()
|
|
|
|
(setq file-name-handler-alist doom--initial-file-name-handler-alist))
|
|
|
|
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))
|
2019-11-21 14:43:36 -05:00
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Just the bare necessities
|
2019-10-30 00:02:04 -04:00
|
|
|
(require 'core-lib)
|
|
|
|
|
|
|
|
|
2019-09-03 00:42:36 -04:00
|
|
|
;;
|
2019-10-30 00:02:04 -04:00
|
|
|
;;; Global variables
|
|
|
|
|
2019-07-21 03:01:15 +02:00
|
|
|
(defvar doom-init-p nil
|
|
|
|
"Non-nil if Doom has been initialized.")
|
|
|
|
|
|
|
|
(defvar doom-init-time nil
|
|
|
|
"The time it took, in seconds, for Doom Emacs to initialize.")
|
2018-05-19 18:01:49 +02:00
|
|
|
|
2018-06-15 00:25:20 +02:00
|
|
|
(defvar doom-debug-mode (or (getenv "DEBUG") init-file-debug)
|
2019-05-01 19:12:52 -04:00
|
|
|
"If non-nil, Doom will log more.
|
|
|
|
|
|
|
|
Use `doom/toggle-debug-mode' to toggle it. The --debug-init flag and setting the
|
|
|
|
DEBUG envvar will enable this at startup.")
|
2018-06-15 00:25:20 +02:00
|
|
|
|
2019-09-03 00:36:42 -04:00
|
|
|
(defvar doom-interactive-mode (not noninteractive)
|
|
|
|
"If non-nil, Emacs is in interactive mode.")
|
|
|
|
|
2019-07-21 03:01:15 +02:00
|
|
|
;;; Directories/files
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-emacs-dir
|
2019-08-06 14:46:15 -04:00
|
|
|
(eval-when-compile (file-truename user-emacs-directory))
|
2019-05-01 19:12:52 -04:00
|
|
|
"The path to the currently loaded .emacs.d directory. Must end with a slash.")
|
2016-10-02 23:25:08 +02:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-core-dir (concat doom-emacs-dir "core/")
|
2019-05-01 19:12:52 -04:00
|
|
|
"The root directory of Doom's core files. Must end with a slash.")
|
2016-10-02 23:25:08 +02:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-modules-dir (concat doom-emacs-dir "modules/")
|
2019-05-01 19:12:52 -04:00
|
|
|
"The root directory for Doom's modules. Must end with a slash.")
|
2018-02-16 02:02:58 -05:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-local-dir
|
2019-10-29 22:36:51 -04:00
|
|
|
(if-let (localdir (getenv "DOOMLOCALDIR"))
|
2019-11-01 15:12:12 -04:00
|
|
|
(expand-file-name (file-name-as-directory localdir))
|
2019-10-29 22:36:51 -04:00
|
|
|
(concat doom-emacs-dir ".local/"))
|
2019-05-01 19:12:52 -04:00
|
|
|
"Root directory for local storage.
|
|
|
|
|
|
|
|
Use this as a storage location for this system's installation of Doom Emacs.
|
|
|
|
These files should not be shared across systems. By default, it is used by
|
|
|
|
`doom-etc-dir' and `doom-cache-dir'. Must end with a slash.")
|
2017-03-16 23:38:22 -04:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-etc-dir (concat doom-local-dir "etc/")
|
2019-05-01 19:12:52 -04:00
|
|
|
"Directory for non-volatile local storage.
|
2017-12-22 14:48:07 -05:00
|
|
|
|
2019-05-01 19:12:52 -04:00
|
|
|
Use this for files that don't change much, like server binaries, external
|
|
|
|
dependencies or long-term shared data. Must end with a slash.")
|
2017-06-11 23:50:50 +02:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-cache-dir (concat doom-local-dir "cache/")
|
2019-05-01 19:12:52 -04:00
|
|
|
"Directory for volatile local storage.
|
2017-01-16 23:15:48 -05:00
|
|
|
|
2019-05-01 19:12:52 -04:00
|
|
|
Use this for files that change often, like cache files. Must end with a slash.")
|
2017-04-16 20:36:15 -04:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-docs-dir (concat doom-emacs-dir "docs/")
|
2019-05-01 19:12:52 -04:00
|
|
|
"Where Doom's documentation files are stored. Must end with a slash.")
|
2018-06-17 21:39:40 +02:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-private-dir
|
2019-10-29 22:36:51 -04:00
|
|
|
(if-let (doomdir (getenv "DOOMDIR"))
|
2019-11-01 15:12:12 -04:00
|
|
|
(expand-file-name (file-name-as-directory doomdir))
|
2019-10-29 22:36:51 -04:00
|
|
|
(or (let ((xdgdir
|
|
|
|
(expand-file-name "doom/"
|
|
|
|
(or (getenv "XDG_CONFIG_HOME")
|
|
|
|
"~/.config"))))
|
|
|
|
(if (file-directory-p xdgdir) xdgdir))
|
|
|
|
"~/.doom.d/"))
|
2019-05-01 19:12:52 -04:00
|
|
|
"Where your private configuration is placed.
|
|
|
|
|
|
|
|
Defaults to ~/.config/doom, ~/.doom.d or the value of the DOOMDIR envvar;
|
|
|
|
whichever is found first. Must end in a slash.")
|
2018-04-03 03:07:26 -04:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-autoload-file (concat doom-local-dir "autoloads.el")
|
2019-07-21 15:39:45 +02:00
|
|
|
"Where `doom-reload-core-autoloads' stores its core autoloads.
|
2019-05-01 19:12:52 -04:00
|
|
|
|
|
|
|
This file is responsible for informing Emacs where to find all of Doom's
|
|
|
|
autoloaded core functions (in core/autoload/*.el).")
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-package-autoload-file (concat doom-local-dir "autoloads.pkg.el")
|
2019-07-21 15:39:45 +02:00
|
|
|
"Where `doom-reload-package-autoloads' stores its package autoloads.
|
2019-05-01 19:12:52 -04:00
|
|
|
|
|
|
|
This file is compiled from the autoloads files of all installed packages
|
|
|
|
combined.")
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2019-11-01 15:12:12 -04:00
|
|
|
(defconst doom-env-file (concat doom-local-dir "env")
|
2020-02-19 23:34:16 -05:00
|
|
|
"The location of your envvar file, generated by `doom env`.
|
:boom: Replace exec-path-from-shell w/ 'bin/doom env'
IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.
Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)
The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.
+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
running `doom env enable` (`doom env clear` will reverse this and
delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
file. You won't need it if you're confident Emacs will always be
started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
doom/reload-env`. Note: this won't work if the Emacs session you're
running it in doesn't have a correct SHELL set. i.e. don't use this to
create your first env file!
The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.
This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
2019-03-28 00:06:10 -04:00
|
|
|
|
2019-05-01 19:12:52 -04:00
|
|
|
This file contains environment variables scraped from your shell environment,
|
|
|
|
which is loaded at startup (if it exists). This is helpful if Emacs can't
|
2019-05-02 21:54:47 -04:00
|
|
|
\(easily) be launched from the correct shell session (particularly for MacOS
|
2019-05-01 19:12:52 -04:00
|
|
|
users).")
|
:boom: Replace exec-path-from-shell w/ 'bin/doom env'
IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.
Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)
The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.
+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
running `doom env enable` (`doom env clear` will reverse this and
delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
file. You won't need it if you're confident Emacs will always be
started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
doom/reload-env`. Note: this won't work if the Emacs session you're
running it in doesn't have a correct SHELL set. i.e. don't use this to
create your first env file!
The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.
This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
2019-03-28 00:06:10 -04:00
|
|
|
|
2019-04-20 02:18:17 -04:00
|
|
|
;;; Custom error types
|
2018-06-20 02:07:12 +02:00
|
|
|
(define-error 'doom-error "Error in Doom Emacs core")
|
2018-06-18 14:47:36 +02:00
|
|
|
(define-error 'doom-hook-error "Error in a Doom startup hook" 'doom-error)
|
2018-06-20 02:07:12 +02:00
|
|
|
(define-error 'doom-autoload-error "Error in an autoloads file" 'doom-error)
|
|
|
|
(define-error 'doom-module-error "Error in a Doom module" 'doom-error)
|
|
|
|
(define-error 'doom-private-error "Error in private config" 'doom-error)
|
|
|
|
(define-error 'doom-package-error "Error with packages" 'doom-error)
|
2018-06-18 14:47:36 +02:00
|
|
|
|
|
|
|
|
2018-06-11 23:18:15 +02:00
|
|
|
;;
|
2019-04-20 02:18:17 -04:00
|
|
|
;;; Emacs core configuration
|
2016-05-26 18:51:39 -04:00
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; lo', longer logs ahoy, so to reliably locate lapses in doom's logic later
|
2020-01-31 16:43:08 -05:00
|
|
|
(setq message-log-max 8192)
|
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
;; Reduce debug output, well, unless we've asked for it.
|
|
|
|
(setq debug-on-error doom-debug-mode
|
|
|
|
jka-compr-verbose doom-debug-mode)
|
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Contrary to what many Emacs users have in their configs, you really don't
|
|
|
|
;; need more than this to make UTF-8 the default coding system:
|
2017-05-19 02:54:31 +02:00
|
|
|
(when (fboundp 'set-charset-priority)
|
2019-07-21 04:02:09 +02:00
|
|
|
(set-charset-priority 'unicode)) ; pretty
|
|
|
|
(prefer-coding-system 'utf-8) ; pretty
|
|
|
|
(setq locale-coding-system 'utf-8) ; please
|
2020-03-27 02:33:25 -04:00
|
|
|
;; The clipboard's on Windows could be in an encoding that's wider (or thinner)
|
|
|
|
;; than utf-8, so let Emacs/the OS decide what encoding to use there.
|
2019-03-28 01:46:58 -04:00
|
|
|
(unless IS-WINDOWS
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq selection-coding-system 'utf-8)) ; with sugar on top
|
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Disable warnings from legacy advice system. They aren't useful, and what can
|
|
|
|
;; we do about them, besides changing packages upstream?
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq ad-redefinition-action 'accept)
|
|
|
|
|
|
|
|
;; Make apropos omnipotent. It's more useful this way.
|
|
|
|
(setq apropos-do-all t)
|
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; A second, case-insensitive pass over `auto-mode-alist' is time wasted, and
|
|
|
|
;; indicates misconfiguration (or that the user needs to stop relying on case
|
|
|
|
;; insensitivity).
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq auto-mode-case-fold nil)
|
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Less noise at startup. The dashboard/empty scratch buffer is good enough.
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq inhibit-startup-message t
|
|
|
|
inhibit-startup-echo-area-message user-login-name
|
|
|
|
inhibit-default-init t
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Avoid pulling in many packages by starting the scratch buffer in
|
|
|
|
;; `fundamental-mode', rather than, say, `org-mode' or `text-mode'.
|
2019-07-21 04:02:09 +02:00
|
|
|
initial-major-mode 'fundamental-mode
|
|
|
|
initial-scratch-message nil)
|
2020-03-27 02:33:25 -04:00
|
|
|
|
|
|
|
;; Get rid of "For information about GNU Emacs..." message at startup, unless
|
|
|
|
;; we're in a daemon session, where it'll say "Starting Emacs daemon." instead,
|
|
|
|
;; which isn't so bad.
|
|
|
|
(unless (daemonp)
|
|
|
|
(advice-add #'display-startup-echo-area-message :override #'ignore))
|
2019-07-21 04:02:09 +02:00
|
|
|
|
|
|
|
;; Emacs "updates" its ui more often than it needs to, so we slow it down
|
2020-03-27 02:33:25 -04:00
|
|
|
;; slightly from 0.5s:
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq idle-update-delay 1)
|
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Emacs is essentially one huge security vulnerability, what with all the
|
|
|
|
;; dependencies it pulls in from all corners of the globe. Let's try to be at
|
|
|
|
;; least a little more discerning.
|
2020-03-24 01:29:54 +01:00
|
|
|
(setq gnutls-verify-error (not (getenv "INSECURE"))
|
2020-03-28 02:20:10 +01:00
|
|
|
gnutls-algorithm-priority
|
|
|
|
(let ((support-tls1.3 (if (>= libgnutls-version 30605) ":+VERS-TLS1.3" nil)))
|
|
|
|
(concat "SECURE128:+SECURE192:-VERS-ALL:+VERS-TLS1.2" support-tls1.3))
|
2020-03-24 01:29:54 +01:00
|
|
|
;; `gnutls-min-prime-bits' is set based on recommendations from
|
|
|
|
;; https://www.keylength.com/en/4/
|
|
|
|
gnutls-min-prime-bits 3072
|
2019-07-21 04:02:09 +02:00
|
|
|
tls-checktrust gnutls-verify-error
|
2020-03-24 01:29:54 +01:00
|
|
|
;; Emacs is built with `gnutls' by default, so `tls-program' would not
|
|
|
|
;; be used in that case. Otherwiese, people have reasons to not go with
|
|
|
|
;; `gnutls', we use `openssl' instead.
|
|
|
|
;; For more details, see https://redd.it/8sykl1
|
|
|
|
tls-program '("openssl s_client -connect %h:%p -CAfile %t -nbio -no_ssl3 -no_tls1 -no_tls1_1 -ign_eof"
|
|
|
|
"gnutls-cli -p %p --dh-bits=3072 --ocsp --x509cafile=%t \
|
|
|
|
--strict-tofu --priority='SECURE192:+SECURE128:-VERS-ALL:+VERS-TLS1.2:+VERS-TLS1.3' %h"
|
2019-07-21 04:02:09 +02:00
|
|
|
;; compatibility fallbacks
|
2020-03-24 01:29:54 +01:00
|
|
|
"gnutls-cli -p %p %h"))
|
2019-07-21 04:02:09 +02:00
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Emacs stores authinfo in $HOME and in plaintext. Let's not do that, mkay?
|
|
|
|
;; This file stores usernames, passwords, and other such treasures for the
|
2019-07-21 04:02:09 +02:00
|
|
|
;; aspiring malicious third party.
|
|
|
|
(setq auth-sources (list (expand-file-name "authinfo.gpg" doom-etc-dir)
|
|
|
|
"~/.authinfo.gpg"))
|
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Emacs on Windows frequently confuses HOME (C:\Users\<NAME>) and %APPDATA%,
|
2019-07-21 04:02:09 +02:00
|
|
|
;; causing `abbreviate-home-dir' to produce incorrect paths.
|
|
|
|
(when IS-WINDOWS
|
|
|
|
(setq abbreviated-home-dir "\\`'"))
|
|
|
|
|
2020-01-02 21:13:31 -05:00
|
|
|
;; Don't litter `doom-emacs-dir'. We don't use `no-littering' because it's a
|
|
|
|
;; mote too opinionated for our needs.
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq abbrev-file-name (concat doom-local-dir "abbrev.el")
|
|
|
|
async-byte-compile-log-file (concat doom-etc-dir "async-bytecomp.log")
|
|
|
|
bookmark-default-file (concat doom-etc-dir "bookmarks")
|
2020-01-04 17:10:15 -05:00
|
|
|
custom-file (concat doom-local-dir "custom.el")
|
2019-07-21 04:02:09 +02:00
|
|
|
custom-theme-directory (concat doom-private-dir "themes/")
|
|
|
|
desktop-dirname (concat doom-etc-dir "desktop")
|
|
|
|
desktop-base-file-name "autosave"
|
|
|
|
desktop-base-lock-name "autosave-lock"
|
|
|
|
pcache-directory (concat doom-cache-dir "pcache/")
|
|
|
|
request-storage-directory (concat doom-cache-dir "request")
|
|
|
|
server-auth-dir (concat doom-cache-dir "server/")
|
|
|
|
shared-game-score-directory (concat doom-etc-dir "shared-game-score/")
|
|
|
|
tramp-auto-save-directory (concat doom-cache-dir "tramp-auto-save/")
|
|
|
|
tramp-backup-directory-alist backup-directory-alist
|
|
|
|
tramp-persistency-file-name (concat doom-cache-dir "tramp-persistency.el")
|
|
|
|
url-cache-directory (concat doom-cache-dir "url/")
|
|
|
|
url-configuration-directory (concat doom-etc-dir "url/")
|
|
|
|
gamegrid-user-score-file-directory (concat doom-etc-dir "games/"))
|
2019-10-18 22:07:48 -04:00
|
|
|
|
|
|
|
;; HACK Stop sessions from littering the user directory
|
|
|
|
(defadvice! doom--use-cache-dir-a (session-id)
|
|
|
|
:override #'emacs-session-filename
|
|
|
|
(concat doom-cache-dir "emacs-session." session-id))
|
2019-05-15 18:30:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
2019-07-21 04:02:09 +02:00
|
|
|
;;; Optimizations
|
2019-05-15 18:30:20 -04:00
|
|
|
|
2020-03-27 02:33:25 -04:00
|
|
|
;; Disable bidirectional text rendering for a modest performance boost. I've set
|
|
|
|
;; this to `nil' in the past, but the `bidi-display-reordering's docs say this
|
|
|
|
;; isn't a good idea, and suggests this is just as good:
|
2019-12-08 16:11:54 -05:00
|
|
|
(setq-default bidi-display-reordering 'left-to-right
|
|
|
|
bidi-paragraph-direction 'left-to-right)
|
2018-04-03 16:24:15 -04:00
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions
|
|
|
|
;; in non-focused windows.
|
|
|
|
(setq-default cursor-in-non-selected-windows nil)
|
|
|
|
(setq highlight-nonselected-windows nil)
|
2018-04-03 16:24:15 -04:00
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
;; More performant rapid scrolling over unfontified regions. May cause brief
|
|
|
|
;; spells of inaccurate fontification immediately after scrolling.
|
|
|
|
(setq fast-but-imprecise-scrolling t)
|
2019-05-15 18:30:20 -04:00
|
|
|
|
2019-07-21 04:02:09 +02:00
|
|
|
;; Resizing the Emacs frame can be a terribly expensive part of changing the
|
2019-09-03 00:42:36 -04:00
|
|
|
;; font. By inhibiting this, we halve startup times, particularly when we use
|
|
|
|
;; fonts that are larger than the system default (which would resize the frame).
|
2019-07-21 04:02:09 +02:00
|
|
|
(setq frame-inhibit-implied-resize t)
|
|
|
|
|
|
|
|
;; Don't ping things that look like domain names.
|
|
|
|
(setq ffap-machine-p-known 'reject)
|
|
|
|
|
2019-12-06 17:16:34 -05:00
|
|
|
;; Performance on Windows is considerably worse than elsewhere, especially if
|
|
|
|
;; WSL is involved. We'll need everything we can get.
|
2019-07-21 04:02:09 +02:00
|
|
|
(when IS-WINDOWS
|
|
|
|
;; Reduce the workload when doing file IO
|
|
|
|
(setq w32-get-true-file-attributes nil)
|
|
|
|
|
|
|
|
;; Font compacting can be terribly expensive, especially for rendering icon
|
|
|
|
;; fonts on Windows. Whether it has a noteable affect on Linux and Mac hasn't
|
|
|
|
;; been determined.
|
|
|
|
(setq inhibit-compacting-font-caches t))
|
|
|
|
|
2019-12-06 17:16:34 -05:00
|
|
|
;; Remove command line options that aren't relevant to our current OS; means
|
|
|
|
;; slightly less to process at startup.
|
2019-07-21 04:02:09 +02:00
|
|
|
(unless IS-MAC (setq command-line-ns-option-alist nil))
|
|
|
|
(unless IS-LINUX (setq command-line-x-option-alist nil))
|
2019-07-21 03:01:15 +02:00
|
|
|
|
2020-01-09 19:18:13 -05:00
|
|
|
;; Delete files to trash on macOS, as an extra layer of precaution against
|
|
|
|
;; accidentally deleting wanted files.
|
|
|
|
(setq delete-by-moving-to-trash IS-MAC)
|
|
|
|
|
2019-11-21 14:43:36 -05:00
|
|
|
;; Adopt a sneaky garbage collection strategy of waiting until idle time to
|
2019-12-06 17:16:34 -05:00
|
|
|
;; collect; staving off the collector while the user is working.
|
2020-03-27 19:09:19 -04:00
|
|
|
(when doom-interactive-mode
|
|
|
|
(setq gc-cons-percentage 0.6)
|
|
|
|
(add-transient-hook! 'pre-command-hook (gcmh-mode +1))
|
|
|
|
(with-eval-after-load 'gcmh
|
|
|
|
(setq gcmh-idle-delay 10
|
|
|
|
gcmh-high-cons-threshold 16777216
|
|
|
|
gcmh-verbose doom-debug-mode ; 16mb
|
|
|
|
gc-cons-percentage 0.1)
|
|
|
|
(add-hook 'focus-out-hook #'gcmh-idle-garbage-collect)))
|
2019-07-21 03:01:15 +02:00
|
|
|
|
2019-12-23 00:02:10 -05:00
|
|
|
;; HACK `tty-run-terminal-initialization' is *tremendously* slow for some
|
|
|
|
;; reason. Disabling it completely could have many side-effects, so we
|
2020-03-27 02:33:25 -04:00
|
|
|
;; defer it until later, at which time it (somehow) runs very quickly.
|
|
|
|
(advice-add #'tty-run-terminal-initialization :override #'ignore)
|
|
|
|
(add-hook! 'window-setup-hook
|
|
|
|
(defun doom-init-tty-h ()
|
|
|
|
(advice-remove #'tty-run-terminal-initialization #'ignore)
|
|
|
|
(tty-run-terminal-initialization (selected-frame) nil t)))
|
2019-12-22 23:49:36 -05:00
|
|
|
|
2019-07-21 03:01:15 +02:00
|
|
|
|
2019-05-15 18:30:20 -04:00
|
|
|
;;
|
|
|
|
;;; MODE-local-vars-hook
|
2018-06-15 14:58:31 +02:00
|
|
|
|
2018-09-29 14:57:17 -04:00
|
|
|
;; File+dir local variables are initialized after the major mode and its hooks
|
|
|
|
;; have run. If you want hook functions to be aware of these customizations, add
|
|
|
|
;; them to MODE-local-vars-hook instead.
|
2019-07-26 22:05:26 +02:00
|
|
|
(defun doom-run-local-var-hooks-h ()
|
|
|
|
"Run MODE-local-vars-hook after local variables are initialized."
|
|
|
|
(run-hook-wrapped (intern-soft (format "%s-local-vars-hook" major-mode))
|
|
|
|
#'doom-try-run-hook))
|
|
|
|
(add-hook 'hack-local-variables-hook #'doom-run-local-var-hooks-h)
|
2018-09-28 20:49:58 -04:00
|
|
|
|
2019-10-07 16:10:33 -04:00
|
|
|
;; If the user has disabled `enable-local-variables', then
|
|
|
|
;; `hack-local-variables-hook' is never triggered, so we trigger it at the end
|
|
|
|
;; of `after-change-major-mode-hook':
|
2019-07-26 22:05:26 +02:00
|
|
|
(defun doom-run-local-var-hooks-if-necessary-h ()
|
|
|
|
"Run `doom-run-local-var-hooks-h' if `enable-local-variables' is disabled."
|
|
|
|
(unless enable-local-variables
|
|
|
|
(doom-run-local-var-hooks-h)))
|
2019-07-18 15:27:20 +02:00
|
|
|
(add-hook 'after-change-major-mode-hook
|
2019-07-26 22:05:26 +02:00
|
|
|
#'doom-run-local-var-hooks-if-necessary-h
|
|
|
|
'append)
|
2019-07-18 15:27:20 +02:00
|
|
|
|
2018-04-03 16:24:15 -04:00
|
|
|
|
2018-09-18 11:42:35 -04:00
|
|
|
;;
|
2019-04-20 02:18:17 -04:00
|
|
|
;;; Incremental lazy-loading
|
2018-09-18 11:42:35 -04:00
|
|
|
|
|
|
|
(defvar doom-incremental-packages '(t)
|
|
|
|
"A list of packages to load incrementally after startup. Any large packages
|
|
|
|
here may cause noticable pauses, so it's recommended you break them up into
|
2019-05-01 19:12:52 -04:00
|
|
|
sub-packages. For example, `org' is comprised of many packages, and can be
|
|
|
|
broken up into:
|
2018-09-18 11:42:35 -04:00
|
|
|
|
|
|
|
(doom-load-packages-incrementally
|
|
|
|
'(calendar find-func format-spec org-macs org-compat
|
|
|
|
org-faces org-entities org-list org-pcomplete org-src
|
|
|
|
org-footnote org-macro ob org org-clock org-agenda
|
|
|
|
org-capture))
|
|
|
|
|
|
|
|
This is already done by the lang/org module, however.
|
|
|
|
|
|
|
|
If you want to disable incremental loading altogether, either remove
|
2019-07-18 15:27:20 +02:00
|
|
|
`doom-load-packages-incrementally-h' from `emacs-startup-hook' or set
|
2019-09-03 00:42:36 -04:00
|
|
|
`doom-incremental-first-idle-timer' to nil. Incremental loading does not occur
|
|
|
|
in daemon sessions (they are loaded immediately at startup).")
|
2018-09-18 11:42:35 -04:00
|
|
|
|
|
|
|
(defvar doom-incremental-first-idle-timer 2
|
|
|
|
"How long (in idle seconds) until incremental loading starts.
|
|
|
|
|
|
|
|
Set this to nil to disable incremental loading.")
|
|
|
|
|
2019-03-04 18:38:25 -05:00
|
|
|
(defvar doom-incremental-idle-timer 1.5
|
2018-09-18 11:42:35 -04:00
|
|
|
"How long (in idle seconds) in between incrementally loading packages.")
|
|
|
|
|
|
|
|
(defun doom-load-packages-incrementally (packages &optional now)
|
|
|
|
"Registers PACKAGES to be loaded incrementally.
|
|
|
|
|
|
|
|
If NOW is non-nil, load PACKAGES incrementally, in `doom-incremental-idle-timer'
|
|
|
|
intervals."
|
|
|
|
(if (not now)
|
|
|
|
(nconc doom-incremental-packages packages)
|
2019-10-18 22:08:58 -04:00
|
|
|
(while packages
|
|
|
|
(let ((req (pop packages)))
|
|
|
|
(unless (featurep req)
|
2019-06-25 21:38:16 +02:00
|
|
|
(doom-log "Incrementally loading %s" req)
|
|
|
|
(condition-case e
|
2019-08-26 20:36:39 -04:00
|
|
|
(or (while-no-input
|
|
|
|
;; If `default-directory' is a directory that doesn't exist
|
|
|
|
;; or is unreadable, Emacs throws up file-missing errors, so
|
|
|
|
;; we set it to a directory we know exists and is readable.
|
2019-10-18 22:08:58 -04:00
|
|
|
(let ((default-directory doom-emacs-dir)
|
|
|
|
(gc-cons-threshold most-positive-fixnum)
|
|
|
|
file-name-handler-alist)
|
2019-08-26 20:36:39 -04:00
|
|
|
(require req nil t))
|
|
|
|
t)
|
2019-10-18 22:08:58 -04:00
|
|
|
(push req packages))
|
2019-06-25 21:38:16 +02:00
|
|
|
((error debug)
|
|
|
|
(message "Failed to load '%s' package incrementally, because: %s"
|
|
|
|
req e)))
|
2019-10-18 22:08:58 -04:00
|
|
|
(if (not packages)
|
|
|
|
(doom-log "Finished incremental loading")
|
|
|
|
(run-with-idle-timer doom-incremental-idle-timer
|
|
|
|
nil #'doom-load-packages-incrementally
|
|
|
|
packages t)
|
|
|
|
(setq packages nil)))))))
|
2018-09-18 11:42:35 -04:00
|
|
|
|
2019-07-26 22:05:26 +02:00
|
|
|
(defun doom-load-packages-incrementally-h ()
|
|
|
|
"Begin incrementally loading packages in `doom-incremental-packages'.
|
2018-09-18 11:42:35 -04:00
|
|
|
|
|
|
|
If this is a daemon session, load them all immediately instead."
|
2019-07-26 22:05:26 +02:00
|
|
|
(if (daemonp)
|
|
|
|
(mapc #'require (cdr doom-incremental-packages))
|
|
|
|
(when (integerp doom-incremental-first-idle-timer)
|
|
|
|
(run-with-idle-timer doom-incremental-first-idle-timer
|
|
|
|
nil #'doom-load-packages-incrementally
|
|
|
|
(cdr doom-incremental-packages) t))))
|
|
|
|
|
|
|
|
(add-hook 'emacs-startup-hook #'doom-load-packages-incrementally-h)
|
2018-09-18 11:42:35 -04:00
|
|
|
|
|
|
|
|
2018-05-14 18:40:35 +02:00
|
|
|
;;
|
2019-04-20 02:18:17 -04:00
|
|
|
;;; Bootstrap helpers
|
2018-05-14 18:40:35 +02:00
|
|
|
|
2018-06-18 14:47:36 +02:00
|
|
|
(defun doom-try-run-hook (hook)
|
2019-12-06 17:16:34 -05:00
|
|
|
"Run HOOK (a hook function) with better error handling.
|
2018-06-18 14:47:36 +02:00
|
|
|
Meant to be used with `run-hook-wrapped'."
|
2019-03-04 18:38:25 -05:00
|
|
|
(doom-log "Running doom hook: %s" hook)
|
2018-09-18 11:45:13 -04:00
|
|
|
(condition-case e
|
|
|
|
(funcall hook)
|
|
|
|
((debug error)
|
|
|
|
(signal 'doom-hook-error (list hook e))))
|
|
|
|
;; return nil so `run-hook-wrapped' won't short circuit
|
|
|
|
nil)
|
2018-06-18 14:47:36 +02:00
|
|
|
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun doom-display-benchmark-h (&optional return-p)
|
2020-03-27 02:33:25 -04:00
|
|
|
"Display a benchmark including number of packages and modules loaded.
|
2018-06-11 23:18:15 +02:00
|
|
|
|
|
|
|
If RETURN-P, return the message as a string instead of displaying it."
|
|
|
|
(funcall (if return-p #'format #'message)
|
2019-07-18 15:27:20 +02:00
|
|
|
"Doom loaded %d packages across %d modules in %.03fs"
|
|
|
|
(- (length load-path) (length doom--initial-load-path))
|
2018-06-11 23:18:15 +02:00
|
|
|
(if doom-modules (hash-table-count doom-modules) 0)
|
|
|
|
(or doom-init-time
|
2019-09-03 00:42:36 -04:00
|
|
|
(setq doom-init-time
|
|
|
|
(float-time (time-subtract (current-time) before-init-time))))))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2019-12-05 14:52:30 -05:00
|
|
|
(defun doom-load-autoloads-file (file &optional noerror)
|
|
|
|
"Tries to load FILE (an autoloads file).
|
|
|
|
Return t on success, nil otherwise (but logs a warning)."
|
2019-03-06 21:16:07 -05:00
|
|
|
(condition-case e
|
2019-12-06 17:16:34 -05:00
|
|
|
(load (substring file 0 -3) noerror 'nomessage)
|
2019-03-06 21:16:07 -05:00
|
|
|
((debug error)
|
2019-11-07 20:55:57 -05:00
|
|
|
(message "Autoload file error: %s -> %s" (file-name-nondirectory file) e)
|
|
|
|
nil)))
|
2018-06-11 23:18:15 +02:00
|
|
|
|
2019-07-22 22:28:43 +02:00
|
|
|
(defun doom-load-envvars-file (file &optional noerror)
|
2019-12-05 14:52:30 -05:00
|
|
|
"Read and set envvars from FILE.
|
|
|
|
If NOERROR is non-nil, don't throw an error if the file doesn't exist or is
|
2019-12-06 17:16:34 -05:00
|
|
|
unreadable. Returns the names of envvars that were changed."
|
2019-06-18 11:44:50 +02:00
|
|
|
(if (not (file-readable-p file))
|
2019-07-22 22:28:43 +02:00
|
|
|
(unless noerror
|
|
|
|
(signal 'file-error (list "Couldn't read envvar file" file)))
|
2019-11-21 17:14:10 -05:00
|
|
|
(let (envvars environment)
|
2019-09-03 00:42:36 -04:00
|
|
|
(with-temp-buffer
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(save-excursion
|
|
|
|
(insert "\n")
|
|
|
|
(insert-file-contents file))
|
2019-11-19 19:09:44 -05:00
|
|
|
(while (re-search-forward "\n *\\([^#= \n]*\\)=" nil t)
|
2019-11-21 17:14:10 -05:00
|
|
|
(push (match-string 1) envvars)
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(push (buffer-substring
|
|
|
|
(match-beginning 1)
|
|
|
|
(1- (or (save-excursion
|
|
|
|
(when (re-search-forward "^\\([^= ]+\\)=" nil t)
|
|
|
|
(line-beginning-position)))
|
|
|
|
(point-max))))
|
|
|
|
environment)))
|
|
|
|
(when environment
|
2020-01-27 00:51:12 -05:00
|
|
|
(setq process-environment
|
|
|
|
(append (nreverse environment) process-environment)
|
|
|
|
exec-path
|
|
|
|
(if (member "PATH" envvars)
|
|
|
|
(append (split-string (getenv "PATH") path-separator t)
|
|
|
|
(list exec-directory))
|
|
|
|
exec-path)
|
|
|
|
shell-file-name
|
|
|
|
(if (member "SHELL" envvars)
|
|
|
|
(or (getenv "SHELL") shell-file-name)
|
|
|
|
shell-file-name))
|
2019-11-21 17:14:10 -05:00
|
|
|
envvars))))
|
2019-05-17 20:19:35 -04:00
|
|
|
|
2019-12-05 14:52:30 -05:00
|
|
|
(defun doom-initialize (&optional force-p noerror)
|
2019-03-06 21:16:07 -05:00
|
|
|
"Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil).
|
2018-08-08 21:43:50 +02:00
|
|
|
|
2019-12-05 14:52:30 -05:00
|
|
|
The bootstrap process ensures that the essential directories exist, all core
|
|
|
|
packages are installed, `doom-autoload-file' and `doom-package-autoload-file'
|
|
|
|
exist and are loaded, and that `core-packages' is auto-loaded when `package' or
|
|
|
|
`straight' are.
|
2018-06-11 23:18:15 +02:00
|
|
|
|
|
|
|
The overall load order of Doom is as follows:
|
|
|
|
|
|
|
|
~/.emacs.d/init.el
|
|
|
|
~/.emacs.d/core/core.el
|
|
|
|
~/.doom.d/init.el
|
|
|
|
Module init.el files
|
2019-03-04 20:35:47 -05:00
|
|
|
`doom-before-init-modules-hook'
|
2018-06-11 23:18:15 +02:00
|
|
|
Module config.el files
|
|
|
|
~/.doom.d/config.el
|
2019-03-04 20:35:47 -05:00
|
|
|
`doom-init-modules-hook'
|
2020-03-27 02:33:25 -04:00
|
|
|
`doom-after-init-hook' (`after-init-hook')
|
2018-06-11 23:18:15 +02:00
|
|
|
`emacs-startup-hook'
|
2019-03-04 20:35:47 -05:00
|
|
|
`doom-init-ui-hook'
|
|
|
|
`window-setup-hook'
|
2018-06-11 23:18:15 +02:00
|
|
|
|
|
|
|
Module load order is determined by your `doom!' block. See `doom-modules-dirs'
|
|
|
|
for a list of all recognized module trees. Order defines precedence (from most
|
|
|
|
to least)."
|
|
|
|
(when (or force-p (not doom-init-p))
|
2019-07-21 03:01:15 +02:00
|
|
|
(setq doom-init-p t)
|
2018-07-09 15:33:31 +02:00
|
|
|
|
2019-07-22 22:28:43 +02:00
|
|
|
;; Reset as much state as possible, so `doom-initialize' can be treated like
|
2020-03-27 02:33:25 -04:00
|
|
|
;; a reset function. e.g. when reloading the config.
|
2019-10-07 16:10:33 -04:00
|
|
|
(setq-default exec-path doom--initial-exec-path
|
|
|
|
load-path doom--initial-load-path
|
|
|
|
process-environment doom--initial-process-environment)
|
2019-04-09 03:43:13 -04:00
|
|
|
|
2019-12-15 23:51:59 -05:00
|
|
|
;; Load shell environment, optionally generated from 'doom env'. No need to
|
|
|
|
;; do so if we're in terminal Emacs, because Emacs will correctly inherit
|
|
|
|
;; your shell environment there.
|
2019-08-23 20:33:30 -04:00
|
|
|
(when (and (or (display-graphic-p)
|
|
|
|
(daemonp))
|
|
|
|
(file-exists-p doom-env-file))
|
|
|
|
(doom-load-envvars-file doom-env-file))
|
|
|
|
|
2019-10-18 22:07:48 -04:00
|
|
|
(require 'core-modules)
|
2019-07-22 22:28:43 +02:00
|
|
|
(let (;; `doom-autoload-file' tells Emacs where to load all its functions
|
|
|
|
;; from. This includes everything in core/autoload/*.el and autoload
|
|
|
|
;; files in enabled modules.
|
2019-12-05 14:52:30 -05:00
|
|
|
(core-autoloads-p (doom-load-autoloads-file doom-autoload-file noerror))
|
2019-07-22 22:28:43 +02:00
|
|
|
;; Loads `doom-package-autoload-file', which loads a concatenated
|
|
|
|
;; package autoloads file which caches `load-path', `auto-mode-alist',
|
|
|
|
;; `Info-directory-list', and `doom-disabled-packages'. A big
|
|
|
|
;; reduction in startup time.
|
2019-12-05 14:52:30 -05:00
|
|
|
(pkg-autoloads-p (doom-load-autoloads-file doom-package-autoload-file noerror)))
|
2019-07-22 22:28:43 +02:00
|
|
|
|
2019-11-04 17:21:25 -05:00
|
|
|
(if (and core-autoloads-p pkg-autoloads-p (not force-p))
|
2019-07-22 22:28:43 +02:00
|
|
|
;; In case we want to use package.el or straight via M-x
|
|
|
|
(progn
|
2019-07-26 20:07:48 +02:00
|
|
|
(with-eval-after-load 'package
|
2019-07-22 22:28:43 +02:00
|
|
|
(require 'core-packages))
|
2019-07-26 20:07:48 +02:00
|
|
|
(with-eval-after-load 'straight
|
|
|
|
(require 'core-packages)
|
2019-07-22 22:28:43 +02:00
|
|
|
(doom-initialize-packages)))
|
|
|
|
|
2019-12-05 14:52:46 -05:00
|
|
|
;; Eagerly load these libraries because we may be in a session that hasn't been
|
|
|
|
;; fully initialized (e.g. where autoloads files haven't been generated or
|
|
|
|
;; `load-path' populated).
|
|
|
|
(mapc (doom-rpartial #'load nil (not doom-debug-mode) 'nosuffix)
|
|
|
|
(file-expand-wildcards (concat doom-core-dir "autoload/*.el")))
|
|
|
|
|
2019-07-22 22:28:43 +02:00
|
|
|
;; Create all our core directories to quell file errors
|
2020-01-26 21:21:06 -05:00
|
|
|
(mapc (doom-rpartial #'make-directory 'parents)
|
|
|
|
(list doom-local-dir
|
|
|
|
doom-etc-dir
|
|
|
|
doom-cache-dir))
|
2019-07-22 22:28:43 +02:00
|
|
|
|
|
|
|
;; Ensure the package management system (and straight) are ready for
|
|
|
|
;; action (and all core packages/repos are installed)
|
|
|
|
(require 'core-packages)
|
|
|
|
(doom-initialize-packages force-p))
|
|
|
|
|
|
|
|
(unless (or (and core-autoloads-p pkg-autoloads-p)
|
2019-12-05 14:52:30 -05:00
|
|
|
noerror)
|
2019-07-22 22:28:43 +02:00
|
|
|
(unless core-autoloads-p
|
2019-09-03 00:42:36 -04:00
|
|
|
(warn "Your Doom core autoloads file is missing"))
|
2019-07-22 22:28:43 +02:00
|
|
|
(unless pkg-autoloads-p
|
2019-09-03 00:42:36 -04:00
|
|
|
(warn "Your package autoloads file is missing"))
|
2019-12-29 18:47:12 -05:00
|
|
|
(signal 'doom-autoload-error (list "Run `bin/doom refresh' to generate them")))
|
|
|
|
|
|
|
|
(when doom-interactive-mode
|
|
|
|
(add-hook 'window-setup-hook #'doom-display-benchmark-h 'append)
|
|
|
|
(add-to-list 'command-switch-alist (cons "--restore" #'doom-restore-session-handler))))
|
2019-09-03 00:42:36 -04:00
|
|
|
t))
|
2019-08-23 20:33:30 -04:00
|
|
|
|
|
|
|
(defun doom-initialize-core ()
|
|
|
|
"Load Doom's core files for an interactive session."
|
|
|
|
(require 'core-keybinds)
|
|
|
|
(require 'core-ui)
|
|
|
|
(require 'core-projects)
|
|
|
|
(require 'core-editor))
|
2017-06-08 11:47:56 +02:00
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
(provide 'core)
|
|
|
|
;;; core.el ends here
|