fix(workspaces): do not auto-load "default" desktop on startup

If you launch Emacs by giving it a file to open, the auto-loading of the
default desktop would remove that file, as it is not likely to be part
of the default desktop.

Instead desktop management is now disabled until you specifically load a
desktop with `desktop+-load-or-create` (bound to `C-z C-z C-s`).
This commit is contained in:
2020-08-31 10:08:40 +01:00
parent 47598b94c6
commit 6003c89994

View File

@@ -10,6 +10,7 @@
(use-package desktop
:straight (:type built-in)
:demand t
:hook
(emacs-startup . siren-desktop-setup)
@@ -23,6 +24,7 @@
(desktop-restore-frames t)
:config
(add-to-list 'desktop-clear-preserve-buffers "\\*straight-process\\*")
(add-to-list 'desktop-clear-preserve-buffers "\\*Async-native-compile-log\\*")
(push '(alpha . :never) frameset-filter-alist)
(push '(background-color . :never) frameset-filter-alist)
@@ -56,9 +58,7 @@
(push '(vertical-scroll-bars . :never) frameset-filter-alist)
:init
(defun siren-desktop-setup ()
(if (not (daemonp))
(desktop-save-mode 1)))
(defun siren-desktop-setup ())
;; Enable restoring window configurations when running in terminal
;; - from: https://emacs.stackexchange.com/a/45829
@@ -91,13 +91,10 @@
:init
(defun siren-desktop+-setup ()
(unless (file-exists-p desktop+-base-dir)
(make-directory desktop+-base-dir))
(if (not (daemonp))
(desktop+-load-or-create "default")))
(make-directory desktop+-base-dir)))
(defun siren-desktop+-current-desktop ()
(when (boundp 'desktop-dirname)
(when (and (boundp 'desktop-dirname) desktop-dirname)
(let ((dir (directory-file-name desktop-dirname))
(base-dir (expand-file-name desktop+-base-dir)))
(when (string-prefix-p base-dir dir)