help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can Emacs remember the opend buffers?


From: Ehud Karni
Subject: Re: Can Emacs remember the opend buffers?
Date: Wed, 31 Jan 2001 14:26:54 +0200

On Wed, 31 Jan 2001 09:46:29 +0100, Baenninger, Dominik
    <dominik.baenninger@ito.umnw.ethz.ch> wrote:
> 
> Does anyone know, what I have to tell .emacs, that when I close emacs
> with several open buffers and after somer time I will reopen emacs,
> that this buffers will be opend automatically, so that I do not have
> to search for each file separatly.

Add the next lines to your .emacs:

(require 'desktop)
(condition-case ()
    (desktop-read)     ;; restore desktop files (protected from errors)
    (error nil))

Read the help for desktop-globals-to-save and desktop-locals-to-save
variables (you may want to modify them).

I also suggest to add the following snippet that will ensure you
against crashes of any kind (e.g. kill -9 <emacs-pid>).

(defun desktop-save-in-home-dir ()
  "save desktop on home directory"
       (if (buffer-file-name)
           (desktop-save "~/"))
       nil)
(add-hook 'find-file-hooks 'desktop-save-in-home-dir t)
(add-hook 'kill-buffer-hook 'desktop-save-in-home-dir t)



-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud@unix.simonwiesel.co.il



reply via email to

[Prev in Thread] Current Thread [Next in Thread]