unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* auto-save-desktop?
@ 2003-04-15 14:24 Steve Wainstead
  2003-04-15 15:10 ` auto-save-desktop? Thomas Haselberger
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Steve Wainstead @ 2003-04-15 14:24 UTC (permalink / raw)


Does anyone know of an extension (or an existing way in Emacs that I 
missed) to automatically save the desktop? I'd like Emacs to do 
desktop-save to a user-specified file periodically; I lost my X session 
yesterday and had several open files.

It's a matter of having to hunt for all those files again and find the 
places where I was. An auto-save-desktop feature would save me a lot of 
time when this happens.

~swain

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: auto-save-desktop?
  2003-04-15 14:24 auto-save-desktop? Steve Wainstead
@ 2003-04-15 15:10 ` Thomas Haselberger
  2003-04-15 18:52   ` auto-save-desktop? Steve Wainstead
  2003-04-15 15:58 ` auto-save-desktop? Ehud Karni
       [not found] ` <mailman.4659.1050422363.21513.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Haselberger @ 2003-04-15 15:10 UTC (permalink / raw)


Steve Wainstead <swain@ampira.com> writes:

> Does anyone know of an extension (or an existing way in Emacs that I
> missed) to automatically save the desktop?

take a look at desktop.el - it is in the emacs lisp directory
(at least for version 21.x)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: auto-save-desktop?
  2003-04-15 14:24 auto-save-desktop? Steve Wainstead
  2003-04-15 15:10 ` auto-save-desktop? Thomas Haselberger
@ 2003-04-15 15:58 ` Ehud Karni
       [not found] ` <mailman.4659.1050422363.21513.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Ehud Karni @ 2003-04-15 15:58 UTC (permalink / raw)
  Cc: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 15 Apr 2003 10:24:50 -0400, Steve Wainstead <swain@ampira.com> wrote:
> 
> Does anyone know of an extension (or an existing way in Emacs that I 
> missed) to automatically save the desktop? I'd like Emacs to do 
> desktop-save to a user-specified file periodically; I lost my X session 
> yesterday and had several open files.

I have the following code on my .emacs :

(defun desktop-save-in-home-dir ()
  "save desktop on home directory"
       (if (buffer-file-name)          ;; do only for real files
           (let (find-file-hooks       ;; must - do not loop on this function
                 kill-buffer-hook)     ;; must - do not loop on this function
               (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.


- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+nCwtLFvTvpjqOY0RAtkHAJ485I4poJObLlrvsv05NDqTiptGEACfYjcp
PtfBs2pChwPdIa0Ac0hJBN0=
=aMF1
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: auto-save-desktop?
  2003-04-15 15:10 ` auto-save-desktop? Thomas Haselberger
@ 2003-04-15 18:52   ` Steve Wainstead
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Wainstead @ 2003-04-15 18:52 UTC (permalink / raw)


Thomas Haselberger wrote:
> Steve Wainstead <swain@ampira.com> writes:
> 
> 
>>Does anyone know of an extension (or an existing way in Emacs that I
>>missed) to automatically save the desktop?
> 
> 
> take a look at desktop.el - it is in the emacs lisp directory
> (at least for version 21.x)

I did, and tried (setq desktop-enable t), but if I kill the X session in 
a bad way Emacs does not save the desktop, only if it exits cleanly. 
That is, I ssh -X into the remote box, run Emacs there and display 
locally, and if I kill the xterm I connected with, the desktop is not saved.

It seemed to me a feature similar to auto-save-file would get around 
this. I can probably write the lisp for it and post it back here, but I 
didn't want to duplicate effort needlessly.

~swain

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: auto-save-desktop?
       [not found] ` <mailman.4659.1050422363.21513.help-gnu-emacs@gnu.org>
@ 2003-04-17 19:30   ` Steve Wainstead
  2003-04-18  0:40     ` auto-save-desktop? gebser
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Wainstead @ 2003-04-17 19:30 UTC (permalink / raw)


I'm trying this for now:

(defun desktop-auto-save ()
   "Added to auto-save-hook so the desktop is not lost."
   (desktop-save "~/")
   (message "Wrote desktop.")
   )

(add-hook 'auto-save-hook 'desktop-auto-save t)

Your code worked fine too... thanks!
~swain

Ehud Karni wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Tue, 15 Apr 2003 10:24:50 -0400, Steve Wainstead <swain@ampira.com> wrote:
> 
>>Does anyone know of an extension (or an existing way in Emacs that I 
>>missed) to automatically save the desktop? I'd like Emacs to do 
>>desktop-save to a user-specified file periodically; I lost my X session 
>>yesterday and had several open files.
> 
> 
> I have the following code on my .emacs :
> 
> (defun desktop-save-in-home-dir ()
>   "save desktop on home directory"
>        (if (buffer-file-name)          ;; do only for real files
>            (let (find-file-hooks       ;; must - do not loop on this function
>                  kill-buffer-hook)     ;; must - do not loop on this function
>                (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.
> 
> 
> - -- 
>  Ehud Karni           Tel: +972-3-7966-561  /"\
>  Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
>  Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
>  http://www.mvs.co.il  FAX:  1-815-5509341  / \
>  mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
> -----BEGIN PGP SIGNATURE-----
> Comment: use http://www.keyserver.net/ to get my key (and others)
> 
> iD8DBQE+nCwtLFvTvpjqOY0RAtkHAJ485I4poJObLlrvsv05NDqTiptGEACfYjcp
> PtfBs2pChwPdIa0Ac0hJBN0=
> =aMF1
> -----END PGP SIGNATURE-----
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: auto-save-desktop?
  2003-04-17 19:30   ` auto-save-desktop? Steve Wainstead
@ 2003-04-18  0:40     ` gebser
  2003-04-20 22:36       ` auto-save-desktop? Steve Wainstead
  0 siblings, 1 reply; 8+ messages in thread
From: gebser @ 2003-04-18  0:40 UTC (permalink / raw)



This sounds great.  I've always wanted a way to save a session like
you've described.  So I put your code verbatim into my .emacs.  
Question now is: how do I retrieve a session after coming back from,
say, an X crash???

tnx,
ken

At 15:30 (UTC-0400) on Thu, 17 Apr 2003 Steve Wainstead said:

= I'm trying this for now:
= 
= (defun desktop-auto-save ()
=    "Added to auto-save-hook so the desktop is not lost."
=    (desktop-save "~/")
=    (message "Wrote desktop.")
=    )
= 
= (add-hook 'auto-save-hook 'desktop-auto-save t)
= 
= Your code worked fine too... thanks!
= ~swain
= 
= Ehud Karni wrote:
= > -----BEGIN PGP SIGNED MESSAGE-----
= > Hash: SHA1
= > 
= > On Tue, 15 Apr 2003 10:24:50 -0400, Steve Wainstead <swain@ampira.com> wrote:
= > 
= >>Does anyone know of an extension (or an existing way in Emacs that I 
= >>missed) to automatically save the desktop? I'd like Emacs to do 
= >>desktop-save to a user-specified file periodically; I lost my X session 
= >>yesterday and had several open files.
= > 
= > 
= > I have the following code on my .emacs :
= > 
= > (defun desktop-save-in-home-dir ()
= >   "save desktop on home directory"
= >        (if (buffer-file-name)          ;; do only for real files
= >            (let (find-file-hooks       ;; must - do not loop on this function
= >                  kill-buffer-hook)     ;; must - do not loop on this function
= >                (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.
= > 
= > 
= > - -- 
= >  Ehud Karni           Tel: +972-3-7966-561  /"\
= >  Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
= >  Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
= >  http://www.mvs.co.il  FAX:  1-815-5509341  / \
= >  mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
= > -----BEGIN PGP SIGNATURE-----
= > Comment: use http://www.keyserver.net/ to get my key (and others)
= > 
= > iD8DBQE+nCwtLFvTvpjqOY0RAtkHAJ485I4poJObLlrvsv05NDqTiptGEACfYjcp
= > PtfBs2pChwPdIa0Ac0hJBN0=
= > =aMF1
= > -----END PGP SIGNATURE-----
= > 
= > 
= 
= _______________________________________________
= Help-gnu-emacs mailing list
= Help-gnu-emacs@gnu.org
= http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
= 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: auto-save-desktop?
  2003-04-18  0:40     ` auto-save-desktop? gebser
@ 2003-04-20 22:36       ` Steve Wainstead
  2003-04-26 12:52         ` auto-save-desktop? John Russell
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Wainstead @ 2003-04-20 22:36 UTC (permalink / raw)


I have two lines in my .emacs that take care of it.

;; load the desktop on startup
(desktop-load-default)
;; automatically save the desktop on exit.
(setq desktop-enable t)


Manually, just do M-x desktop-read to load the last saved desktop.

~swain


gebser@ameritech.net wrote:
> This sounds great.  I've always wanted a way to save a session like
> you've described.  So I put your code verbatim into my .emacs.  
> Question now is: how do I retrieve a session after coming back from,
> say, an X crash???
> 
> tnx,
> ken
> 
> At 15:30 (UTC-0400) on Thu, 17 Apr 2003 Steve Wainstead said:
> 
> = I'm trying this for now:
> = 
> = (defun desktop-auto-save ()
> =    "Added to auto-save-hook so the desktop is not lost."
> =    (desktop-save "~/")
> =    (message "Wrote desktop.")
> =    )
> = 
> = (add-hook 'auto-save-hook 'desktop-auto-save t)
> = 
> = Your code worked fine too... thanks!
> = ~swain
> = 
> = Ehud Karni wrote:
> = > -----BEGIN PGP SIGNED MESSAGE-----
> = > Hash: SHA1
> = > 
> = > On Tue, 15 Apr 2003 10:24:50 -0400, Steve Wainstead <swain@ampira.com> wrote:
> = > 
> = >>Does anyone know of an extension (or an existing way in Emacs that I 
> = >>missed) to automatically save the desktop? I'd like Emacs to do 
> = >>desktop-save to a user-specified file periodically; I lost my X session 
> = >>yesterday and had several open files.
> = > 
> = > 
> = > I have the following code on my .emacs :
> = > 
> = > (defun desktop-save-in-home-dir ()
> = >   "save desktop on home directory"
> = >        (if (buffer-file-name)          ;; do only for real files
> = >            (let (find-file-hooks       ;; must - do not loop on this function
> = >                  kill-buffer-hook)     ;; must - do not loop on this function
> = >                (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.
> = > 
> = > 
> = > - -- 
> = >  Ehud Karni           Tel: +972-3-7966-561  /"\
> = >  Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
> = >  Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
> = >  http://www.mvs.co.il  FAX:  1-815-5509341  / \
> = >  mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
> = > -----BEGIN PGP SIGNATURE-----
> = > Comment: use http://www.keyserver.net/ to get my key (and others)
> = > 
> = > iD8DBQE+nCwtLFvTvpjqOY0RAtkHAJ485I4poJObLlrvsv05NDqTiptGEACfYjcp
> = > PtfBs2pChwPdIa0Ac0hJBN0=
> = > =aMF1
> = > -----END PGP SIGNATURE-----
> = > 
> = > 
> = 
> = _______________________________________________
> = Help-gnu-emacs mailing list
> = Help-gnu-emacs@gnu.org
> = http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
> = 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: auto-save-desktop?
  2003-04-20 22:36       ` auto-save-desktop? Steve Wainstead
@ 2003-04-26 12:52         ` John Russell
  0 siblings, 0 replies; 8+ messages in thread
From: John Russell @ 2003-04-26 12:52 UTC (permalink / raw)



This url has a file called desktop-menu.el, which I find far more
useful than just desktop.el. It is built on top of desktop.el but
allows the saving of multiple desktops in a single
directory. Basically you can save as many as you like and access all
of them through a menu in a buffer.  I use emacs in X and very rarely
start it in the directory in which I am interested so this is much
easier.  I highly recommend it.

John

http://www.geekware.de/index3.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-04-26 12:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-15 14:24 auto-save-desktop? Steve Wainstead
2003-04-15 15:10 ` auto-save-desktop? Thomas Haselberger
2003-04-15 18:52   ` auto-save-desktop? Steve Wainstead
2003-04-15 15:58 ` auto-save-desktop? Ehud Karni
     [not found] ` <mailman.4659.1050422363.21513.help-gnu-emacs@gnu.org>
2003-04-17 19:30   ` auto-save-desktop? Steve Wainstead
2003-04-18  0:40     ` auto-save-desktop? gebser
2003-04-20 22:36       ` auto-save-desktop? Steve Wainstead
2003-04-26 12:52         ` auto-save-desktop? John Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).