Created
December 19, 2013 20:19
-
-
Save ffevotte/8045566 to your computer and use it in GitHub Desktop.
Additions to `desktop.el` to facilitate switching between saved sessions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Desktop | |
(setq desktop-save 'ask) | |
(defvar desktop-base-dir "~/.emacs.d/desktops/" | |
"Base directory for desktop files") | |
(defun desktop--set-frame-title () | |
(setq frame-title-format | |
(list (concat "%b - Emacs [" | |
(file-name-nondirectory (directory-file-name desktop-dirname)) | |
"]")))) | |
(defun desktop-load (name) | |
(interactive | |
(list | |
(completing-read "Desktop name: " | |
(remove "." (remove ".." (directory-files desktop-base-dir)))))) | |
(desktop-change-dir (concat desktop-base-dir name)) | |
(desktop--set-frame-title) | |
(desktop-save-mode 1)) | |
(defun desktop-create () | |
(interactive) | |
(when (or (not (boundp 'desktop-dirname)) | |
(null desktop-dirname)) | |
(let ((name (read-from-minibuffer "Desktop name: "))) | |
(setq desktop-dirname (concat desktop-base-dir name)) | |
(make-directory desktop-dirname 'parents))) | |
(desktop-save desktop-dirname) | |
(desktop--set-frame-title) | |
(desktop-save-mode 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment