Mercurial > hg > xemacs-beta
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/packages/session.el Mon Aug 13 08:45:50 2007 +0200 @@ -0,0 +1,35 @@ +;;; Synched up with: Not in FSF. +;;; #### Chuck -- I think we should remove this. It's dumb and stupid +;;; and there are at least two other packages we provide that do the +;;; same thing. + +(setq kill-emacs-hook + '(save-session)) + +;; Record in `/.emacs-session' a command to re-visit the last file +;; that was being looked at. +(defun save-session () + (and buffer-file-name + (write-region + (concat "(" (if (eq major-mode 'rmail-mode) + "rmail" + "find-file") + " " (if (string= (concat (getenv "HOME") "/RMAIL") + buffer-file-name) + ;; Omit the file name if it is the primary rmail file + ;; to cause the default inboxes to be used. + "" + (prin1-to-string buffer-file-name)) + ")\n" + "(goto-char " (prin1-to-string (window-start)) ")\n" + "(beginning-of-line)\n" + "(set-window-start (selected-window) (point))\n" + "(goto-line " + (prin1-to-string (1+ (count-lines 1 (point)))) + ")\n") + nil (expand-file-name "~/.emacs-session") + ;; Don't print a message. + nil 'lambda))) + +;; Restore previous saved session, if there is one. +(load "~/.emacs-session" t t)