summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
authorAlan Pearce2017-05-10 16:10:53 +0200
committerAlan Pearce2017-05-10 16:10:53 +0200
commitb53d38cfcd688467a7133d6077d62467946522ee (patch)
treefaaf67130e9034f4c8e0aa39e60d046a58474a0d /emacs
parent7c3d8b535caa65ac6c861fd281af0147f0307855 (diff)
downloadnixfiles-b53d38cfcd688467a7133d6077d62467946522ee.tar.lz
nixfiles-b53d38cfcd688467a7133d6077d62467946522ee.tar.zst
nixfiles-b53d38cfcd688467a7133d6077d62467946522ee.zip
Emacs: Configure desktop mode
Auto-save Emacs' state if a desktop file exists.  This is probably as
DWIM as I need.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init.org21
1 files changed, 21 insertions, 0 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 7cdf2090..96b3fe92 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -944,6 +944,27 @@ Workspaces, a bit like dwm.
             (eyebrowse-mode +1)))
 #+END_SRC
 
+* Sessions
+
+** Desktop
+Save my Emacs session and restore it on startup.
+
+#+BEGIN_SRC emacs-lisp
+(use-package desktop
+  :ensure nil
+  :config (progn
+            (setq desktop-dirname (expand-file-name "desktop/" user-emacs-directory)
+                  desktop-base-file-name "emacs.desktop"
+                  desktop-base-lock-name "lock"
+                  desktop-path (list desktop-dirname)
+                  desktop-save 'if-exists
+                  desktop-files-not-to-save "^$"
+                  desktop-load-locked-desktop nil)
+            (unless (file-directory-p desktop-dirname)
+              (make-directory desktop-dirname))
+            (desktop-save-mode 1)))
+#+END_SRC
+
 ** winner
 
 Undo, for window-based commands.