emacs-31 769bd892810: Remove assertion in erc-speedbar--dframe-controlled

"F. Jason Park" <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 769bd89281062bcf19fcb7985051b06fb0c0849b
Author: F. Jason Park <[email protected]>
Commit: F. Jason Park <[email protected]>

    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'.
---
 lisp/erc/erc-speedbar.el                      | 10 +++-------
 test/lisp/erc/erc-scenarios-status-sidebar.el |  7 +++++--
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index 7ce52db25b7..20ae8d4402c 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -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.
diff --git a/test/lisp/erc/erc-scenarios-status-sidebar.el b/test/lisp/erc/erc-scenarios-status-sidebar.el
index ede387ac451..44ef3a8e029 100644
--- a/test/lisp/erc/erc-scenarios-status-sidebar.el
+++ b/test/lisp/erc/erc-scenarios-status-sidebar.el
@@ -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
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.