They've been removed from feature/workspaces and moved into
core/autoload/sessions, which falls back to desktop.el if persp-mode
isn't present. This also offers a substantial speed up to
restart+restoring and restoring sessions in general.
Also fixes#1210, where the newly spawned frame after doom/restart
wasn't focused.
Introduces the following commands:
- doom/restart
- doom/restart-and-restore
- doom/quickload-session
- doom/quicksave-session
- doom/load-session
- doom/save-session
- +workspace/restore-last-session (alias for doom/quickload-session)
And removes
- +workspace/load-session
- +workspace/save-session
- +workspace/load-last-session (renamed to +workspace/restore-last-session)
- +workspace/restart-emacs-then-restore (replaced by doom/restart-and-restore)
- :ss (ex command)
- :sl (ex command)
;;;###autodef FORM
FORM was used as a predicate for inclusion as an autodef. Now it is used
as the replacement sexp in case the module is disabled.
Oh, you don't know what autdefs are? Well let me explain (thanks for
asking, by the way). An autdef'ed function, macro, or function alias is
always available to be called, anywhere in Doom, even if its containing
module is disabled. For instance:
;;;###autodef
(defun say-hello! (name) ; the trailing ! denotes an autodef
(message "Hello %s" name))
This makes it safe to call `do-something` without a check whether it
exists (or if its module is enabled). When the module is enabled, an
autoload entry is added to the Doom autoloads file:
(autoload 'do-something "path/to/some/modules/autoloads")
And it is autoloaded as normal when it is first used. However, if the
module is disabled, then this is inserted instead:
(defmacro do-something (&rest _))
This no-ops; it does nothing and doesn't evaluate its arguments. If FORM
above was provided, that is used instead of a noop macro.
It's a little smarter than simple substitution, but that's the gist of
it.
Emacs occasionally hangs when polling for the emacs server (with
server-running-p). Since this is used for such a trivial feature (to
decide whether or not to display the "you need to restart" message), I
removed it. Now it always shows that message (if the autoload files have
changed).
Only add doom-private-dir to load-path during autoload generation,
otherwise a $DOOMDIR/autoload.el will shadow the built-in autoload.el
Emacs package.
Note: with `doom-private-dir' in `load-path', Doom autoloads files will
be unable to declare autoloads for the built-in autoload.el Emacs
package, should $DOOMDIR/autoload.el exist. Not sure why they'd want to
though, so it's an acceptable compromise for simpler autoload
declarations.
It is easier to spot real problems if the code is warning-free.
Replacing `gensym` with `make-symbol` is an idea taken from here:
b44c08dd45
In defer-until!:
core-lib.el:150:19:Warning: function ‘gensym’ from cl package called at
runtime
In add-transient-hook!:
core-lib.el:216:16:Warning: function ‘gensym’ from cl package called at
runtime
In toplevel form:
autoload/message.el:35:1:Warning: Unused lexical variable ‘spec’
In toplevel form:
autoload/line-numbers.el:31:1:Warning: defcustom for
‘display-line-numbers-type’ fails to specify containing group
autoload/line-numbers.el:31:1:Warning: defcustom for
‘display-line-numbers-type’ fails to specify containing group
autoload/line-numbers.el:39:1:Warning: defcustom for
‘display-line-numbers-grow-only’ fails to specify containing group
autoload/line-numbers.el:39:1:Warning: defcustom for
‘display-line-numbers-grow-only’ fails to specify containing group
autoload/line-numbers.el:44:1:Warning: defcustom for
‘display-line-numbers-width-start’ fails to specify containing group
autoload/line-numbers.el:44:1:Warning: defcustom for
‘display-line-numbers-width-start’ fails to specify containing group
In toplevel form:
cli/autoloads.el:137:1:Warning: Unused lexical variable ‘type’
Preserve name of unused lexical var _type
Makes it obvious what is stored there.