forked from purcell/emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-sessions.el
74 lines (66 loc) · 2.9 KB
/
init-sessions.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;; save a list of open files in ~/.emacs.d/.emacs.desktop
(setq desktop-path (list user-emacs-directory))
(desktop-save-mode 1)
(defadvice desktop-read (around trace-desktop-errors activate)
(let ((debug-on-error t))
ad-do-it))
(defadvice desktop-read (around time-restore activate)
(let ((start-time (current-time)))
(prog1
ad-do-it
(message "Desktop restored in %.2fms"
(sanityinc/time-subtract-millis (current-time)
start-time)))))
(defadvice desktop-create-buffer (around time-create activate)
(let ((start-time (current-time))
(filename (ad-get-arg 1)))
(prog1
ad-do-it
(message "Desktop: %.2fms to restore %s"
(sanityinc/time-subtract-millis (current-time)
start-time)
(when filename
(abbreviate-file-name filename))))))
;;----------------------------------------------------------------------------
;; Restore histories and registers after saving
;;----------------------------------------------------------------------------
(require-package 'session)
(setq session-save-file (expand-file-name ".session" user-emacs-directory))
(add-hook 'after-init-hook 'session-initialize)
;; save a bunch of variables to the desktop file
;; for lists specify the len of the maximal saved data also
(setq desktop-globals-to-save
(append '((comint-input-ring . 50)
(compile-history . 30)
desktop-missing-file-warning
(dired-regexp-history . 20)
(extended-command-history . 30)
(face-name-history . 20)
(file-name-history . 100)
(grep-find-history . 30)
(grep-history . 30)
(ido-buffer-history . 100)
(ido-last-directory-list . 100)
(ido-work-directory-list . 100)
(ido-work-file-list . 100)
(magit-read-rev-history . 50)
(minibuffer-history . 50)
(org-clock-history . 50)
(org-refile-history . 50)
(org-tags-history . 50)
(query-replace-history . 60)
(read-expression-history . 60)
(regexp-history . 60)
(regexp-search-ring . 20)
register-alist
(search-ring . 20)
(shell-command-history . 50)
tags-file-name
tags-table-list)))
(when (eval-when-compile (and (>= emacs-major-version 24)
(string< emacs-version "24.3.50")
))
(unless (boundp 'desktop-restore-frames)
(require-package 'frame-restore)
(frame-restore)))
(provide 'init-sessions)