2018-05-20 12:13:05 +02:00
|
|
|
;;; core/autoload/debug.el -*- lexical-binding: t; -*-
|
2018-05-11 00:00:02 +02:00
|
|
|
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
;;
|
|
|
|
;;; Doom's debug mode
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defvar doom-debug-variables
|
2020-08-21 00:09:59 -04:00
|
|
|
'(debug-on-error
|
|
|
|
doom-debug-p
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
garbage-collection-messages
|
|
|
|
gcmh-verbose
|
2020-08-21 00:09:59 -04:00
|
|
|
init-file-debug
|
|
|
|
jka-compr-verbose
|
|
|
|
url-debug
|
2020-10-26 05:49:44 -04:00
|
|
|
use-package-verbose
|
|
|
|
(message-log-max . 16384))
|
2020-08-21 00:09:59 -04:00
|
|
|
"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))))
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
2020-05-25 02:58:07 -04:00
|
|
|
(define-minor-mode doom-debug-mode
|
|
|
|
"Toggle `debug-on-error' and `doom-debug-p' for verbose logging."
|
2020-08-05 23:38:30 -04:00
|
|
|
:init-value nil
|
2020-05-25 02:58:07 -04:00
|
|
|
:global t
|
2020-08-21 00:09:59 -04:00
|
|
|
(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)))))
|
2020-10-11 16:26:04 -04:00
|
|
|
(when (called-interactively-p 'any)
|
|
|
|
(when (fboundp 'explain-pause-mode)
|
|
|
|
(explain-pause-mode (if enabled +1 -1))))
|
2020-08-21 00:09:59 -04:00
|
|
|
;; 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"))))
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Hooks
|
|
|
|
|
2019-07-28 02:31:52 +02:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom-run-all-startup-hooks-h ()
|
|
|
|
"Run all startup Emacs hooks. Meant to be executed after starting Emacs with
|
|
|
|
-q or -Q, for example:
|
|
|
|
|
|
|
|
emacs -Q -l init.el -f doom-run-all-startup-hooks-h"
|
|
|
|
(setq after-init-time (current-time))
|
2020-12-01 16:47:13 -05:00
|
|
|
(let ((inhibit-startup-hooks nil))
|
|
|
|
(mapc (lambda (hook)
|
|
|
|
(run-hook-wrapped hook #'doom-try-run-hook))
|
|
|
|
'(after-init-hook
|
|
|
|
delayed-warnings-hook
|
|
|
|
emacs-startup-hook
|
|
|
|
tty-setup-hook
|
|
|
|
window-setup-hook))))
|
2019-07-28 02:31:52 +02:00
|
|
|
|
|
|
|
|
2019-04-23 20:58:19 -04:00
|
|
|
;;
|
|
|
|
;;; Helpers
|
|
|
|
|
2020-03-03 16:15:43 -05:00
|
|
|
(defsubst doom--collect-forms-in (file form)
|
2020-01-28 17:54:51 -05:00
|
|
|
(when (file-readable-p file)
|
|
|
|
(let (forms)
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents file)
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(let (emacs-lisp-mode) (emacs-lisp-mode))
|
2020-01-28 17:54:51 -05:00
|
|
|
(while (re-search-forward (format "(%s " (regexp-quote form)) nil t)
|
2020-03-03 16:15:43 -05:00
|
|
|
(let ((ppss (syntax-ppss)))
|
|
|
|
(unless (or (nth 4 ppss)
|
|
|
|
(nth 3 ppss))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (match-beginning 0))
|
|
|
|
(push (sexp-at-point) forms)))))
|
2020-01-28 17:54:51 -05:00
|
|
|
(nreverse forms)))))
|
|
|
|
|
2018-02-10 17:27:02 -05:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom-info ()
|
|
|
|
"Returns diagnostic information about the current Emacs session in markdown,
|
|
|
|
ready to be pasted in a bug report on github."
|
|
|
|
(require 'vc-git)
|
2020-01-28 17:54:51 -05:00
|
|
|
(require 'core-packages)
|
2020-08-24 00:15:26 -04:00
|
|
|
(let ((default-directory doom-emacs-dir))
|
|
|
|
(letf! ((defun sh (&rest args) (cdr (apply #'doom-call-process args)))
|
2021-02-11 15:43:06 -05:00
|
|
|
(defun cat (file &optional limit)
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents file nil 0 limit)
|
|
|
|
(buffer-string)))
|
2020-08-24 00:15:26 -04:00
|
|
|
(defun abbrev-path (path)
|
|
|
|
(replace-regexp-in-string
|
2021-02-11 15:43:06 -05:00
|
|
|
(regexp-opt (list (user-login-name)) 'words) "$USER"
|
|
|
|
(abbreviate-file-name path)))
|
|
|
|
(defun symlink-path (file)
|
|
|
|
(format "%s%s" (abbrev-path file)
|
|
|
|
(if (file-symlink-p file)
|
|
|
|
(concat " -> " (file-truename file))
|
|
|
|
""))))
|
2020-08-24 00:15:26 -04:00
|
|
|
`((system
|
2021-03-01 11:02:07 -05:00
|
|
|
(info . ,(cons (doom-system-distro-version) (sh "uname" "-msr")))
|
2020-08-24 00:15:26 -04:00
|
|
|
(shell . ,(abbrev-path shell-file-name))
|
|
|
|
(path . ,(mapcar #'abbrev-path exec-path)))
|
|
|
|
(emacs
|
2021-02-11 15:43:06 -05:00
|
|
|
(dir . ,(symlink-path doom-emacs-dir))
|
|
|
|
(version . ,(delq nil (list emacs-version emacs-repository-version (format-time-string "%b %d, %Y" emacs-build-time))))
|
2020-08-24 00:15:26 -04:00
|
|
|
(buildopts . ,system-configuration-options)
|
|
|
|
(features . ,system-configuration-features)
|
2021-02-11 15:43:06 -05:00
|
|
|
(traits
|
|
|
|
. ,(delq
|
|
|
|
nil (list (cond ((not doom-interactive-p) 'batch)
|
|
|
|
((display-graphic-p) 'gui)
|
|
|
|
('tty))
|
|
|
|
(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)
|
|
|
|
(if (doom-files-in `(,@doom-modules-dirs
|
|
|
|
,doom-core-dir
|
|
|
|
,doom-private-dir)
|
|
|
|
:type 'files :match "\\.elc$")
|
|
|
|
'byte-compiled-config)))))
|
2019-07-21 15:39:45 +02:00
|
|
|
(doom
|
2021-02-11 15:43:06 -05:00
|
|
|
(dir . ,(symlink-path doom-private-dir))
|
|
|
|
(version . ,(list doom-version (sh "git" "log" "-1" "--format=%D %h %ci")))
|
2020-11-10 15:04:41 -05:00
|
|
|
,@(when doom-interactive-p
|
|
|
|
`((font . ,(bound-and-true-p doom-font))
|
|
|
|
(theme . ,(bound-and-true-p doom-theme))))
|
2019-07-26 15:25:59 +02:00
|
|
|
(modules
|
|
|
|
,@(or (cl-loop with cat = nil
|
|
|
|
for key being the hash-keys of doom-modules
|
2019-09-26 21:57:55 -04:00
|
|
|
if (or (not cat)
|
|
|
|
(not (eq cat (car key))))
|
2019-07-26 15:25:59 +02:00
|
|
|
do (setq cat (car key))
|
|
|
|
and collect cat
|
2019-09-26 21:57:55 -04:00
|
|
|
collect
|
2020-08-24 00:15:26 -04:00
|
|
|
(let* ((flags (doom-module-get cat (cdr key) :flags))
|
|
|
|
(path (doom-module-get cat (cdr key) :path))
|
2020-09-02 14:22:45 -04:00
|
|
|
(module (append (cond ((null path)
|
|
|
|
(list '&nopath))
|
|
|
|
((file-in-directory-p path doom-private-dir)
|
|
|
|
(list '&user)))
|
2020-08-24 00:15:26 -04:00
|
|
|
(if flags
|
|
|
|
`(,(cdr key) ,@flags)
|
|
|
|
(list (cdr key))))))
|
|
|
|
(if (= (length module) 1)
|
|
|
|
(car module)
|
|
|
|
module)))
|
2019-07-26 15:25:59 +02:00
|
|
|
'("n/a")))
|
|
|
|
(packages
|
2019-12-14 18:23:30 -05:00
|
|
|
,@(or (condition-case e
|
2020-01-28 17:54:51 -05:00
|
|
|
(mapcar
|
|
|
|
#'cdr (doom--collect-forms-in
|
|
|
|
(doom-path doom-private-dir "packages.el")
|
|
|
|
"package!"))
|
2019-12-14 18:23:30 -05:00
|
|
|
(error (format "<%S>" e)))
|
2019-08-25 11:46:10 -04:00
|
|
|
'("n/a")))
|
2020-02-23 15:41:49 -05:00
|
|
|
(unpin
|
|
|
|
,@(or (condition-case e
|
|
|
|
(mapcan #'identity
|
|
|
|
(mapcar
|
|
|
|
#'cdr (doom--collect-forms-in
|
|
|
|
(doom-path doom-private-dir "packages.el")
|
|
|
|
"unpin!")))
|
|
|
|
(error (format "<%S>" e)))
|
|
|
|
'("n/a")))
|
2019-09-14 15:11:56 -04:00
|
|
|
(elpa
|
2019-12-14 18:23:30 -05:00
|
|
|
,@(or (condition-case e
|
|
|
|
(progn
|
|
|
|
(package-initialize)
|
|
|
|
(cl-loop for (name . _) in package-alist
|
|
|
|
collect (format "%s" name)))
|
|
|
|
(error (format "<%S>" e)))
|
2020-02-23 15:41:49 -05:00
|
|
|
'("n/a"))))))))
|
2018-05-20 12:13:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
2019-04-23 20:58:19 -04:00
|
|
|
;;; Commands
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun doom/version ()
|
|
|
|
"Display the current version of Doom & Emacs, including the current Doom
|
|
|
|
branch and commit."
|
|
|
|
(interactive)
|
2019-08-21 12:10:06 -04:00
|
|
|
(let ((default-directory doom-core-dir))
|
2020-08-24 14:17:42 -04:00
|
|
|
(print! "Doom v%s (%s)"
|
2019-08-21 12:10:06 -04:00
|
|
|
doom-version
|
2020-08-24 14:17:42 -04:00
|
|
|
(or (cdr (doom-call-process "git" "log" "-1" "--format=%D %h %ci"))
|
2019-08-21 12:10:06 -04:00
|
|
|
"n/a"))))
|
2018-02-10 17:27:02 -05:00
|
|
|
|
2017-12-31 17:49:27 -05:00
|
|
|
;;;###autoload
|
2019-07-21 15:39:45 +02:00
|
|
|
(defun doom/info (&optional raw)
|
2020-10-20 23:21:11 -04:00
|
|
|
"Collects some debug information about your Emacs session, formats it and
|
|
|
|
copies it to your clipboard, ready to be pasted into bug reports!"
|
2019-07-21 15:39:45 +02:00
|
|
|
(interactive "P")
|
2020-10-20 23:21:11 -04:00
|
|
|
(let ((buffer (get-buffer-create "*doom info*"))
|
2019-07-21 15:39:45 +02:00
|
|
|
(info (doom-info)))
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(erase-buffer)
|
|
|
|
(if raw
|
|
|
|
(progn
|
|
|
|
(save-excursion
|
|
|
|
(pp info (current-buffer)))
|
2020-03-10 18:21:27 -04:00
|
|
|
(dolist (sym '(modules packages))
|
|
|
|
(when (re-search-forward (format "^ *\\((%s\\)" sym) nil t)
|
|
|
|
(goto-char (match-beginning 1))
|
|
|
|
(cl-destructuring-bind (beg . end)
|
|
|
|
(bounds-of-thing-at-point 'sexp)
|
|
|
|
(let ((sexp (prin1-to-string (sexp-at-point))))
|
|
|
|
(delete-region beg end)
|
|
|
|
(insert sexp))))))
|
2020-10-20 23:21:11 -04:00
|
|
|
(insert "```\n")
|
2019-07-21 15:39:45 +02:00
|
|
|
(dolist (group info)
|
|
|
|
(insert! "%-8s%-10s %s\n"
|
2020-08-24 00:15:26 -04:00
|
|
|
((upcase (symbol-name (car group)))
|
2019-07-21 15:39:45 +02:00
|
|
|
(caadr group)
|
|
|
|
(cdadr group)))
|
|
|
|
(dolist (spec (cddr group))
|
|
|
|
(insert! (indent 8 "%-10s %s\n")
|
|
|
|
((car spec) (cdr spec)))))
|
2020-10-20 23:21:11 -04:00
|
|
|
(insert "```\n"))
|
2020-05-25 02:58:07 -04:00
|
|
|
(if (not doom-interactive-p)
|
2019-07-21 15:39:45 +02:00
|
|
|
(print! (buffer-string))
|
2020-10-20 23:21:11 -04:00
|
|
|
(pop-to-buffer buffer)
|
2019-07-21 15:39:45 +02:00
|
|
|
(kill-new (buffer-string))
|
2020-10-20 23:21:11 -04:00
|
|
|
(print! (green "Copied your doom info to clipboard"))))))
|
2018-02-04 17:53:05 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
2018-05-24 16:40:37 +02:00
|
|
|
(defun doom/am-i-secure ()
|
2020-03-28 02:20:10 +01:00
|
|
|
"Test to see if your root certificates are securely configured in emacs.
|
|
|
|
Some items are not supported by the `nsm.el' module."
|
2018-05-20 12:13:05 +02:00
|
|
|
(declare (interactive-only t))
|
|
|
|
(interactive)
|
|
|
|
(unless (string-match-p "\\_<GNUTLS\\_>" system-configuration-features)
|
|
|
|
(warn "gnutls support isn't built into Emacs, there may be problems"))
|
|
|
|
(if-let* ((bad-hosts
|
|
|
|
(cl-loop for bad
|
2020-03-28 02:20:10 +01:00
|
|
|
in '("https://expired.badssl.com/"
|
|
|
|
"https://wrong.host.badssl.com/"
|
|
|
|
"https://self-signed.badssl.com/"
|
|
|
|
"https://untrusted-root.badssl.com/"
|
|
|
|
;; "https://revoked.badssl.com/"
|
|
|
|
;; "https://pinning-test.badssl.com/"
|
|
|
|
"https://sha1-intermediate.badssl.com/"
|
|
|
|
"https://rc4-md5.badssl.com/"
|
|
|
|
"https://rc4.badssl.com/"
|
|
|
|
"https://3des.badssl.com/"
|
|
|
|
"https://null.badssl.com/"
|
|
|
|
"https://sha1-intermediate.badssl.com/"
|
|
|
|
;; "https://client-cert-missing.badssl.com/"
|
|
|
|
"https://dh480.badssl.com/"
|
|
|
|
"https://dh512.badssl.com/"
|
|
|
|
"https://dh-small-subgroup.badssl.com/"
|
|
|
|
"https://dh-composite.badssl.com/"
|
|
|
|
"https://invalid-expected-sct.badssl.com/"
|
|
|
|
;; "https://no-sct.badssl.com/"
|
|
|
|
;; "https://mixed-script.badssl.com/"
|
|
|
|
;; "https://very.badssl.com/"
|
|
|
|
"https://subdomain.preloaded-hsts.badssl.com/"
|
|
|
|
"https://superfish.badssl.com/"
|
|
|
|
"https://edellroot.badssl.com/"
|
|
|
|
"https://dsdtestprovider.badssl.com/"
|
|
|
|
"https://preact-cli.badssl.com/"
|
|
|
|
"https://webpack-dev-server.badssl.com/"
|
|
|
|
"https://captive-portal.badssl.com/"
|
|
|
|
"https://mitm-software.badssl.com/"
|
|
|
|
"https://sha1-2016.badssl.com/"
|
|
|
|
"https://sha1-2017.badssl.com/")
|
2018-05-20 12:13:05 +02:00
|
|
|
if (condition-case _e
|
|
|
|
(url-retrieve-synchronously bad)
|
|
|
|
(error nil))
|
|
|
|
collect bad)))
|
|
|
|
(error "tls seems to be misconfigured (it got %s)."
|
|
|
|
bad-hosts)
|
|
|
|
(url-retrieve "https://badssl.com"
|
|
|
|
(lambda (status)
|
|
|
|
(if (or (not status) (plist-member status :error))
|
|
|
|
(warn "Something went wrong.\n\n%s" (pp-to-string status))
|
|
|
|
(message "Your trust roots are set up properly.\n\n%s" (pp-to-string status))
|
|
|
|
t)))))
|
|
|
|
|
|
|
|
|
2019-04-23 20:58:19 -04:00
|
|
|
;;
|
2018-09-07 19:36:16 -04:00
|
|
|
;;; Vanilla sandbox
|
2018-05-20 12:13:59 +02:00
|
|
|
|
2019-04-23 20:58:19 -04:00
|
|
|
(defun doom--run-sandbox (&optional mode)
|
2018-05-20 12:13:59 +02:00
|
|
|
(interactive)
|
2018-07-02 23:32:11 +02:00
|
|
|
(let ((contents (buffer-string))
|
2018-08-30 13:28:43 +02:00
|
|
|
(file (make-temp-file "doom-sandbox-")))
|
2019-03-09 04:51:31 -05:00
|
|
|
(require 'package)
|
2018-08-30 13:28:43 +02:00
|
|
|
(with-temp-file file
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(prin1 `(progn
|
2020-12-01 16:47:13 -05:00
|
|
|
(setq before-init-time (current-time)
|
|
|
|
after-init-time nil
|
|
|
|
noninteractive nil
|
2020-11-02 21:03:28 -05:00
|
|
|
user-init-file ,file
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
process-environment ',doom--initial-process-environment
|
|
|
|
exec-path ',doom--initial-exec-path
|
2020-12-01 16:47:13 -05:00
|
|
|
doom-debug-p t
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
init-file-debug t
|
2020-10-26 05:51:43 -04:00
|
|
|
doom--initial-load-path load-path
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
load-path ',load-path
|
|
|
|
package--init-file-ensured t
|
|
|
|
package-user-dir ,package-user-dir
|
|
|
|
package-archives ',package-archives
|
2020-10-06 00:07:26 -04:00
|
|
|
user-emacs-directory ,doom-emacs-dir
|
|
|
|
comp-deferred-compilation nil
|
|
|
|
comp-eln-load-path ',(bound-and-true-p comp-eln-load-path)
|
|
|
|
comp-async-env-modifier-form ',(bound-and-true-p comp-async-env-modifier-form)
|
|
|
|
comp-deferred-compilation-black-list ',(bound-and-true-p comp-deferred-compilation-black-list))
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(with-eval-after-load 'undo-tree
|
2020-12-01 13:51:48 -05:00
|
|
|
;; HACK `undo-tree' throws errors because `buffer-undo-tree'
|
|
|
|
;; isn't correctly initialized
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(setq-default buffer-undo-tree (make-undo-tree)))
|
|
|
|
(ignore-errors
|
|
|
|
(delete-directory ,(expand-file-name "auto-save-list" doom-emacs-dir) 'parents)))
|
|
|
|
(current-buffer))
|
|
|
|
(prin1 `(unwind-protect
|
|
|
|
(defun --run-- () ,(read (concat "(progn\n" contents "\n)")))
|
|
|
|
(delete-file ,file))
|
|
|
|
(current-buffer))
|
|
|
|
(prin1 (pcase mode
|
|
|
|
(`vanilla-doom+ ; Doom core + modules - private config
|
|
|
|
`(progn
|
|
|
|
(load-file ,(expand-file-name "core.el" doom-core-dir))
|
|
|
|
(setq doom-modules-dirs (list doom-modules-dir))
|
|
|
|
(let ((doom-init-modules-p t))
|
|
|
|
(doom-initialize)
|
|
|
|
(doom-initialize-core-modules))
|
|
|
|
(setq doom-modules ',doom-modules)
|
|
|
|
(maphash (lambda (key plist)
|
2020-05-25 03:09:46 -04:00
|
|
|
(doom-module-put
|
|
|
|
(car key) (cdr key)
|
|
|
|
:path (doom-module-locate-path (car key) (cdr key))))
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
doom-modules)
|
2020-05-25 03:09:46 -04:00
|
|
|
(--run--)
|
|
|
|
(maphash (doom-module-loader doom-module-init-file) doom-modules)
|
|
|
|
(maphash (doom-module-loader doom-module-config-file) doom-modules)
|
2020-12-01 16:47:13 -05:00
|
|
|
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-hook)))
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(`vanilla-doom ; only Doom core
|
|
|
|
`(progn
|
|
|
|
(load-file ,(expand-file-name "core.el" doom-core-dir))
|
|
|
|
(let ((doom-init-modules-p t))
|
|
|
|
(doom-initialize)
|
|
|
|
(doom-initialize-core-modules))
|
2020-12-01 16:47:13 -05:00
|
|
|
(--run--)))
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(`vanilla ; nothing loaded
|
|
|
|
`(progn
|
|
|
|
(package-initialize)
|
|
|
|
(--run--))))
|
2020-12-01 16:47:13 -05:00
|
|
|
(current-buffer))
|
|
|
|
;; Redo all startup initialization, like running startup hooks and loading
|
|
|
|
;; init files.
|
|
|
|
(prin1 `(progn
|
|
|
|
(fset 'doom-try-run-hook #',(symbol-function #'doom-try-run-hook))
|
|
|
|
(fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h))
|
|
|
|
(doom-run-all-startup-hooks-h))
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(current-buffer)))
|
2019-03-09 04:51:31 -05:00
|
|
|
(let ((args (if (eq mode 'doom)
|
|
|
|
(list "-l" file)
|
|
|
|
(list "-Q" "-l" file))))
|
2018-08-30 13:28:43 +02:00
|
|
|
(require 'restart-emacs)
|
|
|
|
(condition-case e
|
2018-08-23 16:17:52 +02:00
|
|
|
(cond ((display-graphic-p)
|
|
|
|
(if (memq system-type '(windows-nt ms-dos))
|
2018-08-30 13:28:43 +02:00
|
|
|
(restart-emacs--start-gui-on-windows args)
|
|
|
|
(restart-emacs--start-gui-using-sh args)))
|
2018-08-23 16:17:52 +02:00
|
|
|
((memq system-type '(windows-nt ms-dos))
|
|
|
|
(user-error "Cannot start another Emacs from Windows shell."))
|
|
|
|
((suspend-emacs
|
|
|
|
(format "%s %s -nw; fg"
|
|
|
|
(shell-quote-argument (restart-emacs--get-emacs-binary))
|
2019-06-14 11:08:59 +02:00
|
|
|
(mapconcat #'shell-quote-argument args " ")))))
|
2018-08-30 13:28:43 +02:00
|
|
|
(error
|
|
|
|
(delete-file file)
|
|
|
|
(signal (car e) (cdr e)))))))
|
2018-08-12 02:41:20 +02:00
|
|
|
|
2020-05-27 16:12:45 -04:00
|
|
|
(fset 'doom--run-vanilla-emacs (cmd! (doom--run-sandbox 'vanilla)))
|
|
|
|
(fset 'doom--run-vanilla-doom (cmd! (doom--run-sandbox 'vanilla-doom)))
|
|
|
|
(fset 'doom--run-vanilla-doom+ (cmd! (doom--run-sandbox 'vanilla-doom+)))
|
|
|
|
(fset 'doom--run-full-doom (cmd! (doom--run-sandbox 'doom)))
|
2019-03-09 04:51:31 -05:00
|
|
|
|
|
|
|
(defvar doom-sandbox-emacs-lisp-mode-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
(define-key map (kbd "C-c C-c") #'doom--run-vanilla-emacs)
|
|
|
|
(define-key map (kbd "C-c C-d") #'doom--run-vanilla-doom)
|
|
|
|
(define-key map (kbd "C-c C-p") #'doom--run-vanilla-doom+)
|
|
|
|
(define-key map (kbd "C-c C-f") #'doom--run-full-doom)
|
2019-05-30 18:54:58 -07:00
|
|
|
(define-key map (kbd "C-c C-k") #'kill-current-buffer)
|
2019-03-09 04:51:31 -05:00
|
|
|
map))
|
|
|
|
|
|
|
|
(define-derived-mode doom-sandbox-emacs-lisp-mode emacs-lisp-mode "Sandbox Elisp"
|
|
|
|
"TODO")
|
2018-05-20 12:13:59 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-04-23 20:58:19 -04:00
|
|
|
(defun doom/sandbox ()
|
2019-03-09 04:51:31 -05:00
|
|
|
"Open the Emacs Lisp sandbox.
|
|
|
|
|
2019-04-23 20:58:19 -04:00
|
|
|
This is a test bed for running Emacs Lisp in another instance of Emacs with
|
|
|
|
varying amounts of Doom loaded, including:
|
2019-03-09 04:51:31 -05:00
|
|
|
|
|
|
|
a) vanilla Emacs (nothing loaded),
|
2019-04-23 20:58:19 -04:00
|
|
|
b) vanilla Doom (only Doom core),
|
|
|
|
c) Doom + modules - your private config or
|
|
|
|
c) Doom + modules + your private config (a complete Doom session)
|
2018-05-20 12:13:59 +02:00
|
|
|
|
2019-03-09 04:51:31 -05:00
|
|
|
This is done without sacrificing access to installed packages. Use the sandbox
|
|
|
|
to reproduce bugs and determine if Doom is to blame."
|
2018-05-20 12:13:59 +02:00
|
|
|
(interactive)
|
2019-04-23 20:58:19 -04:00
|
|
|
(let* ((buffer-name "*doom:sandbox*")
|
2018-08-30 13:28:43 +02:00
|
|
|
(exists (get-buffer buffer-name))
|
|
|
|
(buf (get-buffer-create buffer-name)))
|
2018-05-20 12:13:59 +02:00
|
|
|
(with-current-buffer buf
|
2019-03-09 04:51:31 -05:00
|
|
|
(doom-sandbox-emacs-lisp-mode)
|
2018-05-20 12:13:59 +02:00
|
|
|
(setq-local default-directory doom-emacs-dir)
|
2018-08-30 13:28:43 +02:00
|
|
|
(unless (buffer-live-p exists)
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(insert-file-contents (doom-glob doom-core-dir "templates/VANILLA_SANDBOX"))
|
2019-03-09 04:51:31 -05:00
|
|
|
(let ((contents (substitute-command-keys (buffer-string))))
|
|
|
|
(erase-buffer)
|
|
|
|
(insert contents "\n")))
|
2018-05-20 12:13:59 +02:00
|
|
|
(goto-char (point-max)))
|
|
|
|
(pop-to-buffer buf)))
|
|
|
|
|
|
|
|
|
2019-04-23 20:58:19 -04:00
|
|
|
;;
|
2018-09-07 19:36:16 -04:00
|
|
|
;;; Reporting bugs
|
2018-05-20 12:13:59 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-04-23 20:58:19 -04:00
|
|
|
(defun doom/report-bug ()
|
2018-05-20 12:13:59 +02:00
|
|
|
"Open a markdown buffer destinated to populate the New Issue page on Doom
|
|
|
|
Emacs' issue tracker.
|
|
|
|
|
|
|
|
If called when a backtrace buffer is present, it and the output of `doom-info'
|
|
|
|
will be automatically appended to the result."
|
|
|
|
(interactive)
|
2019-11-17 21:09:06 -05:00
|
|
|
(browse-url "https://github.com/hlissner/doom-emacs/issues/new/choose"))
|
2018-05-20 12:13:59 +02:00
|
|
|
|
2020-11-04 19:41:48 -05:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom/copy-buffer-contents (buffer-name)
|
|
|
|
"Copy the contents of BUFFER-NAME to your clipboard."
|
|
|
|
(interactive
|
|
|
|
(list (if current-prefix-arg
|
|
|
|
(completing-read "Select buffer: " (mapcar #'buffer-name (buffer-list)))
|
|
|
|
(buffer-name (current-buffer)))))
|
|
|
|
(let ((buffer (get-buffer buffer-name)))
|
|
|
|
(unless (buffer-live-p buffer)
|
|
|
|
(user-error "Buffer isn't live"))
|
|
|
|
(kill-new
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(substring-no-properties (buffer-string))))
|
|
|
|
(message "Contents of %S were copied to the clipboard" buffer-name)))
|
|
|
|
|
2018-05-20 12:13:59 +02:00
|
|
|
|
2019-04-23 20:58:19 -04:00
|
|
|
;;
|
2018-09-07 19:36:16 -04:00
|
|
|
;;; Profiling
|
2018-05-20 12:13:05 +02:00
|
|
|
|
|
|
|
(defvar doom--profiler nil)
|
|
|
|
;;;###autoload
|
2018-05-24 16:40:37 +02:00
|
|
|
(defun doom/toggle-profiler ()
|
2018-05-20 12:13:05 +02:00
|
|
|
"Toggle the Emacs profiler. Run it again to see the profiling report."
|
|
|
|
(interactive)
|
|
|
|
(if (not doom--profiler)
|
|
|
|
(profiler-start 'cpu+mem)
|
|
|
|
(profiler-report)
|
|
|
|
(profiler-stop))
|
|
|
|
(setq doom--profiler (not doom--profiler)))
|