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: Tue, 11 Dec 2007 00:10:10 +0000 (GMT)
User-agent: Alpine 0.99999 (DEB 796 2007-11-08)

On Tue, 11 Dec 2007, Juri Linkov wrote:

1. A customizable preference, desktop-auto-save, which indicates whether
desktop-save-in-desktop-dir should be added to auto-save-hook or not. Is
the easiest way to do this to add a private function that desktop mode
always adds to auto-save-hook and then have that private function test
a boolean which is itself the customizable preference when it runs, to see
whether to proceed or not?

No need for a separate function.  You could just change desktop-save-mode
as follows:

(define-minor-mode desktop-save-mode
 :global t
 :group 'desktop
 (if desktop-save-mode
     (if desktop-auto-save
          (add-hook 'auto-save-hook 'desktop-save-in-desktop-dir))
   (remove-hook 'auto-save-hook 'desktop-save-in-desktop-dir)))

Is that how other similar features work? If you change the desktop-auto-save preference while desktop-save-mode is active, it won't actually stop saving.

But please note that I still think it would be better to use a timer. You can look in savehist.el that it uses a separate non-idle timer. It seems reasonable to do the same in desktop.el.

Fair enough.

--
http://rrt.sc3d.org/ | traddutore, v.t.  traditore (Anon)




reply via email to

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