emacs-devel
[Top][All Lists]
Advanced

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

Re: desktop.el: autosave?


From: Reuben Thomas
Subject: Re: desktop.el: autosave?
Date: Sun, 9 Dec 2007 20:35:57 +0000 (GMT)
User-agent: Alpine 0.99999 (DEB 796 2007-11-08)

On Fri, 7 Dec 2007, Juri Linkov wrote:

Saving a buffer's file is fast operation comparing to saving the desktop
that takes more time because it is a cpu-intensive task that collects
information from all buffers and some possibly long lists and writes
to the usually large desktop file.  The default timeout for auto-save
is 30 sec which is ok for auto-saving normal files, but I don't see a
need to waste resources to save the desktop so often.

It's easy to argue about this, but numbers are more convincing. I don't
know anything about instrumenting functions in Emacs; how can I find out
how long Emacs spends running desktop-save over a particular time period?

You can evaluate:

(let ((start (float-time))) (desktop-save desktop-dirname) (- (float-time) 
start))

After about 30 hours, saving the desktop had accumulated about 50s of time this way. That seems a reasonable amount to me. I have 137 buffers in my session, and my desktop file is about 38,000 bytes long. Hence, I suggest that a simple feature "Auto-save desktop" which adds desktop-save-in-desktop-dir to auto-save-hook, would satisfy most people likely to use this feature. Furthermore those concerned about power usage and disk spin-up only have to worry about the same Emacs feature (auto-save-hook), and not add another hook or function to their list of things to tweak.

To ensure that this doesn't make auto-save-hook ask for input interactively, desktop-save-in-desktop-dir should be made only to prompt for the desktop-dir (when it's not set) if it's being run interactively.

--
http://rrt.sc3d.org/ | priest, n.  an unpaid lawyer (q.v.)




reply via email to

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