tags:

views:

123

answers:

2

For session management with emacs, I appended the following lines to my .emacs file

(load "desktop")
(desktop-load-default)
(desktop-read)

I was able to save the session using M-x desktop-save. But after exiting emacs, I am unable to recover the earlier saved session. I did start emacs in the same directory as that during "desktop-save"

Please let me know if I am missing anything or not correct in my efforts

Thanks -- Harish

+4  A: 

Chapter 51 'Saving Emacs Sessions' of my Emacs manual (using a Emacs 23 snapshot) has this

You can save the desktop manually with the command M-x desktop-save'. You can also enable automatic saving of the desktop when you exit Emacs, and automatic restoration of the last saved desktop when Emacs starts: use the Customization buffer (*note Easy Customization::) to set desktop-save-mode' to t' for future sessions, or add this line in your ~/.emacs' file:

 (desktop-save-mode 1)

which is different from what you tried.

Dirk Eddelbuettel
A: 

The following worked for me (emacs 21.3.1):

(load "desktop")

(setq desktop-save-mode 1)

(desktop-load-default)
(desktop-read)

The desktop-save-mode line is only needed if you want to save desktop automatically on exit (i.e. without bothering to type M-x deskstop-save).

The only difference is that I put those lines at the beginning of the .emacs file but I doubt that's a problem.

happy_emi