From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Peter Neidhardt Newsgroups: gmane.emacs.bugs Subject: bug#28945: 25.2; desktop auto save timer does not work Date: Sun, 05 Nov 2017 17:18:07 +0100 Message-ID: <87375sya0w.fsf@gmail.com> References: <87k1znuphh.fsf@gmail.com> <83k1zf5v4y.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1509898758 26611 195.159.176.226 (5 Nov 2017 16:19:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 5 Nov 2017 16:19:18 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 25.3.1 Cc: 28945@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 05 17:19:11 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 1eBNdd-0006ay-IR for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Nov 2017 17:19:09 +0100 Original-Received: from localhost ([::1]:44809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBNdk-0003tF-FW for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Nov 2017 11:19:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBNdZ-0003sW-Jw for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 11:19:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBNdW-0005QE-F1 for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 11:19:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBNdW-0005QA-Ad for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 11:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eBNdW-0002tT-4c for bug-gnu-emacs@gnu.org; Sun, 05 Nov 2017 11:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Peter Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Nov 2017 16:19:02 +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.150989870011054 (code B ref 28945); Sun, 05 Nov 2017 16:19:02 +0000 Original-Received: (at 28945) by debbugs.gnu.org; 5 Nov 2017 16:18:20 +0000 Original-Received: from localhost ([127.0.0.1]:52418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBNcp-0002sE-Kr for submit@debbugs.gnu.org; Sun, 05 Nov 2017 11:18:19 -0500 Original-Received: from mail-wm0-f44.google.com ([74.125.82.44]:54893) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBNcn-0002ry-DU for 28945@debbugs.gnu.org; Sun, 05 Nov 2017 11:18:17 -0500 Original-Received: by mail-wm0-f44.google.com with SMTP id r68so9795961wmr.3 for <28945@debbugs.gnu.org>; Sun, 05 Nov 2017 08:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:references:user-agent:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=Zj7Fp3hyi39pym1n10XiikPFN4eJO5j6jiluEKoeMTI=; b=VTC1K0ojgWHn/wR30+Jul7HAXLiThche3+5gAFED315cuUM3FIYY2PRtWcYuTrnodc rn9QDEIH27LI9BlShHvObeYr1xnpatixHjmrJT+aiMx9QHalPcC0utSNFh3NZK7IwPN3 z/fr6CgsZInQk6VKoRFhKtOLJPkX/ZVrkCA7d+lZaBhtDS91s0sixZj6SM1n3/Eytxue 22z4IAOQRq7u69zb5HfeVgA9HnQRC7gSHGyB6/r2Rx/PxZ5qPaf80Sr9TQBkdtAARR8V 8MAaVk2KruP0dVnEon0rjq36xMxTMprdZETBLE7ESpiLyjtxDhxymQm6vSKsUSbSDKjP ejDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:references:user-agent:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=Zj7Fp3hyi39pym1n10XiikPFN4eJO5j6jiluEKoeMTI=; b=iUX+vq+z+OsAYV+7kx7i8PMb/wdQxf+FZSyIwqL/qvXc6pamFFVQIzhStipI9Ec+i5 UudNlTv0W0Lm4tJx/B7jF6EDV9lN8cCVL9hYNPUwB9tv8cvRJdoyLSTepO+Lr94uM13W /91Ro/JGhgmY4ZsePCsa2mRBD7zBsEd/+Nu1HaqlvkD8gH2huRXyr82AQwITxVxXjQ9d n9skkFzXEnuLy+4pT/yDpGnLksvkZWB4DqpfQ4Ma5Gu/+H/1YkZ3G6M/NSKd1Ow2UsjN bvRJSx4lkRbYLqEB10Za+iAqmS9mP8Dvu8mlb6HesLwzCRBEt0ztxEt2MjK3EdKWh5zz it2Q== X-Gm-Message-State: AJaThX7q8wBjAeso6Goy1OMHtr5PhaoUSkCwfSznpzUxxc7mX9qvE7RB lMXanlWW8ooVYtETDVILK7VZRg== X-Google-Smtp-Source: ABhQp+Qvy6G933t4SPWUY3eFwRFxizgFDz92DK2gwMu2pAlECVdkPUTWl1QPwPDc/i6Jk2N3OXQrCg== X-Received: by 10.28.87.13 with SMTP id l13mr3430680wmb.45.1509898691004; Sun, 05 Nov 2017 08:18:11 -0800 (PST) Original-Received: from dhiov23k ([197.0.145.22]) by smtp.gmail.com with ESMTPSA id p23sm24729613wrb.76.2017.11.05.08.18.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Nov 2017 08:18:09 -0800 (PST) X-Google-Original-From: Peter Neidhardt In-reply-to: <83k1zf5v4y.fsf@gnu.org> 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:139470 Archived-At: Eli Zaretskii writes: >> 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. You are right, there is more to trigger the issue: (desktop-save-mode 1) (global-linum-mode) What happens is that during intialization, window-configuration-change-hook is mode buffer-local by global-linum-mode. After init, desktop.el loads the desktop session, at which point the window-configuration-change-hook is still buffer-local and `desktop-read' fails. > 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? OK, thank you. >> 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? It is for debugging problems such as this one. While investigating after-init-hook, I saw that value: #[0 "\303\211\235\203\304\"\301\305!\210\210 \205\306 \210\307\211\207" [command-line-args desktop-save-mode inhibit-startup-screen "--no-desktop" delete 0 desktop-read t] 4]) Thankfully the word "desktop" is mentioned, otherwise it would have been hard to get the hunch that something was executed afterwards regarding the desktop. Function names make for good documentation, they make the self-documentation more meaningful. -- Peter Neidhardt You can always pick up your needle and move to another groove. -- Tim Leary