From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 10 17:05:30 2013 Received: (at submit) by debbugs.gnu.org; 10 Sep 2013 21:05:30 +0000 Received: from localhost ([127.0.0.1]:53403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJV7p-0006R2-Lx for submit@debbugs.gnu.org; Tue, 10 Sep 2013 17:05:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53679) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJV7m-0006Qj-Di for submit@debbugs.gnu.org; Tue, 10 Sep 2013 17:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJV7Y-0004CP-VQ for submit@debbugs.gnu.org; Tue, 10 Sep 2013 17:05:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJV7Y-0004CF-RX for submit@debbugs.gnu.org; Tue, 10 Sep 2013 17:05:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJV7S-0004qp-2T for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2013 17:05:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJV7M-0003vf-2U for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2013 17:05:06 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:36775 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJV7L-0003vZ-Qa for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2013 17:04:59 -0400 Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 5C4D7258B9E935 for ; Tue, 10 Sep 2013 14:04:58 -0700 (PDT) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Idle timer for desktop Organization: JURTA Date: Tue, 10 Sep 2013 23:57:31 +0300 Message-ID: <87hadsgzpj.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Tags: patch It's very distracting when periodic desktop saves interrupt the active editing for approximately 2 seconds to save the desktop. This is because `desktop-auto-save-timeout' ignores idleness when better to save the desktop in convenient time without distraction. This means that another idle timer is necessary in addition to the idleness-ignoring timer. As were discussed some time ago on emacs-devel both timers are needed. This patch implements proper interaction between these two timers. === modified file 'lisp/desktop.el' --- lisp/desktop.el 2013-07-01 03:29:46 +0000 +++ lisp/desktop.el 2013-09-10 20:50:10 +0000 @@ -191,7 +191,14 @@ (defcustom desktop-save 'ask-if-new (defcustom desktop-auto-save-timeout nil "Number of seconds between auto-saves of the desktop. -Zero or nil means disable timer-based auto-saving." +Zero or nil means disable timer-based auto-saving. +If `desktop-auto-save-idle-timeout' is non-nil then the desktop is +not saved immediately after the timeout of `desktop-auto-save-timeout', +but another idle timer is set that saves the desktop after the number +of idle seconds defined by `desktop-auto-save-idle-timeout'. +Thus the total timeout between desktop auto-saves is the sum +of seconds of `desktop-auto-save-timeout' plus idle seconds +of `desktop-auto-save-idle-timeout'." :type '(choice (const :tag "Off" nil) (integer :tag "Seconds")) :set (lambda (symbol value) @@ -202,6 +209,24 @@ (defcustom desktop-auto-save-timeout nil :group 'desktop :version "24.4") +(defcustom desktop-auto-save-idle-timeout nil + "Number of idle seconds between auto-saves of the desktop. +Zero or nil means disable timer-based idle auto-saving. +If `desktop-auto-save-timeout' is non-nil then an idle timer +is set after the timeout defined by `desktop-auto-save-timeout'. +Thus the total timeout between desktop auto-saves is the sum +of seconds of `desktop-auto-save-timeout' plus idle seconds +of `desktop-auto-save-idle-timeout'." + :type '(choice (const :tag "Off" nil) + (integer :tag "Idle Seconds")) + :set (lambda (symbol value) + (set-default symbol value) + (condition-case nil + (desktop-auto-save-set-timer) + (error nil))) + :group 'desktop + :version "24.4") + (defcustom desktop-load-locked-desktop 'ask "Specifies whether the desktop should be loaded if locked. Possible values are: @@ -1219,8 +1244,10 @@ (defun desktop-auto-save () "Save the desktop periodically. Called by the timer created in `desktop-auto-save-set-timer'." (when (and desktop-save-mode - (integerp desktop-auto-save-timeout) - (> desktop-auto-save-timeout 0) + (or (and (integerp desktop-auto-save-timeout) + (> desktop-auto-save-timeout 0)) + (and (integerp desktop-auto-save-idle-timeout) + (> desktop-auto-save-idle-timeout 0))) ;; Avoid desktop saving during lazy loading. (not desktop-lazy-timer) ;; Save only to own desktop file. @@ -1230,17 +1257,46 @@ (defun desktop-auto-save () (desktop-auto-save-set-timer)) (defun desktop-auto-save-set-timer () - "Reset the auto-save timer. + "Set the auto-save timer. Cancel any previous timer. When `desktop-auto-save-timeout' is a positive -integer, start a new timer to call `desktop-auto-save' in that many seconds." +integer, start a new timer to call `desktop-auto-save' in that many seconds. +When `desktop-auto-save-idle-timeout' is a positive integer, +then start a new timer to call `desktop-auto-save-set-idle-timer'." + (when desktop-auto-save-timer + (cancel-timer desktop-auto-save-timer) + (setq desktop-auto-save-timer nil)) + (if (and (integerp desktop-auto-save-timeout) + (> desktop-auto-save-timeout 0)) + (if (and (integerp desktop-auto-save-idle-timeout) + (> desktop-auto-save-idle-timeout 0)) + (setq desktop-auto-save-timer + (run-with-timer desktop-auto-save-timeout nil + 'desktop-auto-save-set-idle-timer)) + (setq desktop-auto-save-timer + (run-with-timer desktop-auto-save-timeout nil + 'desktop-auto-save))) + (if (and (integerp desktop-auto-save-idle-timeout) + (> desktop-auto-save-idle-timeout 0)) + (desktop-auto-save-set-idle-timer)))) + +(defun desktop-auto-save-set-idle-timer () + "Set the auto-save idle timer. +Cancel any previous timer. When `desktop-auto-save-idle-timeout' is a positive +integer, start a new idle timer to call `desktop-auto-save' in that number +of idle seconds." (when desktop-auto-save-timer (cancel-timer desktop-auto-save-timer) (setq desktop-auto-save-timer nil)) - (when (and (integerp desktop-auto-save-timeout) - (> desktop-auto-save-timeout 0)) + (when (and (integerp desktop-auto-save-idle-timeout) + (> desktop-auto-save-idle-timeout 0)) (setq desktop-auto-save-timer - (run-with-timer desktop-auto-save-timeout nil - 'desktop-auto-save)))) + (run-with-idle-timer + ;; Compute an idle time desktop-auto-save-idle-timeout + ;; more than the current value. + (time-add (or (current-idle-time) '(0 0 0 0)) + (seconds-to-time desktop-auto-save-idle-timeout)) + nil + 'desktop-auto-save)))) ;; ---------------------------------------------------------------------------- ;;;###autoload From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 11 13:24:03 2013 Received: (at 15331) by debbugs.gnu.org; 11 Sep 2013 17:24:03 +0000 Received: from localhost ([127.0.0.1]:56086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJo93-00088O-R6 for submit@debbugs.gnu.org; Wed, 11 Sep 2013 13:24:02 -0400 Received: from mail-qe0-f49.google.com ([209.85.128.49]:50796) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJo91-000882-JL for 15331@debbugs.gnu.org; Wed, 11 Sep 2013 13:24:00 -0400 Received: by mail-qe0-f49.google.com with SMTP id s14so4904613qeb.36 for <15331@debbugs.gnu.org>; Wed, 11 Sep 2013 10:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:user-agent:return-receipt-to:reply-to :date:message-id:mime-version:content-type; bh=EtFwPlVeiXeXWTuWXltJSgBQjTP2iUhz+73BYr7Aa9k=; b=NxresodK2qw2ma+k/tyfpg2BPexq9C/Qrp1OkAV+z92jrlYRBFo03Q+7QSJQf7e8p6 PO8dqnjUyHOBfjRjNYHGzSZSsn2VcMlysJ6Z2qsohY7+1uY7uo5skPaVm8cMx7iZVKX6 fLuI6TAu0KmSlP6ZXzeSf+N0mMh3u8bp6XbAJoOPSLhn3amAejj7kdxDeDewW0tk3ySQ 99DACM+BjqMV74UOsEnxsnFuz1nuMUSvDgIM+zp56Zq2x89wslbXSP/xy9MVS76ZGouj pVHWPKbItWWExQ+UZWANkdYpR5SeTo74OdmAY6RyvmMgbwQ1ntjmy9xBMnKD7svuhB6k 2+Jw== X-Received: by 10.49.15.97 with SMTP id w1mr5090241qec.13.1378920233797; Wed, 11 Sep 2013 10:23:53 -0700 (PDT) Received: from t520sds ([74.113.160.197]) by mx.google.com with ESMTPSA id h2sm47886540qev.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 11 Sep 2013 10:23:53 -0700 (PDT) From: Sam Steingold To: 15331@debbugs.gnu.org Subject: desktop should auto-save on idle time User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Date: Wed, 11 Sep 2013 13:23:52 -0400 Message-ID: <878uz3p907.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15331 Cc: juri@jurta.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: sds@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) I think the proposed solution is overly complicated. I think the better solution is to use idle timer instead and default `desktop-auto-save-timeout' to `auto-save-timeout' (i.e., enable by default). -- Sam Steingold (http://sds.podval.org/) on Ubuntu 13.04 (raring) X 11.0.11303000 http://www.childpsy.net/ http://palestinefacts.org http://www.memritv.org http://pmw.org.il http://ffii.org http://memri.org Parachute for sale, used once, never opened, small stain. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 11 15:47:04 2013 Received: (at 15331) by debbugs.gnu.org; 11 Sep 2013 19:47:04 +0000 Received: from localhost ([127.0.0.1]:56406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJqNT-0003Vl-Nk for submit@debbugs.gnu.org; Wed, 11 Sep 2013 15:47:03 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:48767 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJqNR-0003VI-JI for 15331@debbugs.gnu.org; Wed, 11 Sep 2013 15:47:02 -0400 Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 32372258B9E935; Wed, 11 Sep 2013 12:46:58 -0700 (PDT) From: Juri Linkov To: Sam Steingold Subject: Re: desktop should auto-save on idle time Organization: JURTA References: <878uz3p907.fsf@gnu.org> Date: Wed, 11 Sep 2013 22:45:48 +0300 In-Reply-To: <878uz3p907.fsf@gnu.org> (Sam Steingold's message of "Wed, 11 Sep 2013 13:23:52 -0400") Message-ID: <87bo3z5ehf.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 15331 Cc: 15331@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > I think the proposed solution is overly complicated. > I think the better solution is to use idle timer instead and default > `desktop-auto-save-timeout' to `auto-save-timeout' (i.e., enable by default). You can't use idle timers even with such reasonable timeouts as 5 minutes between saves, i.e. when the user needs to save the desktop every 5 minutes, with idle timers the user have to sit inactively 5 minutes waiting for Godot^H^H^H^H^H desktop saving. Thus desktop saving requires two different timers out of necessity. You can see the whole relevant emacs-devel thread where this problem was discussed here: http://thread.gmane.org/gmane.emacs.bugs/17096/focus=158816 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 11 20:57:11 2013 Received: (at 15331) by debbugs.gnu.org; 12 Sep 2013 00:57:11 +0000 Received: from localhost ([127.0.0.1]:57155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJvDa-0003J1-Oh for submit@debbugs.gnu.org; Wed, 11 Sep 2013 20:57:10 -0400 Received: from mail-ee0-f45.google.com ([74.125.83.45]:58093) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VJvDW-0003IS-Vj for 15331@debbugs.gnu.org; Wed, 11 Sep 2013 20:57:08 -0400 Received: by mail-ee0-f45.google.com with SMTP id c50so4972186eek.18 for <15331@debbugs.gnu.org>; Wed, 11 Sep 2013 17:57:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=yURGOJg0jqgEnvk4nYv8OFWTbf74KbRFMOIksHUFygQ=; b=xnzj9pLYevJmsx5nStVqYQWe0dorQLU6vaTe9r2Slgj2Du76adIerDVDVNFdUy+p6H VNaB89nHBIlKXVFvx8VEn+fg5W2B48TGFjm43R/EHes71XJDtb77vIfIl9VAg/KjJqd9 3ai00+UCZaiqIYKg+ALNCgBOcAT2cZmIm0dpzETQPQuM3Gz4S2IYwfu+RtDCXdCmLP0V c+pPYOs/LG5QbmJnk6Op8aTdw4ZPSH/Rrkv3kACGkFdpzAI2QVv7xtOokoMvgZlN0B3J x6HpTgJzVSsdQCdHvTGBuGBqrMAWwipgYNGaq6D6kyGkkpKzUQeP4sr4AfneOrmRjab5 SdYw== X-Received: by 10.15.75.73 with SMTP id k49mr6556956eey.36.1378947420505; Wed, 11 Sep 2013 17:57:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.14.133.15 with HTTP; Wed, 11 Sep 2013 17:56:20 -0700 (PDT) In-Reply-To: <87bo3z5ehf.fsf@mail.jurta.org> References: <878uz3p907.fsf@gnu.org> <87bo3z5ehf.fsf@mail.jurta.org> From: Juanma Barranquero Date: Thu, 12 Sep 2013 02:56:20 +0200 Message-ID: Subject: Re: bug#15331: desktop should auto-save on idle time To: Juri Linkov Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15331 Cc: Sam Steingold , 15331@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Wed, Sep 11, 2013 at 9:45 PM, Juri Linkov wrote: > You can't use idle timers even with such reasonable timeouts > as 5 minutes between saves, i.e. when the user needs to save > the desktop every 5 minutes, with idle timers the user have to sit > inactively 5 minutes waiting for Godot^H^H^H^H^H desktop saving. > Thus desktop saving requires two different timers out of necessity. Or, the desktop can be saved after 5 minutes (or whatever) of idle time, and if the user needs more frequency, they can bind desktop-save-in-desktop-dir and do it manually... When I'm writing or translating with LibreOffice, I do not trust autosaving. I type Ctrl-S after every paragraph. Seems saner. J From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 12 17:03:44 2013 Received: (at 15331) by debbugs.gnu.org; 12 Sep 2013 21:03:44 +0000 Received: from localhost ([127.0.0.1]:59753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKE3D-0004m9-3I for submit@debbugs.gnu.org; Thu, 12 Sep 2013 17:03:43 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:51267 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKE3B-0004m0-Ey for 15331@debbugs.gnu.org; Thu, 12 Sep 2013 17:03:41 -0400 Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id D2060258B9E935; Thu, 12 Sep 2013 14:03:39 -0700 (PDT) From: Juri Linkov To: Juanma Barranquero Subject: Re: bug#15331: desktop should auto-save on idle time Organization: JURTA References: <878uz3p907.fsf@gnu.org> <87bo3z5ehf.fsf@mail.jurta.org> Date: Thu, 12 Sep 2013 23:58:16 +0300 In-Reply-To: (Juanma Barranquero's message of "Thu, 12 Sep 2013 02:56:20 +0200") Message-ID: <87d2odu593.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 15331 Cc: Sam Steingold , 15331@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) >> You can't use idle timers even with such reasonable timeouts >> as 5 minutes between saves, i.e. when the user needs to save >> the desktop every 5 minutes, with idle timers the user have to sit >> inactively 5 minutes waiting for Godot^H^H^H^H^H desktop saving. >> Thus desktop saving requires two different timers out of necessity. > > Or, the desktop can be saved after 5 minutes (or whatever) of idle > time, and if the user needs more frequency, they can bind > desktop-save-in-desktop-dir and do it manually... Or use the timer to display every 5 minutes a message "Don't forget to type M-x desktop-save-in-desktop-dir RET" :-) > When I'm writing or translating with LibreOffice, I do not trust > autosaving. I type Ctrl-S after every paragraph. Seems saner. Unlike LibreOffice, we can fix desktop.el in a way that you'll trust Emacs autosaving :-) From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 16 17:36:56 2013 Received: (at 15331) by debbugs.gnu.org; 16 Sep 2013 21:36:56 +0000 Received: from localhost ([127.0.0.1]:41947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLgTY-0003re-5G for submit@debbugs.gnu.org; Mon, 16 Sep 2013 17:36:56 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:39521 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VLgTV-0003rO-L0 for 15331@debbugs.gnu.org; Mon, 16 Sep 2013 17:36:54 -0400 Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 2D4DC258B9E937; Mon, 16 Sep 2013 14:36:51 -0700 (PDT) From: Juri Linkov To: Juanma Barranquero Subject: Re: bug#15331: desktop should auto-save on idle time Organization: JURTA References: <878uz3p907.fsf@gnu.org> <87bo3z5ehf.fsf@mail.jurta.org> <87d2odu593.fsf@mail.jurta.org> Date: Tue, 17 Sep 2013 00:18:52 +0300 In-Reply-To: <87d2odu593.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 12 Sep 2013 23:58:16 +0300") Message-ID: <87ioy0sbwt.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 15331 Cc: Sam Steingold , 15331@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Another problem is that `desktop-saved-frameset' added to the desktop now prevents auto-saving from detecting whether the contents of the desktop file changed. It now auto-saves the desktop always because `desktop-saved-frameset' now contains a timestamp. This patch skips these lines with a timestamp, so the remaining content of the desktop can be checked for changes. === modified file 'lisp/desktop.el' --- lisp/desktop.el 2013-09-15 16:25:02 +0000 +++ lisp/desktop.el 2013-09-16 21:18:39 +0000 @@ -1012,10 +1012,16 @@ (defun desktop-save (dirname &optional r (insert ")\n\n")))) (setq default-directory desktop-dirname) - ;; If auto-saving, avoid writing if nothing has changed since the last write. - ;; Don't check 300 characters of the header that contains the timestamp. + ;; When auto-saving, avoid writing if nothing has changed + ;; since the last write. Don't check 10 lines of the header + ;; with constantly-changing timestamp and also don't check + ;; the first non-header line with desktop-saved-frameset + ;; that also contains a timestamp. (let ((checksum (and auto-save (md5 (current-buffer) - (+ (point-min) 300) (point-max) + (save-excursion + (goto-char (point-min)) + (line-beginning-position 11)) + (point-max) 'emacs-mule)))) (unless (and auto-save (equal checksum desktop-file-checksum)) (let ((coding-system-for-write 'emacs-mule)) From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 16 16:49:55 2013 Received: (at 15331-done) by debbugs.gnu.org; 16 Dec 2013 21:49:55 +0000 Received: from localhost ([127.0.0.1]:54568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vsg31-0004fj-5Y for submit@debbugs.gnu.org; Mon, 16 Dec 2013 16:49:55 -0500 Received: from [69.163.184.122] (port=56101 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vsg2x-0004fZ-4e for 15331-done@debbugs.gnu.org; Mon, 16 Dec 2013 16:49:52 -0500 Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.184.122]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 278D634CB01680; Mon, 16 Dec 2013 13:49:48 -0800 (PST) From: Juri Linkov To: Sam Steingold Subject: bug#15331: desktop should auto-save on idle time Organization: JURTA References: <878uz3p907.fsf@gnu.org> Date: Mon, 16 Dec 2013 23:49:06 +0200 In-Reply-To: <878uz3p907.fsf@gnu.org> (Sam Steingold's message of "Wed, 11 Sep 2013 13:23:52 -0400") Message-ID: <87txe831rh.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > I think the proposed solution is overly complicated. > I think the better solution is to use idle timer instead and default > `desktop-auto-save-timeout' to `auto-save-timeout' (i.e., enable by default). [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Debbugs-Envelope-To: 15331-done Cc: 15331-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > I think the proposed solution is overly complicated. > I think the better solution is to use idle timer instead and default > `desktop-auto-save-timeout' to `auto-save-timeout' (i.e., enable by default). [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS > I think the proposed solution is overly complicated. > I think the better solution is to use idle timer instead and default > `desktop-auto-save-timeout' to `auto-save-timeout' (i.e., enable by default). I like the simplicity too, and since there were less requests for the real-time timer than for the idle timer, I just replaced the former with the latter. From unknown Tue Sep 23 23:21:46 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 14 Jan 2014 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator