[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8dd209eea47 19/37: Ignore killed buffers when switching in erc-tr
From: |
F. Jason Park |
Subject: |
master 8dd209eea47 19/37: Ignore killed buffers when switching in erc-track |
Date: |
Sat, 8 Apr 2023 17:31:30 -0400 (EDT) |
branch: master
commit 8dd209eea47f3b8e1fce6dc12c13d33da1154d89
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Ignore killed buffers when switching in erc-track
* lisp/erc/erc-track.el (erc-track--switch-buffer): If the chosen
buffer has been killed, remove it from `erc-modified-channels-alist'
and try again.
* test/lisp/erc/erc-scenarios-misc.el
(erc-scenarios-base-kill-server-track): New test. (Bug#60560.)
---
lisp/erc/erc-track.el | 6 +++++-
test/lisp/erc/erc-scenarios-misc.el | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 7fd7b53602e..e060b7039bd 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -921,7 +921,11 @@ is relative to `erc-track-switch-direction'."
(unless (eq major-mode 'erc-mode)
(setq erc-track-last-non-erc-buffer (current-buffer)))
;; and jump to the next active channel
- (funcall fun (erc-track-get-active-buffer arg)))
+ (if-let ((buf (erc-track-get-active-buffer arg))
+ ((buffer-live-p buf)))
+ (funcall fun buf)
+ (erc-modified-channels-update)
+ (erc-track--switch-buffer fun arg)))
;; if no active channels, switch back to what we were doing before
((and erc-track-last-non-erc-buffer
erc-track-switch-from-erc
diff --git a/test/lisp/erc/erc-scenarios-misc.el
b/test/lisp/erc/erc-scenarios-misc.el
index 5927eee48fd..bb925eed836 100644
--- a/test/lisp/erc/erc-scenarios-misc.el
+++ b/test/lisp/erc/erc-scenarios-misc.el
@@ -205,4 +205,38 @@
(with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
(funcall expect 10 "welcome")))))
+;; Ensure that ERC does not attempt to switch to a killed server
+;; buffer via `erc-track-switch-buffer'.
+
+(declare-function erc-track-switch-buffer "erc-track" (arg))
+(defvar erc-track-mode)
+
+(ert-deftest erc-scenarios-base-kill-server-track ()
+ :tags '(:expensive-test)
+ (erc-scenarios-common-with-cleanup
+ ((erc-scenarios-common-dialog "networks/merge-server")
+ (dumb-server (erc-d-run "localhost" t 'track))
+ (port (process-contact dumb-server :service))
+ (erc-server-flood-penalty 0.1)
+ (expect (erc-d-t-make-expecter)))
+
+ (ert-info ("Connect")
+ (with-current-buffer (erc :server "127.0.0.1"
+ :port port
+ :nick "tester")
+ (should (string= (buffer-name) (format "127.0.0.1:%d" port)))
+ (should erc-track-mode)
+ (funcall expect 5 "changed mode for tester")
+ (erc-cmd-JOIN "#chan")))
+
+ (ert-info ("Join channel and kill server buffer")
+ (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan"))
+ (funcall expect 5 "The hour that fools should ask"))
+ (with-current-buffer "FooNet"
+ (set-process-query-on-exit-flag erc-server-process nil)
+ (kill-buffer))
+ (should-not (eq (current-buffer) (get-buffer "#chan"))) ; *temp*
+ (ert-simulate-command '(erc-track-switch-buffer 1)) ; No longer signals
+ (should (eq (current-buffer) (get-buffer "#chan"))))))
+
;;; erc-scenarios-misc.el ends here
- master updated (685435cb52e -> 52c8d5371e4), F. Jason Park, 2023/04/08
- master 4da7d24988a 06/37: Add MOTD command to ERC, F. Jason Park, 2023/04/08
- master cf83f9a0821 04/37: Fix DCC GET flag parsing in erc-dcc, F. Jason Park, 2023/04/08
- master 52c8d5371e4 37/37: * etc/ERC-NEWS: Add section for ERC 5.6., F. Jason Park, 2023/04/08
- master 9c65ac73655 17/37: Warn when customizing minor-mode vars for ERC modules, F. Jason Park, 2023/04/08
- master 4b56739547c 32/37: Add erc-fill style based on visual-line-mode, F. Jason Park, 2023/04/08
- master 05f6fdb9e78 24/37: Preserve ERC prompt and its bounding markers, F. Jason Park, 2023/04/08
- master 8c0c9826844 08/37: Add hook to regain nickname in ERC, F. Jason Park, 2023/04/08
- master 8dd209eea47 19/37: Ignore killed buffers when switching in erc-track,
F. Jason Park <=
- master e7992d2adbc 23/37: Add option to show visual erc-keep-place indicator, F. Jason Park, 2023/04/08
- master 0f7fc5cfdf9 20/37: Be smarter about switching to TLS from M-x erc, F. Jason Park, 2023/04/08
- master ad3dc74e074 27/37: Expose insertion time as text prop in erc-stamp, F. Jason Park, 2023/04/08
- master ba7fe88b782 22/37: Optionally prompt for more ERC entry-point params, F. Jason Park, 2023/04/08
- master 39d4f32fc9b 18/37: Fill doc strings for ERC modules, F. Jason Park, 2023/04/08
- master 22104de5daa 14/37: Add missing colors to erc-irccontrols-mode, F. Jason Park, 2023/04/08
- master 0d3ccdbde44 16/37: Don't associate ERC modules with undefined groups, F. Jason Park, 2023/04/08
- master 3a012d1db24 21/37: Add display option for interactive ERC invocations, F. Jason Park, 2023/04/08
- master dfaeeba97cc 01/37: Change ERC version to 5.6-git, F. Jason Park, 2023/04/08
- master 03eddc99242 07/37: Add probing erc-server-reconnect-function variant, F. Jason Park, 2023/04/08