Updating dotfiles.

This commit is contained in:
Derek Taylor
2020-09-29 16:28:27 -05:00
parent e8ae19d7ad
commit af5b75ee4d
204 changed files with 1870 additions and 2063 deletions

View File

@@ -179,9 +179,11 @@ If DERIVED-P, test with `derived-mode-p', otherwise use `eq'."
;;;###autoload
(defun doom-visible-buffers (&optional buffer-list)
"Return a list of visible buffers (i.e. not buried)."
(if buffer-list
(cl-remove-if-not #'get-buffer-window buffer-list)
(delete-dups (mapcar #'window-buffer (window-list)))))
(let ((buffers (delete-dups (mapcar #'window-buffer (window-list)))))
(if buffer-list
(cl-delete-if (lambda (b) (memq b buffer-list))
buffers)
(delete-dups buffers))))
;;;###autoload
(defun doom-buried-buffers (&optional buffer-list)

View File

@@ -98,7 +98,7 @@ Runs `doom-reload-hook' afterwards."
;;;###autoload
(defun doom/reload-autoloads ()
"Reload only `doom-autoload-file' and `doom-package-autoload-file'.
"Reload only `doom-autoloads-file' and `doom-package-autoload-file'.
This is much faster and safer than `doom/reload', but not as comprehensive. This
reloads your package and module visibility, but does not install new packages or

View File

@@ -5,26 +5,62 @@
;;;###autoload
(defvar doom-debug-variables
'(doom-debug-p
init-file-debug
debug-on-error
'(debug-on-error
doom-debug-p
garbage-collection-messages
use-package-verbose
jka-compr-verbose
lsp-log-io
gcmh-verbose
magit-refresh-verbose
url-debug)
"A list of variable to toggle on `doom-debug-mode'.")
init-file-debug
jka-compr-verbose
url-debug
use-package-verbose)
"A list of variable to toggle on `doom-debug-mode'.
Each entry can be a variable symbol or a cons cell whose CAR is the variable
symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
(defvar doom--debug-vars-old-values nil)
(defvar doom--debug-vars-undefined nil)
(defun doom--watch-debug-vars-h (&rest _)
(when-let (bound-vars (cl-remove-if-not #'boundp doom--debug-vars-undefined))
(doom-log "New variables available: %s" bound-vars)
(let ((message-log-max nil))
(doom-debug-mode -1)
(doom-debug-mode +1))))
;;;###autoload
(define-minor-mode doom-debug-mode
"Toggle `debug-on-error' and `doom-debug-p' for verbose logging."
:init-value nil
:global t
(let ((value doom-debug-mode))
(mapc (doom-rpartial #'set value) doom-debug-variables)
(message "Debug mode %s" (if value "on" "off"))))
(let ((enabled doom-debug-mode))
(setq doom--debug-vars-undefined nil)
(dolist (var doom-debug-variables)
(cond ((listp var)
(cl-destructuring-bind (var . val) var
(if (not (boundp var))
(add-to-list 'doom--debug-vars-undefined var)
(set-default
var (if (not enabled)
(alist-get var doom--debug-vars-old-values)
(setf (alist-get var doom--debug-vars-old-values)
(symbol-value var))
val)))))
((if (boundp var)
(set-default var enabled)
(add-to-list 'doom--debug-vars-undefined var)))))
(when (fboundp 'explain-pause-mode)
(explain-pause-mode enabled))
;; Watch for changes in `doom-debug-variables', or when packages load (and
;; potentially define one of `doom-debug-variables'), in case some of them
;; aren't defined when `doom-debug-mode' is first loaded.
(cond (enabled
(add-variable-watcher 'doom-debug-variables #'doom--watch-debug-vars-h)
(add-hook 'after-load-functions #'doom--watch-debug-vars-h))
(t
(remove-variable-watcher 'doom-debug-variables #'doom--watch-debug-vars-h)
(remove-hook 'after-load-functions #'doom--watch-debug-vars-h)))
(message "Debug mode %s" (if enabled "on" "off"))))
;;
@@ -68,35 +104,44 @@
ready to be pasted in a bug report on github."
(require 'vc-git)
(require 'core-packages)
(let ((default-directory doom-emacs-dir)
(doom-modules (doom-module-list)))
(letf! (defun sh (&rest args) (cdr (apply #'doom-call-process args)))
`((emacs
(version . ,emacs-version)
(features ,@system-configuration-features)
(build . ,(format-time-string "%b %d, %Y" emacs-build-time))
(buildopts ,system-configuration-options)
(windowsys . ,(if doom-interactive-p window-system 'batch))
(daemonp . ,(cond ((daemonp) 'daemon)
((and (require 'server)
(server-running-p))
'server-running))))
(doom
(version . ,doom-version)
(build . ,(sh "git" "log" "-1" "--format=%D %h %ci"))
(dir . ,(abbreviate-file-name (file-truename doom-private-dir))))
(system
(type . ,system-type)
(let ((default-directory doom-emacs-dir))
(letf! ((defun sh (&rest args) (cdr (apply #'doom-call-process args)))
(defun abbrev-path (path)
(replace-regexp-in-string
(regexp-quote (user-login-name)) "$USER"
(abbreviate-file-name path))))
`((system
(type . ,system-type)
(config . ,system-configuration)
(shell . ,shell-file-name)
(uname . ,(if IS-WINDOWS
"n/a"
(sh "uname" "-msrv")))
(path . ,(mapcar #'abbreviate-file-name exec-path)))
(config
(envfile
. ,(cond ((file-exists-p doom-env-file) 'envvar-file)
((featurep 'exec-path-from-shell) 'exec-path-from-shell)))
(shell . ,(abbrev-path shell-file-name))
(uname . ,(if IS-WINDOWS "n/a" (sh "uname" "-msrv")))
(path . ,(mapcar #'abbrev-path exec-path)))
(emacs
(dir . ,(abbrev-path (file-truename doom-emacs-dir)))
(version . ,emacs-version)
(build . ,(format-time-string "%b %d, %Y" emacs-build-time))
(buildopts . ,system-configuration-options)
(features . ,system-configuration-features)
(traits . ,(delq
nil (list (if (not doom-interactive-p) 'batch)
(if (daemonp) 'daemon)
(if (and (require 'server)
(server-running-p))
'server-running)
(if (boundp 'chemacs-profiles-path)
'chemacs)
(if (file-exists-p doom-env-file)
'envvar-file)
(if (featurep 'exec-path-from-shell)
'exec-path-from-shell)
(if (file-symlink-p user-emacs-directory)
'symlinked-emacsdir)
(if (file-symlink-p doom-private-dir)
'symlinked-doomdir)))))
(doom
(dir . ,(abbrev-path (file-truename doom-private-dir)))
(version . ,doom-version)
(build . ,(sh "git" "log" "-1" "--format=%D %h %ci"))
(elc-files
. ,(length (doom-files-in `(,@doom-modules-dirs
,doom-core-dir
@@ -110,10 +155,18 @@ ready to be pasted in a bug report on github."
do (setq cat (car key))
and collect cat
collect
(let ((flags (doom-module-get cat (cdr key) :flags)))
(if flags
`(,(cdr key) ,@flags)
(cdr key))))
(let* ((flags (doom-module-get cat (cdr key) :flags))
(path (doom-module-get cat (cdr key) :path))
(module (append (cond ((null path)
(list '&nopath))
((file-in-directory-p path doom-private-dir)
(list '&user)))
(if flags
`(,(cdr key) ,@flags)
(list (cdr key))))))
(if (= (length module) 1)
(car module)
module)))
'("n/a")))
(packages
,@(or (condition-case e
@@ -150,16 +203,10 @@ ready to be pasted in a bug report on github."
"Display the current version of Doom & Emacs, including the current Doom
branch and commit."
(interactive)
(require 'vc-git)
(let ((default-directory doom-core-dir))
(print! "Doom v%s (%s)\nEmacs v%s\nBranch: %s\nBuild date: %s"
(print! "Doom v%s (%s)"
doom-version
(or (vc-git-working-revision doom-core-dir)
"n/a")
emacs-version
(or (vc-git--symbolic-ref doom-core-dir)
"n/a")
(or (cdr (doom-call-process "git" "log" "-1" "--format=%ci"))
(or (cdr (doom-call-process "git" "log" "-1" "--format=%D %h %ci"))
"n/a"))))
;;;###autoload
@@ -190,7 +237,7 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
(insert "<details>\n\n```\n")
(dolist (group info)
(insert! "%-8s%-10s %s\n"
((car group)
((upcase (symbol-name (car group)))
(caadr group)
(cdadr group)))
(dolist (spec (cddr group))

View File

@@ -11,12 +11,9 @@
(csharp-mode :lang csharp)
(clojure-mode :lang clojure)
(clojurescript-mode :lang clojure)
(graphql-mode :lang data)
(toml-mode :lang data)
(json-mode :lang data)
(yaml-mode :lang data)
(json-mode :lang json)
(yaml-mode :lang yaml)
(csv-mode :lang data)
(dhall-mode :lang data)
(erlang-mode :lang erlang)
(elixir-mode :lang elixir)
(elm-mode :lang elm)
@@ -193,7 +190,7 @@ selection of all minor-modes, active or not."
"troubleshooting.org"
"tutorials.org"
"faq.org")
2 t initial-input
3 t initial-input
(mapcar (lambda (x)
(setcar x (concat "Doom Modules > " (car x)))
x)

View File

@@ -106,10 +106,11 @@ in some cases."
(thing
(thing-at-point thing t))
((require 'xref nil t)
;; Eglot defines a dummy for `xref-find-backend', so we need a special
;; case to avoid xref when using eglot. See
;; https://github.com/joaotavora/eglot/issues/503
(if (eq (xref-find-backend) 'eglot)
;; Eglot, nox (a fork of eglot), and elpy implementations for
;; `xref-backend-identifier-at-point' betray the documented purpose of
;; the interface. Eglot/nox return a hardcoded string and elpy prepends
;; the line number to the symbol.
(if (memq (xref-find-backend) '(eglot elpy nox))
(thing-at-point 'symbol t)
;; A little smarter than using `symbol-at-point', though in most
;; cases, xref ends up using `symbol-at-point' anyway.

View File

@@ -113,48 +113,77 @@ See `display-line-numbers' for what these values mean."
(delete-frame))
(save-buffers-kill-emacs)))
(defvar doom--maximize-last-wconf nil)
;;;###autoload
(defun doom/window-maximize-buffer ()
"Close other windows to focus on this one. Activate again to undo this. If the
window changes before then, the undo expires.
Alternatively, use `doom/window-enlargen'."
(interactive)
(setq doom--maximize-last-wconf
(if (and (null (cdr (cl-remove-if #'window-dedicated-p (window-list))))
doom--maximize-last-wconf)
(ignore (set-window-configuration doom--maximize-last-wconf))
(when (and (bound-and-true-p +popup-mode)
(+popup-window-p))
(user-error "Cannot maximize a popup, use `+popup/raise' first or use `doom/window-enlargen' instead"))
(prog1 (current-window-configuration)
(delete-other-windows)))))
(defun doom--enlargened-forget-last-wconf-h ()
(set-frame-parameter nil 'doom--maximize-last-wconf nil)
(set-frame-parameter nil 'doom--enlargen-last-wconf nil)
(remove-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h))
(defvar doom--enlargen-last-wconf nil)
;;;###autoload
(defun doom/window-enlargen ()
(defun doom/window-maximize-buffer (&optional arg)
"Close other windows to focus on this one.
Activate again to undo this. If prefix ARG is non-nil, don't restore the last
window configuration and re-maximize the current window. Alternatively, use
`doom/window-enlargen'."
(interactive "P")
(let ((param 'doom--maximize-last-wconf))
(cl-destructuring-bind (window . wconf)
(or (frame-parameter nil param)
(cons nil nil))
(set-frame-parameter
nil param
(if (and (equal window (selected-window))
(not arg)
(null (cdr (cl-remove-if #'window-dedicated-p (window-list))))
wconf)
(ignore
(let ((source-window (selected-window)))
(set-window-configuration wconf)
(when (window-live-p source-window)
(select-window source-window))))
(when (and (bound-and-true-p +popup-mode)
(+popup-window-p))
(user-error "Cannot maximize a popup, use `+popup/raise' first or use `doom/window-enlargen' instead"))
(prog1 (cons (selected-window) (or wconf (current-window-configuration)))
(delete-other-windows)
(add-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h)))))))
;;;###autoload
(defun doom/window-enlargen (&optional arg)
"Enlargen the current window to focus on this one. Does not close other
windows (unlike `doom/window-maximize-buffer'). Activate again to undo."
(interactive)
(setq doom--enlargen-last-wconf
(if doom--enlargen-last-wconf
(ignore (set-window-configuration doom--enlargen-last-wconf))
(prog1 (current-window-configuration)
(let* ((window (selected-window))
(dedicated-p (window-dedicated-p window))
(preserved-p (window-parameter window 'window-preserved-size))
(ignore-window-parameters t))
(unwind-protect
(progn
(when dedicated-p
(set-window-dedicated-p window nil))
(when preserved-p
(set-window-parameter window 'window-preserved-size nil))
(maximize-window window))
(set-window-dedicated-p window dedicated-p)
(when preserved-p
(set-window-parameter window 'window-preserved-size preserved-p))))))))
(interactive "P")
(let ((param 'doom--enlargen-last-wconf))
(cl-destructuring-bind (window . wconf)
(or (frame-parameter nil param)
(cons nil nil))
(set-frame-parameter
nil param
(if (and (equal window (selected-window))
(not arg)
wconf)
(ignore
(let ((source-window (selected-window)))
(set-window-configuration wconf)
(when (window-live-p source-window)
(select-window source-window))))
(prog1 (cons (selected-window) (or wconf (current-window-configuration)))
(let* ((window (selected-window))
(dedicated-p (window-dedicated-p window))
(preserved-p (window-parameter window 'window-preserved-size))
(ignore-window-parameters t))
(unwind-protect
(progn
(when dedicated-p
(set-window-dedicated-p window nil))
(when preserved-p
(set-window-parameter window 'window-preserved-size nil))
(maximize-window window))
(set-window-dedicated-p window dedicated-p)
(when preserved-p
(set-window-parameter window 'window-preserved-size preserved-p))
(add-hook 'doom-switch-window-hook #'doom--enlargened-forget-last-wconf-h)))))))))
;;;###autoload
(defun doom/window-maximize-horizontally ()

View File

@@ -14,7 +14,7 @@ one wants that.")
auto-mode-alist
interpreter-mode-alist
Info-directory-list)
"A list of variables to be cached in `doom-autoload-file'.")
"A list of variables to be cached in `doom-autoloads-file'.")
(defvar doom-autoloads-files ()
"A list of additional files or file globs to scan for autoloads.")
@@ -26,7 +26,7 @@ one wants that.")
(defun doom-autoloads-reload (&optional file)
"Regenerates Doom's autoloads and writes them to FILE."
(unless file
(setq file doom-autoload-file))
(setq file doom-autoloads-file))
(print! (start "(Re)generating autoloads file..."))
(print-group!
(cl-check-type file string)

View File

@@ -59,6 +59,16 @@ in."
"typically installed. If you're seeing a vanilla Emacs splash screen, this "
"may explain why. If you use Chemacs, you may ignore this warning."))
(when EMACS27+
(print! (start "Checking for great Emacs features..."))
(unless (and (functionp 'json-serialize)
(string-match-p "\\_<JSON\\_>" system-configuration-features))
(warn! "Emacs was not built with native JSON support")
(explain! "Users will see a substantial performance gain by building Emacs with "
"jansson support (i.e. a native JSON library), particularly LSP users. "
"You must install a prebuilt Emacs binary with this included, or compile "
"Emacs with the --with-json option.")))
(print! (start "Checking for private config conflicts..."))
(let ((xdg-dir (concat (or (getenv "XDG_CONFIG_HOME")
"~/.config")

View File

@@ -61,11 +61,14 @@ Why this over exec-path-from-shell?
;; Helpers
(defvar doom-env-blacklist
'("^DBUS_SESSION_BUS_ADDRESS$"
"^GPG_AGENT_INFO$" "^\\(SSH\\|GPG\\)_TTY$"
"^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$"
"^HOME$" "^PWD$" "^PS1$" "^R?PROMPT$" "^TERM$"
;; Doom envvars
'(;; State that may be problematic if overwritten
"^HOME$" "^\\(OLD\\)?PWD$" "^SHLVL$" "^PS1$" "^R?PROMPT$" "^TERM$" "^USER$"
;; X server or services' variables
"^DISPLAY$" "^DBUS_SESSION_BUS_ADDRESS$"
;; ssh and gpg variables (likely to become stale)
"^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$" "^\\(SSH\\|GPG\\)_TTY$"
"^GPG_AGENT_INFO$"
;; Internal Doom envvars
"^DEBUG$" "^INSECURE$" "^YES$" "^__")
"Environment variables to not save in `doom-env-file'.

View File

@@ -74,7 +74,7 @@
:bare t
(if command
(doom--cli-print (doom-cli-get (intern command)))
(doom--cli-print (doom-cli-get :main))
(doom--cli-print (doom-cli-get :doom))
(terpri)
(print! (bold "Commands:"))
(print-group!

View File

@@ -126,8 +126,14 @@ list remains lean."
(doom-log "%s is newer than %s" file elc-file)
t)))
;; DEPRECATED Remove later
(defun doom--comp-output-filename (file)
(if (fboundp 'comp-output-filename)
(comp-output-filename file)
(comp-el-to-eln-filename file)))
(defun doom--eln-file-outdated-p (file)
(when-let* ((eln-file (comp-output-filename file))
(when-let* ((eln-file (doom--comp-output-filename file))
(error-file (concat eln-file ".error")))
(push eln-file doom--expected-eln-files)
(cond ((file-exists-p eln-file)
@@ -144,7 +150,7 @@ list remains lean."
(defun doom--native-compile-done-h (file)
(when-let* ((file)
(eln-file (comp-output-filename file))
(eln-file (doom--comp-output-filename file))
(error-file (concat eln-file ".error")))
(if (file-exists-p eln-file)
(doom-log "Compiled %s" eln-file)
@@ -484,8 +490,9 @@ If ELPA-P, include packages installed with package.el (M-x package-install)."
(and (or repos-p regraft-repos-p)
(straight--directory-files (straight--repos-dir) nil nil 'sort))))
(list (when builds-p
(seq-remove (doom-rpartial #'gethash straight--profile-cache)
(straight--directory-files (straight--build-dir) nil nil 'sort)))
(seq-filter #'file-directory-p
(seq-remove (doom-rpartial #'gethash straight--profile-cache)
(straight--directory-files (straight--build-dir) nil nil 'sort))))
(when repos-p
(seq-remove (doom-rpartial #'straight--checkhash straight--repo-cache)
rdirs))

View File

@@ -17,16 +17,17 @@ following shell commands:
(let ((doom-auto-discard force-p))
(cond
(packages-only-p
(doom-cli-execute "sync" '("-u"))
(doom-cli-execute "sync" "-u")
(print! (success "Finished upgrading Doom Emacs")))
((doom-cli-upgrade doom-auto-accept doom-auto-discard)
;; Reload Doom's CLI & libraries, in case there were any upstream changes.
;; Major changes will still break, however
(print! (info "Reloading Doom Emacs"))
(doom-cli-execute-after "doom" "upgrade" "-p" (if force-p "-f")))
(throw 'exit (list "doom" "upgrade" "-p" (if force-p "-f"))))
((print! "Doom is up-to-date!")))))
((print! "Doom is up-to-date!")
(doom-cli-execute "sync" "-u")))))
;;
@@ -92,7 +93,7 @@ following shell commands:
((equal this-rev new-rev)
(print! (success "Doom is already up-to-date!"))
t)
nil)
((print! (info "A new version of Doom Emacs is available!\n\n Old revision: %s (%s)\n New revision: %s (%s)\n"
(substring this-rev 0 10)

View File

@@ -1,13 +1,12 @@
;;; -*- lexical-binding: t; no-byte-compile: t; -*-
(require 'seq)
;;; core/core-cli.el --- -*- lexical-binding: t; no-byte-compile: t; -*-
(load! "autoload/process")
(load! "autoload/plist")
(load! "autoload/files")
(load! "autoload/output")
(require 'seq)
;; Create all our core directories to quell file errors
;; Create all our core directories to quell file errors.
(mapc (doom-rpartial #'make-directory 'parents)
(list doom-local-dir
doom-etc-dir
@@ -21,6 +20,9 @@
;; Don't generate superfluous files when writing temp buffers
(setq make-backup-files nil)
;; Stop user configuration from interfering with Doom
(setq enable-dir-local-variables nil)
;;
;;; Variables
@@ -40,10 +42,26 @@ These are loaded when a Doom's CLI starts up. There users and modules can define
additional CLI commands, or reconfigure existing ones to better suit their
purpose.")
(defvar doom-cli-log-file (concat doom-local-dir "doom.log")
"File to write the extended output to.")
(defvar doom-cli-log-error-file (concat doom-local-dir "doom.error.log")
"File to write the last backtrace to.")
(defvar doom--cli-commands (make-hash-table :test 'equal))
(defvar doom--cli-groups (make-hash-table :test 'equal))
(defvar doom--cli-group nil)
(define-error 'doom-cli-error "There was an unexpected error" 'doom-error)
(define-error 'doom-cli-command-not-found-error "Could not find that command" 'doom-cli-error)
(define-error 'doom-cli-wrong-number-of-arguments-error "Wrong number of CLI arguments" 'doom-cli-error)
(define-error 'doom-cli-unrecognized-option-error "Not a recognized option" 'doom-cli-error)
(define-error 'doom-cli-deprecated-error "Command is deprecated" 'doom-cli-error)
;;
;;; CLI library
(cl-defstruct
(doom-cli
(:constructor nil)
@@ -159,7 +177,7 @@ purpose.")
"Return non-nil if CLI is an internal (non-public) command."
(string-prefix-p ":" (doom-cli-name cli)))
(defun doom-cli-execute (command &optional args)
(defun doom-cli-execute (command &rest args)
"Execute COMMAND (string) with ARGS (list of strings).
Executes a cli defined with `defcli!' with the name or alias specified by
@@ -169,24 +187,6 @@ COMMAND, and passes ARGS to it."
(doom--cli-process cli (remq nil args)))
(user-error "Couldn't find any %S command" command)))
(defun doom-cli-execute-after (&rest args)
"Execute shell command ARGS after this CLI session quits.
This is particularly useful when the capabilities of Emacs' batch terminal are
insufficient (like opening an instance of Emacs, or reloading Doom after a 'doom
upgrade')."
(let ((post-script (concat doom-local-dir ".doom.sh")))
(with-temp-file post-script
(insert "#!/usr/bin/env sh\n"
"rm -f " (prin1-to-string post-script) "\n"
"exec " (mapconcat #'shell-quote-argument (remq nil args) " ")
"\n"))
(let* ((current-mode (file-modes post-script))
(add-mode (logand ?\111 (default-file-modes))))
(or (/= (logand ?\111 current-mode) 0)
(zerop add-mode)
(set-file-modes post-script (logior current-mode add-mode))))))
(defmacro defcli! (name speclist &optional docstring &rest body)
"Defines a CLI command.
@@ -247,6 +247,65 @@ BODY will be run when this dispatcher is called."
,@body))
;;
;;; Debugger
(cl-defun doom-cli--debugger (error data)
(cl-incf num-nonmacro-input-events)
(cl-destructuring-bind (backtrace &optional type data . _)
(cons (doom-cli--backtrace) data)
(cond
((and (bound-and-true-p straight-process-buffer)
(stringp data)
(string-match-p (regexp-quote straight-process-buffer)
data))
(print! (error "There was an unexpected package error"))
(print-group!
(print! "%s" (string-trim-right (straight--process-get-output)))))
((print! (error "There was an unexpected error"))
(print-group!
(print! "%s %s" (bold "Message:") (get type 'error-message))
(print! "%s %S" (bold "Data:") (cons type data))
(when backtrace
(print! (bold "Backtrace:"))
(print-group!
(dolist (frame (seq-take backtrace 10))
(print!
"%0.74s" (replace-regexp-in-string
"[\n\r]" "\\\\n" (format "%S" frame)))))))))
(when backtrace
(with-temp-file doom-cli-log-error-file
(insert "# -*- lisp-interaction -*-\n")
(insert "# vim: set ft=lisp:\n")
(let ((standard-output (current-buffer))
(print-quoted t)
(print-escape-newlines t)
(print-escape-control-characters t)
(print-level nil)
(print-circle nil))
(mapc #'print (cons (list type data) backtrace)))
(print! (warn "Extended backtrace logged to %s")
(relpath doom-cli-log-error-file)))))
(throw 'exit 255))
(defun doom-cli--backtrace ()
(let* ((n 0)
(frame (backtrace-frame n))
(frame-list nil)
(in-program-stack nil))
(while frame
(when in-program-stack
(push (cdr frame) frame-list))
(when (eq (elt frame 1) 'doom-cli--debugger)
(setq in-program-stack t))
(when (and (eq (elt frame 1) 'doom-cli-execute)
(eq (elt frame 2) :doom))
(setq in-program-stack nil))
(setq n (1+ n)
frame (backtrace-frame n)))
(reverse frame-list)))
;;
;;; straight.el hacks
@@ -366,52 +425,102 @@ everywhere we use it (and internally)."
interactive)))
;;
;;; Entry point
(defcli! :doom
((help-p ["-h" "--help"] "Same as help command")
(auto-accept-p ["-y" "--yes"] "Auto-accept all confirmation prompts")
(debug-p ["-d" "--debug"] "Enables on verbose output")
(doomdir ["--doomdir" dir] "Use the private module at DIR (e.g. ~/.doom.d)")
(localdir ["--localdir" dir] "Use DIR as your local storage directory")
&optional command
&rest args)
"A command line interface for managing Doom Emacs.
Includes package management, diagnostics, unit tests, and byte-compilation.
This tool also makes it trivial to launch Emacs out of a different folder or
with a different private module."
(condition-case e
(with-output-to! doom-cli-log-file
(catch 'exit
(when (and (not (getenv "__DOOMRESTART"))
(or doomdir
localdir
debug-p
auto-accept-p))
(when doomdir
(setenv "DOOMDIR" (file-name-as-directory doomdir))
(print! (info "DOOMDIR=%s") localdir))
(when localdir
(setenv "DOOMLOCALDIR" (file-name-as-directory localdir))
(print! (info "DOOMLOCALDIR=%s") localdir))
(when debug-p
(setenv "DEBUG" "1")
(print! (info "DEBUG=1")))
(when auto-accept-p
(setenv "YES" auto-accept-p)
(print! (info "Confirmations auto-accept enabled")))
(throw 'exit "__DOOMRESTART=1 $@"))
;; TODO Rotate logs out, instead of overwriting them?
(delete-file doom-cli-log-file)
(delete-file doom-cli-log-error-file)
(when help-p
(when command
(push command args))
(setq command "help"))
(if (null command)
(doom-cli-execute "help")
(let ((start-time (current-time)))
(run-hooks 'doom-cli-pre-hook)
(when (apply #'doom-cli-execute command args)
(run-hooks 'doom-cli-post-hook)
(print! (success "Finished in %.4fs")
(float-time (time-subtract (current-time) start-time))))))))
;; TODO Not implemented yet
(doom-cli-command-not-found-error
(print! (error "Command 'doom %s' not recognized") (string-join (cdr e) " "))
(print! "\nDid you mean one of these commands?")
(apply #'doom-cli-execute "help" "--similar" (string-join (cdr e) " "))
2)
;; TODO Not implemented yet
(doom-cli-wrong-number-of-arguments-error
(cl-destructuring-bind (route opt arg n d) (cdr e)
(print! (error "doom %s: %S requires %d arguments, but %d given\n")
(mapconcat #'symbol-name route " ") arg n d)
(print-group!
(apply #'doom-cli-execute "help" (mapcar #'symbol-name route))))
3)
;; TODO Not implemented yet
(doom-cli-unrecognized-option-error
(let ((option (cadr e)))
(print! (error "Unrecognized option: %S") option)
(when (string-match "^--[^=]+=\\(.+\\)$" option)
(print! "The %S syntax isn't supported. Use '%s %s' instead."
option (car (split-string option "="))
(match-string 1 option))))
4)
;; TODO Not implemented yet
(doom-cli-deprecated-error
(cl-destructuring-bind (route . commands) (cdr e)
(print! (warn "The 'doom %s' command was removed and replaced with:\n")
(mapconcat #'symbol-name route " "))
(print-group!
(dolist (command commands)
(print! (info "%s") command))))
5)
(user-error
(print! (warn "%s") (cadr e))
1)))
;;
;;; CLI Commands
(load! "cli/help")
(load! "cli/install")
(defcli! (refresh re) ()
"Deprecated for 'doom sync'"
:hidden t
(user-error "'doom refresh' has been replaced with 'doom sync'. Use that instead"))
(defcli! (sync s)
((inhibit-envvar-p ["-e"] "Don't regenerate the envvar file")
(inhibit-elc-p ["-c"] "Don't recompile config")
(update-p ["-u"] "Update installed packages after syncing")
(prune-p ["-p" "--prune"] "Purge orphaned package repos & regraft them"))
"Synchronize your config with Doom Emacs.
This is the equivalent of running autoremove, install, autoloads, then
recompile. Run this whenever you:
1. Modify your `doom!' block,
2. Add or remove `package!' blocks to your config,
3. Add or remove autoloaded functions in module autoloaded files.
4. Update Doom outside of Doom (e.g. with git)
It will ensure that unneeded packages are removed, all needed packages are
installed, autoloads files are up-to-date and no byte-compiled files have gone
stale."
(print! (start "Synchronizing your config with Doom Emacs..."))
(print-group!
(delete-file doom-autoload-file)
(when (and (not inhibit-envvar-p)
(file-exists-p doom-env-file))
(doom-cli-reload-env-file 'force))
(run-hooks 'doom-sync-pre-hook)
(doom-cli-packages-install)
(doom-cli-packages-build)
(when update-p
(doom-cli-packages-update))
(doom-cli-packages-purge prune-p 'builds-p prune-p prune-p)
(run-hooks 'doom-sync-post-hook)
(when (doom-autoloads-reload)
(print! (info "Restart Emacs or use 'M-x doom/reload' for changes to take effect")))
t))
(load! "cli/sync")
(load! "cli/env")
(load! "cli/upgrade")
(load! "cli/packages")
@@ -427,12 +536,10 @@ stale."
;; (load! "cli/test")
)
(defcligroup! "Compilation"
"For compiling Doom and your config"
(load! "cli/byte-compile"))
(defcligroup! "Utilities"
"Conveniences for interacting with Doom externally"
(defcli! run (&rest args)
@@ -446,8 +553,16 @@ All arguments are passed on to Emacs.
WARNING: this command exists for convenience and testing. Doom will suffer
additional overhead by being started this way. For the best performance, it is
best to run Doom out of ~/.emacs.d and ~/.doom.d."
(apply #'doom-cli-execute-after invocation-name args)
nil))
(throw 'exit (cons invocation-name args))))
;;
;;; Bootstrap
(doom-log "Initializing Doom CLI")
(load! doom-module-init-file doom-private-dir t)
(maphash (doom-module-loader doom-cli-file) doom-modules)
(load! doom-cli-file doom-private-dir t)
(provide 'core-cli)
;;; core-cli.el ends here

View File

@@ -114,6 +114,10 @@ possible."
(setq-default indent-tabs-mode nil
tab-width 4)
;; Only indent the line when at BOL or in a line's indentation. Anywhere else,
;; insert literal indentation.
(setq-default tab-always-indent nil)
;; Make `tabify' and `untabify' only affect indentation. Not tabs/spaces in the
;; middle of a line.
(setq tabify-regexp "^\t* [ \t]+")
@@ -189,17 +193,23 @@ possible."
;; Only prompts for confirmation when buffer is unsaved.
revert-without-query (list "."))
;; Instead of `auto-revert-mode' or `global-auto-revert-mode', we lazily auto
;; revert; when we save a file or switch buffers/windows (or focus on Emacs).
;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the
;; heck out of inotify handles _or_ aggresively poll your buffer list every X
;; seconds. Too many inotify handles can grind Emacs to a halt if you preform
;; expensive or batch processes on files outside of Emacs (e.g. their mtime
;; changes), and polling your buffer list is terribly inefficient as your
;; buffer list grows into the tens or hundreds.
;;
;; Autorevert normally abuses the heck out of inotify handles which can grind
;; Emacs to a halt if you do expensive IO (outside of Emacs) on the files you
;; have open (like compression). The only alternative is aggressive polling,
;; which is unreliable and expensive with a lot of buffers open.
;; So Doom uses a different strategy: we lazily auto revert buffers when the
;; user a) saves a file, b) switches to a buffer (or its window), or c) you
;; focus Emacs (after using another program). This way, Emacs only ever has to
;; operate on, at minimum, a single buffer and, at maximum, X buffers, where X
;; is the number of open windows (which is rarely, if ever, over 10).
(defun doom-auto-revert-buffer-h ()
"Auto revert current buffer, if necessary."
(unless (or auto-revert-mode (active-minibuffer-window))
(auto-revert-handler)))
(let ((auto-revert-mode t))
(auto-revert-handler))))
(defun doom-auto-revert-buffers-h ()
"Auto revert stale buffers in visible windows, if necessary."
@@ -220,9 +230,15 @@ possible."
(file-truename file)
file))
(setq recentf-filename-handlers
'(substring-no-properties ; strip out lingering text properties
doom--recent-file-truename ; resolve symlinks of local files
abbreviate-file-name) ; replace $HOME with ~
'(;; Text properties inflate the size of recentf's files, and there is
;; no purpose in persisting them, so we strip them out.
substring-no-properties
;; Resolve symlinks of local files. Otherwise we get duplicate
;; entries opening symlinks.
doom--recent-file-truename
;; Replace $HOME with ~, which is more portable, and reduces how much
;; horizontal space the recentf listing uses to list recent files.
abbreviate-file-name)
recentf-save-file (concat doom-cache-dir "recentf")
recentf-auto-cleanup 'never
recentf-max-menu-items 0
@@ -309,7 +325,6 @@ files, so we replace calls to `pp' with the much faster `prin1'."
(use-package! better-jumper
:hook (doom-first-input . better-jumper-mode)
:hook (better-jumper-post-jump . recenter)
:commands doom-set-jump-a doom-set-jump-maybe-a doom-set-jump-h
:preface
;; REVIEW Suppress byte-compiler warning spawning a *Compile-Log* buffer at

View File

@@ -27,8 +27,11 @@ and Emacs states, and for non-evil users.")
;;; Keybind settings
(cond (IS-MAC
(setq mac-command-modifier 'super
mac-option-modifier 'meta))
(setq mac-command-modifier 'super
mac-option-modifier 'meta
ns-command-modifier 'super
ns-option-modifier 'meta
ns-right-option-modifier 'none))
(IS-WINDOWS
(setq w32-lwindow-modifier 'super
w32-rwindow-modifier 'super)))

View File

@@ -220,19 +220,19 @@ writes to `standard-output'."
(funcall write-region start end filename append visit lockname mustbenew)))
,@forms))))
(defmacro if! (cond then &rest body)
(defmacro eval-if! (cond then &rest body)
"Expands to THEN if COND is non-nil, to BODY otherwise.
COND is checked at compile/expansion time, allowing BODY to be omitted
entirely when the elisp is byte-compiled. Use this for forms that contain
expensive macros that could safely be removed at compile time."
COND is checked at compile/expansion time, allowing BODY to be omitted entirely
when the elisp is byte-compiled. Use this for forms that contain expensive
macros that could safely be removed at compile time."
(declare (indent 2))
(if (eval cond)
then
(macroexp-progn body)))
(defmacro when! (cond &rest body)
(defmacro eval-when! (cond &rest body)
"Expands to BODY if CONDITION is non-nil at compile/expansion time.
See `if!' for details on this macro's purpose."
See `eval-if!' for details on this macro's purpose."
(declare (indent 1))
(when (eval cond)
(macroexp-progn body)))
@@ -639,7 +639,7 @@ testing advice (when combined with `rotate-text').
;;
;;; Backports
(when! (version< emacs-version "27.0.90")
(eval-when! (version< emacs-version "27.0.90")
;; DEPRECATED Backported from Emacs 27
(defmacro setq-local (&rest pairs)
"Make variables in PAIRS buffer-local and assign them the corresponding values.

View File

@@ -39,7 +39,8 @@ run before `doom-init-modules-hook'. Relevant to `doom-module-init-file'.")
(vterm (:term vterm))
(password-store (:tools pass))
(flycheck (:checkers syntax))
(flyspell (:checkers spell)))
(flyspell (:checkers spell))
(macos (:os macos)))
(:emacs (electric-indent (:emacs electric))
(hideshow (:editor fold))
(eshell (:term eshell))
@@ -47,7 +48,8 @@ run before `doom-init-modules-hook'. Relevant to `doom-module-init-file'.")
(:ui (doom-modeline (:ui modeline))
(fci (:ui fill-column))
(evil-goggles (:ui ophints))
(tabbar (:ui tabs)))
(tabbar (:ui tabs))
(pretty-code (:ui ligatures)))
(:app (email (:email mu4e))
(notmuch (:email notmuch)))
(:lang (perl (:lang raku))))
@@ -441,7 +443,7 @@ otherwise, MODULES is a multiple-property list (a plist where each key can have
multiple, linear values).
The bootstrap process involves making sure the essential directories exist, core
packages are installed, `doom-autoload-file' is loaded, `doom-packages-file'
packages are installed, `doom-autoloads-file' is loaded, `doom-packages-file'
cache exists (and is loaded) and, finally, loads your private init.el (which
should contain your `doom!' block).

View File

@@ -97,9 +97,11 @@ uses a straight or package.el command directly).")
;; we don't have to deal with them at all.
autoload-compute-prefixes nil
;; We handle it ourselves
straight-fix-org nil
;; HACK Disable native-compilation for some troublesome files
comp-deferred-compilation-black-list '("/evil-collection-vterm\\.el$"))
straight-fix-org nil)
(with-eval-after-load 'straight
;; `let-alist' is built into Emacs 26 and onwards
(add-to-list 'straight-built-in-pseudo-packages 'let-alist))
(defadvice! doom--read-pinned-packages-a (orig-fn &rest args)
"Read `:pin's in `doom-packages' on top of straight's lockfiles."
@@ -126,7 +128,8 @@ uses a straight or package.el command directly).")
((null pin)
(funcall call "git" "clone" "--origin" "origin" repo-url repo-dir
"--depth" (number-to-string straight-vc-git-default-clone-depth)
"--branch" straight-repository-branch))
"--branch" straight-repository-branch
"--single-branch" "--no-tags"))
((integerp straight-vc-git-default-clone-depth)
(make-directory repo-dir t)
(let ((default-directory repo-dir))
@@ -134,7 +137,8 @@ uses a straight or package.el command directly).")
(funcall call "git" "checkout" "-b" straight-repository-branch)
(funcall call "git" "remote" "add" "origin" repo-url)
(funcall call "git" "fetch" "origin" pin
"--depth" (number-to-string straight-vc-git-default-clone-depth))
"--depth" (number-to-string straight-vc-git-default-clone-depth)
"--no-tags")
(funcall call "git" "checkout" "--detach" pin)))))
(require 'straight (concat repo-dir "/straight.el"))
(doom-log "Initializing recipes")
@@ -184,10 +188,20 @@ processed."
(error "Failed to read any packages"))
(dolist (package doom-packages)
(cl-destructuring-bind
(name &key recipe disable ignore &allow-other-keys) package
(name &key recipe disable ignore shadow &allow-other-keys) package
(unless ignore
(if disable
(cl-pushnew name doom-disabled-packages)
(when shadow
(straight-override-recipe (cons shadow '(:local-repo nil)))
(let ((site-load-path (copy-sequence doom--initial-load-path))
lib)
(while (setq
lib (locate-library (concat (symbol-name shadow) ".el")
nil site-load-path))
(let ((lib (directory-file-name (file-name-directory lib))))
(setq site-load-path (delete lib site-load-path)
load-path (delete lib load-path))))))
(when recipe
(straight-override-recipe (cons name recipe)))
(straight-register-package name)))))))
@@ -327,6 +341,7 @@ installed."
If ALL-P, gather packages unconditionally across all modules, including disabled
ones."
(let ((packages-file (concat doom-packages-file ".el"))
doom-disabled-packages
doom-packages)
(doom--read-packages
(doom-path doom-core-dir packages-file) all-p 'noerror)
@@ -338,10 +353,12 @@ ones."
(doom-files-in doom-modules-dir
:depth 2
:match "/packages\\.el$"))
;; We load the private packages file twice to ensure disabled packages
;; are seen ASAP, and a second time to ensure privately overridden
;; packages are properly overwritten.
(doom--read-packages private-packages nil 'noerror)
;; We load the private packages file twice to populate
;; `doom-disabled-packages' disabled packages are seen ASAP, and a
;; second time to ensure privately overridden packages are properly
;; overwritten.
(let (doom-packages)
(doom--read-packages private-packages nil 'noerror))
(cl-loop for key being the hash-keys of doom-modules
for path = (doom-module-path (car key) (cdr key) packages-file)
for doom--current-module = key
@@ -382,7 +399,7 @@ ones."
;;; Module package macros
(cl-defmacro package!
(name &rest plist &key built-in recipe ignore _type _pin _disable)
(name &rest plist &key built-in recipe ignore _type _pin _disable _shadow)
"Declares a package and how to install it (if applicable).
This macro is declarative and does not load nor install packages. It is used to
@@ -419,6 +436,10 @@ Accepts the following properties:
inform help commands like `doom/help-packages' that this is a built-in
package. If set to 'prefer, the package will not be installed if it is
already provided by Emacs.
:shadow PACKAGE
Informs Doom that this package is shadowing a built-in PACKAGE; the original
package will be removed from `load-path' to mitigate conflicts, and this new
package will satisfy any dependencies on PACKAGE in the future.
Returns t if package is successfully registered, and nil if it was disabled
elsewhere."
@@ -453,7 +474,7 @@ elsewhere."
(when-let (recipe (plist-get plist :recipe))
(cl-destructuring-bind
(&key local-repo _files _flavor
_no-build _no-byte-compile _no-autoloads
_no-build _no-byte-compile _no-native-compile _no-autoloads
_type _repo _host _branch _remote _nonrecursive _fork _depth)
recipe
;; Expand :local-repo from current directory
@@ -469,9 +490,10 @@ elsewhere."
(signal 'doom-package-error
(cons ,(symbol-name name)
(error-message-string e)))))
;; This is the only side-effect of this macro!
;; These are the only side-effects of this macro!
(setf (alist-get name doom-packages) plist)
(unless (plist-get plist :disable)
(if (plist-get plist :disable)
(add-to-list 'doom-disabled-packages name)
(with-no-warnings
(cons name plist)))))

View File

@@ -200,11 +200,6 @@ or if the current buffer is read-only or not file-visiting."
;; Remove hscroll-margin in shells, otherwise it causes jumpiness
(setq-hook! '(eshell-mode-hook term-mode-hook) hscroll-margin 0)
(when IS-MAC
;; sane trackpad/mouse scroll settings
(setq mac-redisplay-dont-reset-vscroll t
mac-mouse-wheel-smooth-scroll nil))
;;
;;; Cursor
@@ -307,33 +302,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
tool-bar-mode nil
scroll-bar-mode nil)
(when! IS-MAC
;; Curse Lion and its sudden but inevitable fullscreen mode!
;; NOTE Meaningless to railwaycat's emacs-mac build
(setq ns-use-native-fullscreen nil)
;; Visit files opened outside of Emacs in existing frame, not a new one
(setq ns-pop-up-frames nil)
;; Sets `ns-transparent-titlebar' and `ns-appearance' frame parameters so
;; window borders will match the enabled theme.
(and (or (daemonp)
(display-graphic-p))
(require 'ns-auto-titlebar nil t)
(ns-auto-titlebar-mode +1))
;; HACK On MacOS, disabling the menu bar makes MacOS treat Emacs as a
;; non-application window -- which means it doesn't automatically capture
;; focus when it is started, among other things. We enable menu-bar-lines
;; there, but we still want it disabled in terminal frames because there
;; it activates an ugly menu bar.
(add-hook! '(window-setup-hook after-make-frame-functions)
(defun doom-init-menu-bar-in-gui-frames-h (&optional frame)
"Re-enable menu-bar-lines in GUI frames."
(when-let (frame (or frame (selected-frame)))
(when (display-graphic-p frame)
(set-frame-parameter frame 'menu-bar-lines 1))))))
;; The native border "consumes" a pixel of the fringe on righter-most splits,
;; `window-divider' does not. Available since Emacs 25.1.
(setq window-divider-default-places t
@@ -630,7 +598,7 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
(run-hooks 'doom-load-theme-hook))
result)))
(when! (not EMACS27+)
(eval-when! (not EMACS27+)
;; DEPRECATED `doom--load-theme-a' handles this for us after the theme is
;; loaded, but this only works on Emacs 27+. Disabling old themes
;; must be done *before* the theme is loaded in Emacs 26.

View File

@@ -127,7 +127,7 @@ Use this for files that change often, like cache files. Must end with a slash.")
Defaults to ~/.config/doom, ~/.doom.d or the value of the DOOMDIR envvar;
whichever is found first. Must end in a slash.")
(defconst doom-autoload-file (concat doom-local-dir "autoloads.el")
(defconst doom-autoloads-file (concat doom-local-dir "autoloads.el")
"Where `doom-reload-core-autoloads' stores its core autoloads.
This file is responsible for informing Emacs where to find all of Doom's
@@ -270,6 +270,26 @@ config.el instead."
(apply orig-fn args)))
;;
;;; Native Compilation support (http://akrl.sdf.org/gccemacs.html)
;; Don't store eln files in ~/.emacs.d/eln-cache (they are likely to be purged
;; when upgrading Doom).
(when (boundp 'comp-eln-load-path)
(add-to-list 'comp-eln-load-path (concat doom-cache-dir "eln/")))
(after! comp
;; HACK `comp-eln-load-path' isn't fully respected yet, because native
;; compilation occurs in another emacs process that isn't seeded with our
;; value for `comp-eln-load-path', so we inject it ourselves:
(setq comp-async-env-modifier-form
`(progn
,comp-async-env-modifier-form
(setq comp-eln-load-path ',(bound-and-true-p comp-eln-load-path))))
;; HACK Disable native-compilation for some troublesome packages
(add-to-list 'comp-deferred-compilation-black-list "/evil-collection-vterm\\.el\\'"))
;;
;;; Optimizations
@@ -303,8 +323,9 @@ config.el instead."
(setq ffap-machine-p-known 'reject)
;; Font compacting can be terribly expensive, especially for rendering icon
;; fonts on Windows. Whether it has a notable affect on Linux and Mac hasn't
;; been determined, but we inhibit it there anyway.
;; fonts on Windows. Whether disabling it has a notable affect on Linux and Mac
;; hasn't been determined, but we inhibit it there anyway. This increases memory
;; usage, however!
(setq inhibit-compacting-font-caches t)
;; Performance on Windows is considerably worse than elsewhere. We'll need
@@ -319,10 +340,6 @@ config.el instead."
(unless IS-MAC (setq command-line-ns-option-alist nil))
(unless IS-LINUX (setq command-line-x-option-alist nil))
;; 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)
;; Adopt a sneaky garbage collection strategy of waiting until idle time to
;; collect; staving off the collector while the user is working.
(setq gcmh-idle-delay 5
@@ -330,8 +347,10 @@ config.el instead."
gcmh-verbose doom-debug-p)
;; HACK `tty-run-terminal-initialization' is *tremendously* slow for some
;; reason. Disabling it completely could have many side-effects, so we
;; defer it until later, at which time it (somehow) runs very quickly.
;; reason; inexplicably doubling startup time for terminal Emacs. Keeping
;; it disabled will have nasty side-effects, so we simply delay it until
;; later in the startup process and, for some reason, it runs much faster
;; when it does.
(unless (daemonp)
(advice-add #'tty-run-terminal-initialization :override #'ignore)
(add-hook! 'window-setup-hook
@@ -346,12 +365,12 @@ config.el instead."
;; 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.
(defvar doom--inhibit-local-var-hooks nil)
(defvar doom-inhibit-local-var-hooks nil)
(defun doom-run-local-var-hooks-h ()
"Run MODE-local-vars-hook after local variables are initialized."
(unless doom--inhibit-local-var-hooks
(set (make-local-variable 'doom--inhibit-local-var-hooks) t)
(unless doom-inhibit-local-var-hooks
(set (make-local-variable 'doom-inhibit-local-var-hooks) t)
(run-hook-wrapped (intern-soft (format "%s-local-vars-hook" major-mode))
#'doom-try-run-hook)))
@@ -473,7 +492,7 @@ If RETURN-P, return the message as a string instead of displaying it."
"Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil).
The bootstrap process ensures that everything Doom needs to run is set up;
essential directories exist, core packages are installed, `doom-autoload-file'
essential directories exist, core packages are installed, `doom-autoloads-file'
is loaded (failing if it isn't), that all the needed hooks are in place, and
that `core-packages' will load when `package' or `straight' is used.
@@ -505,7 +524,7 @@ to least)."
load-path doom--initial-load-path
process-environment doom--initial-process-environment)
;; Doom caches a lot of information in `doom-autoload-file'. Module and
;; Doom caches a lot of information in `doom-autoloads-file'. Module and
;; package autoloads, autodefs like `set-company-backend!', and variables
;; like `doom-modules', `doom-disabled-packages', `load-path',
;; `auto-mode-alist', and `Info-directory-list'. etc. Compiling them into
@@ -514,18 +533,18 @@ to least)."
;; Avoid `file-name-sans-extension' for premature optimization reasons.
;; `string-remove-suffix' is cheaper because it performs no file sanity
;; checks; just plain ol' string manipulation.
(load (string-remove-suffix ".el" doom-autoload-file)
(load (string-remove-suffix ".el" doom-autoloads-file)
nil 'nomessage)
(file-missing
;; If the autoloads file fails to load then the user forgot to sync, or
;; aborted a doom command midway!
(if (equal (nth 3 e) doom-autoload-file)
(if (equal (nth 3 e) doom-autoloads-file)
(signal 'doom-error
(list "Doom is in an incomplete state"
"run 'bin/doom sync' on the command line to repair it"))
"run 'doom sync' on the command line to repair it"))
;; Otherwise, something inside the autoloads file is triggering this
;; error; forward it!
(apply #'doom-autoload-error e))))
(signal 'doom-autoload-error e))))
;; Load shell environment, optionally generated from 'doom env'. No need
;; to do so if we're in terminal Emacs, where Emacs correctly inherits

View File

@@ -4,6 +4,10 @@
;; core.el
(package! auto-minor-mode :pin "17cfa1b54800fdef2975c0c0531dad34846a5065")
(package! gcmh :pin "b1bde5089169a74f62033d027e06e98cbeedd43f")
(package! explain-pause-mode
:recipe (:host github
:repo "lastquestion/explain-pause-mode")
:pin "2356c8c3639cbeeb9751744dbe737267849b4b51")
;; core-packages.el
(package! straight
@@ -14,15 +18,15 @@
:local-repo "straight.el"
:files ("straight*.el")
:no-build t)
:pin "fc077dda27dc603c6a287d9cffe0bf0ba5018d66")
:pin "0c7c7571349b628d87acde474a754f05e86ca876")
;; core-modules.el
(package! use-package
:type 'core
:pin "7d925367ef0857d513d62eab4cb57b7436b9ffe9")
:pin "4fb1f9a68f1e7e7d614652afc017a6652fd029f1")
;; core-ui.el
(package! all-the-icons :pin "ed8e44de4fa601309d2bba902c3b37cb73e4daa0")
(package! all-the-icons :pin "8c0228053dd6693d926970d89270094be52b0f75")
(package! hide-mode-line :pin "88888825b5b27b300683e662fa3be88d954b1cea")
(package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307")
(package! rainbow-delimiters :pin "5125f4e47604ad36c3eb4706310fcafac729ca8c")
@@ -32,8 +36,6 @@
(package! better-jumper :pin "6d240032ca213ccb3347e25f26c29b6822bf03a7")
(package! dtrt-indent :pin "50c440c80e0d15303d8ab543bce4c56e9c2bf407")
(package! helpful :pin "c0662aa07266fe204f4e6d72ccaa6af089400556")
(when IS-MAC
(package! ns-auto-titlebar :pin "1efc30d38509647b417f05587fd7003457719256"))
(package! pcre2el :pin "0b5b2a2c173aab3fd14aac6cf5e90ad3bf58fa7d")
(package! smartparens :pin "555626a43f9bb1985aa9a0eb675f2b88b29702c8")
(package! so-long
@@ -50,8 +52,8 @@
:pin "2bb49d3ee7d2cba133bc7e9cdac416cd1c5e4fe0")
;; core-projects.el
(package! projectile :pin "bbcf781d3fddb8e00d0dc10eb68bc2528fb409b3")
(package! projectile :pin "46d2010c6a6cccfc4be72317f10ea99fd041ab54")
;; core-keybinds.el
(package! general :pin "a0b17d207badf462311b2eef7c065b884462cb7c")
(package! which-key :pin "3642c11d5ef9be3c6fb9edb8fd5ec3c370abd889")
(package! which-key :pin "e48e190a75a0c176e1deac218b891e77792d6921")

View File

@@ -28,7 +28,7 @@
(spy-on 'doom-initialize-packages :and-return-value t))
(it "initializes packages if core autoload file doesn't exist"
(let ((doom-autoload-file "doesnotexist"))
(let ((doom-autoloads-file "doesnotexist"))
(expect (doom-initialize nil 'noerror))
(expect 'doom-initialize-packages :to-have-been-called))
@@ -51,12 +51,12 @@
(it "loads autoloads files"
(ignore-errors (doom-initialize nil 'noerror))
(expect 'doom-load-autoloads-file
:to-have-been-called-with doom-autoload-file)
:to-have-been-called-with doom-autoloads-file)
(expect 'doom-load-autoloads-file
:to-have-been-called-with doom-package-autoload-file))
(it "throws doom-autoload-error when autoload files don't exist"
(let ((doom-autoload-file "doesnotexist")
(let ((doom-autoloads-file "doesnotexist")
(doom-package-autoload-file "doesnotexist"))
(expect (doom-initialize) :to-throw 'doom-autoload-error)))))
@@ -72,26 +72,26 @@
(expect 'require :to-have-been-called-with 'core-editor))))
(describe "doom-load-autoloads-file"
:var (doom-autoload-file doom-alt-autoload-file result)
:var (doom-autoloads-file doom-alt-autoload-file result)
(before-each
(setq doom-autoload-file (make-temp-file "doom-autoload" nil ".el"))
(with-temp-file doom-autoload-file)
(byte-compile-file doom-autoload-file))
(setq doom-autoloads-file (make-temp-file "doom-autoload" nil ".el"))
(with-temp-file doom-autoloads-file)
(byte-compile-file doom-autoloads-file))
(after-each
(delete-file doom-autoload-file)
(delete-file (byte-compile-dest-file doom-autoload-file)))
(delete-file doom-autoloads-file)
(delete-file (byte-compile-dest-file doom-autoloads-file)))
(it "loads the byte-compiled autoloads file if available"
(doom-load-autoloads-file doom-autoload-file)
(doom-load-autoloads-file doom-autoloads-file)
(expect (caar load-history) :to-equal-file
(byte-compile-dest-file doom-autoload-file))
(byte-compile-dest-file doom-autoloads-file))
(delete-file (byte-compile-dest-file doom-autoload-file))
(doom-load-autoloads-file doom-autoload-file)
(expect (caar load-history) :to-equal-file doom-autoload-file))
(delete-file (byte-compile-dest-file doom-autoloads-file))
(doom-load-autoloads-file doom-autoloads-file)
(expect (caar load-history) :to-equal-file doom-autoloads-file))
(it "returns non-nil if successful"
(expect (doom-load-autoloads-file doom-autoload-file)))
(expect (doom-load-autoloads-file doom-autoloads-file)))
(it "returns nil on failure or error, non-fatally"
(expect (doom-load-autoloads-file "/does/not/exist") :to-be nil)))