Mercurial > hg > xemacs-beta
comparison lisp/packages/session.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;; Synched up with: Not in FSF. | |
2 ;;; #### Chuck -- I think we should remove this. It's dumb and stupid | |
3 ;;; and there are at least two other packages we provide that do the | |
4 ;;; same thing. | |
5 | |
6 (setq kill-emacs-hook | |
7 '(save-session)) | |
8 | |
9 ;; Record in `/.emacs-session' a command to re-visit the last file | |
10 ;; that was being looked at. | |
11 (defun save-session () | |
12 (and buffer-file-name | |
13 (write-region | |
14 (concat "(" (if (eq major-mode 'rmail-mode) | |
15 "rmail" | |
16 "find-file") | |
17 " " (if (string= (concat (getenv "HOME") "/RMAIL") | |
18 buffer-file-name) | |
19 ;; Omit the file name if it is the primary rmail file | |
20 ;; to cause the default inboxes to be used. | |
21 "" | |
22 (prin1-to-string buffer-file-name)) | |
23 ")\n" | |
24 "(goto-char " (prin1-to-string (window-start)) ")\n" | |
25 "(beginning-of-line)\n" | |
26 "(set-window-start (selected-window) (point))\n" | |
27 "(goto-line " | |
28 (prin1-to-string (1+ (count-lines 1 (point)))) | |
29 ")\n") | |
30 nil (expand-file-name "~/.emacs-session") | |
31 ;; Don't print a message. | |
32 nil 'lambda))) | |
33 | |
34 ;; Restore previous saved session, if there is one. | |
35 (load "~/.emacs-session" t t) |