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-05-25 02:58:07 -04:00
|
|
|
'(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
|
|
|
init-file-debug
|
|
|
|
debug-on-error
|
|
|
|
garbage-collection-messages
|
|
|
|
use-package-verbose
|
|
|
|
jka-compr-verbose
|
|
|
|
lsp-log-io
|
|
|
|
gcmh-verbose
|
|
|
|
magit-refresh-verbose
|
|
|
|
url-debug)
|
2020-05-25 20:17:32 -04:00
|
|
|
"A list of variable to toggle on `doom-debug-mode'.")
|
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-05 23:38:30 -04:00
|
|
|
(let ((value doom-debug-mode))
|
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
|
|
|
(mapc (doom-rpartial #'set value) doom-debug-variables)
|
|
|
|
(message "Debug mode %s" (if value "on" "off"))))
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; 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"
|
|
|
|
(run-hook-wrapped 'after-init-hook #'doom-try-run-hook)
|
|
|
|
(setq after-init-time (current-time))
|
2019-11-07 18:51:12 -05:00
|
|
|
(mapc (doom-rpartial #'run-hook-wrapped #'doom-try-run-hook)
|
|
|
|
(list '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)
|
2018-08-16 01:26:28 +02:00
|
|
|
(let ((default-directory doom-emacs-dir)
|
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 (doom-module-list)))
|
2020-04-29 21:08:17 -04:00
|
|
|
(letf! (defun sh (&rest args) (cdr (apply #'doom-call-process args)))
|
2019-07-21 15:39:45 +02:00
|
|
|
`((emacs
|
|
|
|
(version . ,emacs-version)
|
|
|
|
(features ,@system-configuration-features)
|
|
|
|
(build . ,(format-time-string "%b %d, %Y" emacs-build-time))
|
2019-09-14 15:11:56 -04:00
|
|
|
(buildopts ,system-configuration-options)
|
2020-05-25 02:58:07 -04:00
|
|
|
(windowsys . ,(if doom-interactive-p window-system 'batch))
|
2019-09-14 15:11:56 -04:00
|
|
|
(daemonp . ,(cond ((daemonp) 'daemon)
|
|
|
|
((and (require 'server)
|
|
|
|
(server-running-p))
|
|
|
|
'server-running))))
|
2019-07-21 15:39:45 +02:00
|
|
|
(doom
|
|
|
|
(version . ,doom-version)
|
2019-12-23 23:53:27 -05:00
|
|
|
(build . ,(sh "git" "log" "-1" "--format=%D %h %ci"))
|
2020-01-03 05:13:20 -05:00
|
|
|
(dir . ,(abbreviate-file-name (file-truename doom-private-dir))))
|
2019-07-21 15:39:45 +02:00
|
|
|
(system
|
|
|
|
(type . ,system-type)
|
|
|
|
(config . ,system-configuration)
|
|
|
|
(shell . ,shell-file-name)
|
|
|
|
(uname . ,(if IS-WINDOWS
|
|
|
|
"n/a"
|
2019-11-07 18:20:38 -05:00
|
|
|
(sh "uname" "-msrv")))
|
2019-07-21 15:39:45 +02:00
|
|
|
(path . ,(mapcar #'abbreviate-file-name exec-path)))
|
|
|
|
(config
|
2019-07-26 15:25:59 +02:00
|
|
|
(envfile
|
|
|
|
. ,(cond ((file-exists-p doom-env-file) 'envvar-file)
|
|
|
|
((featurep 'exec-path-from-shell) 'exec-path-from-shell)))
|
|
|
|
(elc-files
|
|
|
|
. ,(length (doom-files-in `(,@doom-modules-dirs
|
|
|
|
,doom-core-dir
|
|
|
|
,doom-private-dir)
|
|
|
|
:type 'files :match "\\.elc$")))
|
|
|
|
(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
|
2019-07-26 15:25:59 +02:00
|
|
|
(let ((flags (doom-module-get cat (cdr key) :flags)))
|
|
|
|
(if flags
|
|
|
|
`(,(cdr key) ,@flags)
|
|
|
|
(cdr key))))
|
|
|
|
'("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)
|
|
|
|
(require 'vc-git)
|
2019-08-21 12:10:06 -04:00
|
|
|
(let ((default-directory doom-core-dir))
|
2020-05-25 22:11:15 -04:00
|
|
|
(print! "Doom v%s (%s)\nEmacs v%s\nBranch: %s\nBuild date: %s"
|
2019-08-21 12:10:06 -04:00
|
|
|
doom-version
|
2020-05-25 22:11:15 -04:00
|
|
|
(or (vc-git-working-revision doom-core-dir)
|
|
|
|
"n/a")
|
2019-08-21 12:10:06 -04:00
|
|
|
emacs-version
|
|
|
|
(or (vc-git--symbolic-ref doom-core-dir)
|
|
|
|
"n/a")
|
2019-11-07 18:20:38 -05:00
|
|
|
(or (cdr (doom-call-process "git" "log" "-1" "--format=%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)
|
2018-02-04 01:38:59 -05:00
|
|
|
"Collects some debug information about your Emacs session, formats it into
|
|
|
|
markdown and copies it to your clipboard, ready to be pasted into bug reports!"
|
2019-07-21 15:39:45 +02:00
|
|
|
(interactive "P")
|
|
|
|
(let ((buffer (get-buffer-create "*doom-info*"))
|
|
|
|
(info (doom-info)))
|
|
|
|
(with-current-buffer buffer
|
2020-05-25 02:58:07 -04:00
|
|
|
(or (not doom-interactive-p)
|
|
|
|
(eq major-mode 'markdown-mode)
|
|
|
|
(not (fboundp 'markdown-mode))
|
|
|
|
(markdown-mode))
|
2019-07-21 15:39:45 +02:00
|
|
|
(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))))))
|
2019-07-21 15:39:45 +02:00
|
|
|
(insert "<details>\n\n```\n")
|
|
|
|
(dolist (group info)
|
|
|
|
(insert! "%-8s%-10s %s\n"
|
|
|
|
((car group)
|
|
|
|
(caadr group)
|
|
|
|
(cdadr group)))
|
|
|
|
(dolist (spec (cddr group))
|
|
|
|
(insert! (indent 8 "%-10s %s\n")
|
|
|
|
((car spec) (cdr spec)))))
|
|
|
|
(insert "```\n</details>"))
|
2020-05-25 02:58:07 -04:00
|
|
|
(if (not doom-interactive-p)
|
2019-07-21 15:39:45 +02:00
|
|
|
(print! (buffer-string))
|
|
|
|
(switch-to-buffer buffer)
|
|
|
|
(kill-new (buffer-string))
|
|
|
|
(print! (green "Copied markdown 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
|
|
|
|
(setq noninteractive nil
|
|
|
|
process-environment ',doom--initial-process-environment
|
|
|
|
exec-path ',doom--initial-exec-path
|
|
|
|
init-file-debug t
|
|
|
|
load-path ',load-path
|
|
|
|
package--init-file-ensured t
|
|
|
|
package-user-dir ,package-user-dir
|
|
|
|
package-archives ',package-archives
|
|
|
|
user-emacs-directory ,doom-emacs-dir)
|
|
|
|
(with-eval-after-load 'undo-tree
|
|
|
|
;; undo-tree throws errors because `buffer-undo-tree' isn't
|
|
|
|
;; correctly initialized
|
|
|
|
(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)
|
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
|
|
|
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-hook)
|
|
|
|
(doom-run-all-startup-hooks-h)))
|
|
|
|
(`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))
|
|
|
|
(--run--)
|
|
|
|
(doom-run-all-startup-hooks-h)))
|
|
|
|
(`vanilla ; nothing loaded
|
|
|
|
`(progn
|
|
|
|
(package-initialize)
|
|
|
|
(--run--))))
|
|
|
|
(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
|
|
|
|
|
|
|
|
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)))
|