From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reuben Thomas Newsgroups: gmane.emacs.devel Subject: Re: desktop.el: autosave? Date: Tue, 11 Dec 2007 00:10:10 +0000 (GMT) Message-ID: References: <8763zjfe0v.fsf@jurta.org> <87mysridxt.fsf@jurta.org> <20071206153806.GA20731@www.trapp.net> <87d4tjbh0g.fsf@jurta.org> <87abon5q1f.fsf@jurta.org> <87lk835rb7.fsf@jurta.org> <87ejdu6rna.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: ger.gmane.org 1197331833 15667 80.91.229.12 (11 Dec 2007 00:10:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Dec 2007 00:10:33 +0000 (UTC) Cc: tomas@tuxteam.de, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 11 01:10:43 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J1sht-0000lf-Aj for ged-emacs-devel@m.gmane.org; Tue, 11 Dec 2007 01:10:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1shb-0007xw-Hn for ged-emacs-devel@m.gmane.org; Mon, 10 Dec 2007 19:10:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J1shX-0007xi-Fq for emacs-devel@gnu.org; Mon, 10 Dec 2007 19:10:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J1shS-0007xI-OL for emacs-devel@gnu.org; Mon, 10 Dec 2007 19:10:18 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1shS-0007xD-Fy for emacs-devel@gnu.org; Mon, 10 Dec 2007 19:10:14 -0500 Original-Received: from pelican.sc3d.org ([216.184.201.86]) by monty-python.gnu.org with esmtps (SSL 3.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J1shS-0003Tq-6Q for emacs-devel@gnu.org; Mon, 10 Dec 2007 19:10:14 -0500 DomainKey-Signature: a=rsa-sha1; s=key1024; d=sc3d.org; c=nofws; q=dns; b=yxlQk/OzAHP64L1JMoh2LBjccEEBhkzycBrsip0ZnYujB6ePMTgQF/UypVW07mWrddHEdy5g+9y3EHjXKljDCT1p/zLxNmhFTw5im9p19pS72rZm89s0dAozOOnnmXZznZUxvCRbDVOrD0XHyp2UcSdps8R+jnEwQ10prSHrLuw= Original-Received: from drom (cpc1-popl1-0-0-cust343.popl.cable.ntl.com [81.106.81.88]) by pelican.sc3d.org (pf ESMTP spamd IP-based SPAM blocker) with ASMTP (SSL) id QMV85912; Mon, 10 Dec 2007 19:10:12 -0500 X-X-Sender: rrt@localhost.localdomain In-Reply-To: <87ejdu6rna.fsf@jurta.org> User-Agent: Alpine 0.99999 (DEB 796 2007-11-08) X-detected-kernel: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:85008 Archived-At: 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)