From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28945: 25.2; desktop auto save timer does not work Date: Sat, 28 Oct 2017 15:12:13 +0300 Message-ID: <83k1zf5v4y.fsf@gnu.org> References: <87k1znuphh.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1509192795 22154 195.159.176.226 (28 Oct 2017 12:13:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 28 Oct 2017 12:13:15 +0000 (UTC) Cc: 28945@debbugs.gnu.org To: Peter Neidhardt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 28 14:13:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8Pz7-0004n8-3Q for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Oct 2017 14:13:05 +0200 Original-Received: from localhost ([::1]:60841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8PzE-0002BH-IO for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Oct 2017 08:13:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8Pz7-0002BA-AM for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2017 08:13:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e8Pz4-0001XP-14 for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2017 08:13:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e8Pz3-0001X3-TV for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2017 08:13:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e8Pz3-00009h-NX for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2017 08:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Oct 2017 12:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28945 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28945-submit@debbugs.gnu.org id=B28945.1509192749550 (code B ref 28945); Sat, 28 Oct 2017 12:13:01 +0000 Original-Received: (at 28945) by debbugs.gnu.org; 28 Oct 2017 12:12:29 +0000 Original-Received: from localhost ([127.0.0.1]:38124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8PyW-00008n-Qq for submit@debbugs.gnu.org; Sat, 28 Oct 2017 08:12:29 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8PyV-00008b-Du for 28945@debbugs.gnu.org; Sat, 28 Oct 2017 08:12:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e8PyN-0000vX-4s for 28945@debbugs.gnu.org; Sat, 28 Oct 2017 08:12:22 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8PyN-0000vT-1F; Sat, 28 Oct 2017 08:12:19 -0400 Original-Received: from [176.228.60.248] (port=4635 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e8PyM-0007kN-2V; Sat, 28 Oct 2017 08:12:18 -0400 In-reply-to: <87k1znuphh.fsf@gmail.com> (message from Peter Neidhardt on Sun, 22 Oct 2017 17:19:07 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139102 Archived-At: > From: Peter Neidhardt > Date: Sun, 22 Oct 2017 17:19:07 +0100 > > - Add (desktop-save-mode) to your init.el. > > - Start Emacs. Check the value of `window-configuration-change-hook': > the _global_ value should contain `desktop-auto-save-set-timer'. > > - Save the desktop. > > - Quit Emacs. > > - Restart Emacs. > > - Check `window-configuration-change-hook': the timer is gone. I tried this recipe, but couldn't reproduce the problem. I wonder what was missing from my reproduction experiment. My .emacs for this experiment had only one line: (desktop-save-mode 1) Is this different from what you tried? In my case, the timer is still there after restarting Emacs. > I've narrowed down the issue to `desktop-read': > > ;; ... > (setq desktop-autosave-was-enabled > (memq 'desktop-auto-save-set-timer 'window-configuration-change-hook)) > (desktop-auto-save-disable) > ;; ... > (if desktop-autosave-was-enabled (desktop-auto-save-enable)) > > The check is done on the _local_ value of > `window-configuration-change-hook', thus `desktop-auto-save-enable' will > never be re-run. Did you somehow make changes to the local value of window-configuration-change-hook? In my case, both the local value and the global value are identical. > While we are at it, we might change the documentation and value of `desktop-auto-save-timeout': > > Number of seconds idle time before auto-save of the desktop. > The idle timer activates auto-saving only when window configuration changes. > > This is terribly confusing, isn't it? One might wonder whether it's a > timer that saves every 30 seconds or the configuration change. > > The actual logic is as follow: > > - On every window configuration change, the timer is _reset_. > > - When idle for `desktop-auto-save-timeout', the desktop is saved. The > timer is run only _once_. I've changed the doc string of desktop-auto-save-timeout as follows: "Number of seconds of idle time before auto-saving the desktop. The desktop will be auto-saved when this amount of idle time have passed after some change in the window configuration. This applies to an existing desktop file when `desktop-save-mode' is enabled. Zero or nil means disable auto-saving due to idleness." And the doc string of desktop-auto-save-set-timer now says this: "Set the desktop auto-save timer. Cancel any previous timer. When `desktop-auto-save-timeout' is a positive integer, start a new idle timer to call `desktop-auto-save' after that many seconds of idle time. This function is called from `window-configuration-change-hook'." OK? > In practice, this means that the user actually be idle for 30 seconds or > else it won't get saved at all. It will be saved when Emacs exits. > Lastly, a minor nit: desktop.el adds a lambda to `after-init-hook'; can > we turn this into a named function? Why is that important? This hook runs long before the user starts interacting with Emacs, so there doesn't seem to be any good reason for the user to look into what this function does. Or am I missing something? Thanks.