emacs-devel
[Top][All Lists]
Advanced

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

Re: desktop.el: autosave?


From: Juri Linkov
Subject: Re: desktop.el: autosave?
Date: Sat, 01 Dec 2007 02:35:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> auto-save-hook could do this job.

I use in .emacs:

  (defun my-desktop-save ()
    (interactive)
    ;; `desktop-owner' is a new function in Emacs 22.1.50 to check
    ;; for conflicts between two running Emacs instances.
    ;; We don't want automatic saving in the second Emacs process.
    (if (and (fboundp 'desktop-owner) (eq (desktop-owner) (emacs-pid)))
        (desktop-save "~")))

  ;; Save the desktop every hour
  (run-at-time 3600 3600 'my-desktop-save)

But maybe instead of requiring putting this code in .emacs for
every user who want to save the desktop periodically, we should
add a new user option to desktop.el that specifies time interval
of auto-saving?  I think the default value of `auto-save-timeout'
is too frequent for a heavy function `desktop-save'.  And also
standard auto-saving mechanism works on files, but the desktop
doesn't keep the desktop file permanently visited.

> Date: Fri, 30 Nov 2007 14:08:07 +0000 (GMT)
> From: Reuben Thomas <address@hidden>
> To: address@hidden
> Message-ID: <address@hidden>
> MIME-Version: 1.0
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
> Cc:
> Subject: desktop.el: autosave?
>
> desktop.el is great; I've used it since before it became part of Emacs.
>
> However, I sometimes lose my Emacs session for various reasons (hardly ever
> because of Emacs itself, usually for some stupid reason like updating a
> kernel, and then suspending instead of rebooting). When I come back, I get
> my old Emacs session. Of course, the files I'm editing all have auto-saved
> copies, if I need them. It would be nice if desktop mode could similarly
> write a desktop save file from time to time during the editing session so
> that if like me, you leave Emacs running all the time, you don't risk going
> back to a collection of files days or weeks out of date should you lose your
> Emacs session.
>
> Since desktop already does things when Emacs is idle, it seems to me (I admit 
> I
> know nothing about this area of programming Emacs, I've only dabbled in elisp
> to the extent I need to to customize Emacs) that it should be fairly simple to
> add the ability to save out a new desktop save file from time to time when
> Emacs is idle. I imagine the period would be customizable, but every half hour
> or so would seem to be the right order of default.
>
> --
> http://rrt.sc3d.org/ | The Next Station Is Oval (Anon)

--
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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