bug#81561: 31.0.91; speedbar-window-mode creates stale idle timers

Vincenzo Pupillo <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Ciao, sorry for the delay—I'm on vacation. The attached patch should fix the 
bug. It's partly due to an incorrect condition in 'dframe-set-timer' that 
doesn't follow what's written in the comment. This fix also resolves an issue 
with 'speedbar-frame-mode,' which wasn't clearing the timer even when 
'speedbar-buffer' was killed.

@Daniel, can you please check to see if the patch fixes the problem?

Vincenzo

In data mercoledì 5 agosto 2026 18:04:46 Ora legale dell’Europa centrale, hai 
scritto:
> > Date: Wed, 05 Aug 2026 17:51:22 +0200
> > From: Daniel Mendler via "Bug reports for GNU Emacs,
> > 
> > the Swiss army knife of text editors" <[email protected]>
> > 
> > The new `speedbar-window-mode' (Emacs 31) leaves stale idle timers
> > around. In order to reproduce:
> > 
> > 1. emacs -Q
> > 2. M-x speedbar-window-mode (repeat a few times)
> > 3. M-x list-timers => Multiple idle timers are present
> > 
> > (dframe-timer-fn) while there should only be a single one.
> > 
> > Alternatively:
> > 
> > 1. emacs -Q
> > 2. (setq speedbar-prefer-window t)
> > 3. M-x speedbar (repeat a few times)
> > 4. M-x list-timers => Multiple idle timers are present
> > 
> > (dframe-timer-fn) while there should only be a single one.
> > 
> > When testing with frames (without speedbar-window-mode) I don't observe
> > the problem and there is always only a single dframe-timer-fn idle
> > timer.
> 
> Thanks. Vincenzo, could you please look into fixing this?
> 
> > In GNU Emacs 31.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> > 
> > 3.24.49, cairo version 1.18.4) of 2026-07-30
> > 
> > Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
> > System Description: Debian GNU/Linux 13 (trixie)
> > 
> > Configured using:
> > 'configure --prefix=$HOME/.local/share/emacs-install
> > --without-compress-install --with-tree-sitter=ifavailable
> > --with-native-compilation --with-dbus --without-selinux
> > --without-threads --disable-gc-mark-trace --without-gsettings
> > --without-gpm --with-cairo --with-cairo-xcb --with-xinput2
> > --with-x-toolkit=gtk3 --without-toolkit-scroll-bars 'CFLAGS=-O3
> > -mtune=native -march=native''
> > 
> > Configured features:
> > CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD
> > LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
> > SOUND SQLITE3 TIFF TREE_SITTER WEBP X11 XCOMPOSITE XDBE XFIXES XIM
> > XINERAMA XINPUT2 XPM XRANDR XRENDER XSHAPE XSYNC GTK3 ZLIB
0001-Speedbar-no-more-stale-idle-timers-bug-81561.patch (text/x-patch, 1.6 KB)
From e9e52dfb8b4075173e87dca345e17cfa27f1d08f Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo <[email protected]>
Date: Sat, 8 Aug 2026 23:08:53 +0200
Subject: [PATCH] Speedbar: no more stale idle timers (bug#81561)

* lisp/dframe.el (dframe-set-timer): Fixed the condition for removing
the timer (the code does not match what is written in the comment).
* lisp/speedbar.el (speedbar-window--close): 'speedbar-set-timer' must
be called from the 'speedbar-buffer'.
---
 lisp/dframe.el   | 2 +-
 lisp/speedbar.el | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/dframe.el b/lisp/dframe.el
index 2332ef3056f..08dd8aa873c 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -652,7 +652,7 @@ dframe-set-timer
        timeout
        ;; We have a timer, an off is requested, and no client
        ;; functions are left, shut er down.
-       (and dframe-timer (not timeout) dframe-client-functions))
+       (and dframe-timer (not timeout) (not dframe-client-functions)))
       ;; Only call the low level function if we are changing the state.
       (dframe-set-timer-internal timeout)))
 
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 08af40a0aca..3e965d4286c 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -1123,7 +1123,8 @@ speedbar-window--close
       (setq speedbar--window nil
 	    speedbar-frame nil
 	    dframe-attached-frame nil)
-      (speedbar-set-timer nil)
+      (with-current-buffer speedbar-buffer
+        (speedbar-set-timer nil))
       (kill-buffer speedbar-buffer)
       (setq speedbar-buffer nil)
       (when (and current-window (window-live-p current-window))
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.