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

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

[debbugs-tracker] bug#28945: closed (25.2; desktop auto save timer does


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#28945: closed (25.2; desktop auto save timer does not work)
Date: Sat, 11 Nov 2017 09:59:02 +0000

Your message dated Sat, 11 Nov 2017 11:58:38 +0200
with message-id <address@hidden>
and subject line Re: bug#28945: 25.2; desktop auto save timer does not work
has caused the debbugs.gnu.org bug report #28945,
regarding 25.2; desktop auto save timer does not work
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
28945: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=28945
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 25.2; desktop auto save timer does not work Date: Sun, 22 Oct 2017 17:19:07 +0100 User-agent: mu4e 0.9.18; emacs 25.2.1
Recipe:

- 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'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.

The fix is as simple as

        (setq desktop-autosave-was-enabled
          (memq 'desktop-auto-save-set-timer (default-toplevel-value 
'window-configuration-change-hook)))



I've been annoyed by this issue for years but before today I could not
find the logic behind the issue and did not know what to report.  The
issue effectively makes desktop-mode half-useless since desktop won't be
saved when Emacs gets killed too abruptly (crashes, power outage...).

Did nobody notice this before or is it that nobody could figure out the
logic like me?



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_.

In practice, this means that the user actually be idle for 30 seconds or
else it won't get saved at all.  Does this happen a lot in practice?
I'm don't think so.  Considering the timer runs only once per window
conf change, it does not run very often, in particular it runs only once
when nothing is happening.

So I think it's wiser to set the default to something much lower, say 5
or 10.



Lastly, a minor nit: desktop.el adds a lambda to `after-init-hook'; can
we turn this into a named function?



In GNU Emacs 25.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.16)
 of 2017-09-02 built on dhiov23k
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description:     Gentoo Base System release 2.4.1

Configured using:
 'configure --prefix=/usr --build=x86_64-pc-linux-gnu
 --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --disable-dependency-tracking
 --disable-silent-rules --docdir=/usr/share/doc/emacs-25.2
 --htmldir=/usr/share/doc/emacs-25.2/html --libdir=/usr/lib64
 --program-suffix=-emacs-25 --infodir=/usr/share/info/emacs-25
 --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --with-gameuser=:gamestat --without-compress-install
 --with-file-notification=inotify --enable-acl --without-dbus
 --without-modules --without-gpm --without-hesiod --without-kerberos
 --without-kerberos5 --with-xml2 --without-selinux --with-gnutls
 --without-wide-int --with-zlib --with-sound=alsa --with-x --without-ns
 --without-gconf --without-gsettings --without-toolkit-scroll-bars
 --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm
 --with-imagemagick --with-xft --without-cairo --without-libotf
 --without-m17n-flt --with-x-toolkit=gtk3 --without-xwidgets
 GENTOO_PACKAGE=app-editors/emacs-25.2 'CFLAGS=-march=ivybridge -O2
 -pipe' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND NOTIFY ACL GNUTLS LIBXML2
FREETYPE XFT ZLIB GTK3 X11

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Debbugs

Minor modes in effect:
  semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode 
semantic-show-unmatched-syntax-mode)  S)))
  recentf-mode: t
  pdf-occur-global-minor-mode: t
  helm-top-poll-mode: t
  dired-async-mode: t
  helm-mode: t
  diff-auto-refine-mode: t
  helm-descbinds-mode: t
  global-evil-mc-extras-mode: t
  evil-mc-extras-mode: t
  global-evil-mc-mode: t
  evil-mc-mode: t
  async-bytecomp-package-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  show-paren-mode: t
  savehist-mode: t
  save-place-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t



--- End Message ---
--- Begin Message --- Subject: Re: bug#28945: 25.2; desktop auto save timer does not work Date: Sat, 11 Nov 2017 11:58:38 +0200
> From: Peter Neidhardt <address@hidden>
> Cc: address@hidden
> Date: Sun, 05 Nov 2017 17:18:07 +0100
> 
> > 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)

You may wish to try the new native display of line numbers in Emacs
26, which doesn't have this problem (and is significantly faster).

> 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.

Thanks, now everything is clear.

I installed your suggested fix into the release branch, and I'm
marking this bug done.

> >> 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.

Yes, but that's an argument against _any_ use of lambda functions in
Emacs (because we don't really have opaque APIs).  So I'm not sure we
need to convert this to a named function.


--- End Message ---

reply via email to

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