Remove assertion in erc-speedbar--dframe-controlled

* lisp/erc/erc-speedbar.el (erc-speedbar--ensure): Remove assertion for
robustness even though it should still pass.
(erc-speedbar--get-timers): Remove unused function.
(erc-speedbar--dframe-controlled): Fix failing assertion related to
changes from bug#81561, namely the negating of the condition in
`dframe-set-timer' that checks whether `dframe-client-functions' is
nonempty.
* test/lisp/erc/erc-scenarios-status-sidebar.el
(erc-scenarios-status-sidebar--nickbar): Inline body of deleted function
`erc-speedbar--get-timers'.
This commit is contained in:
F. Jason Park 2026-08-11 21:12:54 -07:00
parent 2dca4a8854
commit 769bd89281
2 changed files with 8 additions and 9 deletions

View file

@ -540,7 +540,8 @@ associated with an ERC session."
(with-selected-frame speedbar-frame
(erc-speedbar--emulate-sidebar-set-window-preserve-size)
(erc-speedbar-toggle-nicknames-window-lock -1))
(cl-assert (null (cdr (erc-speedbar--get-timers))))
;; The following assumes any idle timers for `dframe-timer-fn'
;; from previous module sessions have been canceled.
(with-current-buffer speedbar-buffer
(setq speedbar-update-flag t)
(speedbar-set-mode-line-format)))))
@ -620,11 +621,6 @@ For controlling whether the speedbar window is selectable with
(unless (eq erc--module-toggle-prefix-arg most-negative-fixnum)
(dframe-close-frame))))))
(defun erc-speedbar--get-timers ()
(cl-remove #'dframe-timer-fn timer-idle-list
:key #'timer--function
:test-not #'eq))
(defun erc-speedbar--dframe-controlled (arg)
(when speedbar-buffer
(cl-assert (eq speedbar-buffer (current-buffer))))
@ -635,7 +631,7 @@ For controlling whether the speedbar window is selectable with
erc-speedbar--hidden-speedbar-frame nil)
(speedbar-frame-mode arg) ; -1
;; As of Emacs 29, `dframe-set-timer' can't remove `dframe-timer'.
(cl-assert (= 1 (length (erc-speedbar--get-timers))) t)
;; However, this may have been addressed in Emacs 31 by bug#81561.
(cancel-function-timers #'dframe-timer-fn)
;; `dframe-close-frame' kills the buffer but no function in
;; erc-speedbar.el resets this to nil.

View file

@ -93,7 +93,7 @@
;; terminal, and we lack a fixture for that. Please try running this
;; test interactively with both graphical Emacs and non.
(declare-function erc-nickbar-mode "erc-speedbar" (arg))
(declare-function erc-speedbar--get-timers "erc-speedbar" nil)
(declare-function dframe-timer-fn "dframe" ())
(declare-function speedbar-timer-fn "speedbar" nil)
(defvar erc-nickbar-mode)
(defvar speedbar-buffer)
@ -171,6 +171,9 @@
(should-not erc-nickbar-mode)
(should-not (cdr (frame-list)))))
(should-not (erc-speedbar--get-timers))))
;; No stray dframe timers.
(should-not (any (lambda (timer)
(eq #'dframe-timer-fn (timer--function timer)))
timer-idle-list))))
;;; erc-scenarios-status-sidebar.el ends here