Created
September 7, 2015 18:46
-
-
Save halbtuerke/9a675728d8fc7ffec593 to your computer and use it in GitHub Desktop.
Save and restore shell buffers with desktop.el
This file contains hidden or 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
(add-hook 'shell-mode-hook | |
(lambda () | |
(make-local-variable 'desktop-save-buffer) | |
(setq desktop-save-buffer | |
(lambda (desktop-dirname) | |
default-directory)))) | |
(defun shell-restore-desktop-buffer (file-name buffer-name directory) | |
(setq default-directory directory) | |
(shell)) | |
(add-to-list 'desktop-buffer-mode-handlers '(shell-mode . shell-restore-desktop-buffer)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very helpful. Thanks! I changed line 10 to:
Otherwise, if there are multiple shell buffers, only one will be restored.