diff --git a/init.org b/init.org index a4ac86f..860f614 100644 --- a/init.org +++ b/init.org @@ -194,7 +194,8 @@ NAME is the name of the process and its buffer." auto-window-vscroll nil locale-coding-system 'utf-8 file-name-coding-system 'utf-8 - buffer-file-coding-system 'utf-8) + buffer-file-coding-system 'utf-8 + inhibit-startup-screen t) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-selection-coding-system 'utf-8) @@ -5382,18 +5383,34 @@ nicked from wasamasa's init - https://github.com/wasamasa/dotemacs/blob/934d0b37 #+END_SRC * desktop - session management +https://emacs.stackexchange.com/questions/31621/handle-stale-desktop-lock-files-after-emacs-system-crash +#+BEGIN_SRC emacs-lisp +(defun my-remove-stale-lock-file (dir) + (let ((pid (desktop-owner dir))) + (when pid + (let (infile destination display) + (unless (= (call-process "ps" infile destination display "-p" + (number-to-string pid)) 0) + (let ((lock-file (desktop-full-lock-name dir))) + (delete-file lock-file))))))) +#+END_SRC + #+BEGIN_SRC emacs-lisp (use-package desktop - :init - (desktop-save-mode t) - (desktop-auto-save-enable) + :disabled t + :init (desktop-save-mode t) :config - (setq desktop-dirname "~/.emacs.d/desktop-save/" - desktop-save 'ask-if-new + (let ((dir (locate-user-emacs-file ""))) + (my-remove-stale-lock-file dir) + (setq desktop-path (list dir)) + (desktop-read)) + (desktop-auto-save-enable) + (setq desktop-dirname "~/.emacs.d/desktop-save/" + desktop-save 'ask-if-new ;; don't save buffers, just the history - desktop-files-not-to-save "" + desktop-files-not-to-save "" desktop-buffers-not-to-save "" - desktop-restore-frames nil) + desktop-restore-frames nil) (cl-loop for var in '(grep-history grep-find-history