bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28945: 25.2; desktop auto save timer does not work


From: Peter Neidhardt
Subject: bug#28945: 25.2; desktop auto save timer does not work
Date: Sun, 05 Nov 2017 17:18:07 +0100
User-agent: mu4e 0.9.18; emacs 25.3.1

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Peter Neidhardt <pe.neidhardt@googlemail.com>
>> 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





reply via email to

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