[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 132d5cb0a3 5/5: Bury new ERC buffers by default
From: |
F. Jason Park |
Subject: |
master 132d5cb0a3 5/5: Bury new ERC buffers by default |
Date: |
Mon, 19 Sep 2022 21:14:30 -0400 (EDT) |
branch: master
commit 132d5cb0a3ec94afbb49772631861e00160ffffb
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Bury new ERC buffers by default
* lisp/erc/erc.el (erc-join-buffer): Change default value to `bury'.
(erc-setup-buffer): Make `window-noselect' behave more like its
description and abstain from ever replacing the current buffer.
* test/lisp/erc/erc-scenarios-base-reconnect.el
(erc-scenarios-common-base-reconnect-options): Update helper to handle
new default value for option `erc-join-buffer'.
(erc-scenarios-base-reconnect-options--buffer): Update and rename
function `erc-scenarios-base-reconnect-options--default'.
(erc-scenarios-base-reconnect-options--default): Update and rename
function `erc-scenarios-base-reconnect-options--bury'.
* etc/ERC-NEWS: Update existing display-buffers section for 5.5.
(Bug#51753)
---
etc/ERC-NEWS | 14 +++++++--
lisp/erc/erc.el | 5 +--
test/lisp/erc/erc-scenarios-base-reconnect.el | 45 ++++++++++++++-------------
3 files changed, 37 insertions(+), 27 deletions(-)
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index 075a677a9d..988eb1e09c 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -59,9 +59,17 @@ which, when present, becomes the first argument passed to
the "USER"
IRC command. The traditional way of setting this globally, via
'erc-email-userid', is still honored.
-** Additional display options for updated buffers.
-Additional flexibility is now available for controlling the behavior
-of newly created target buffers, especially during reconnection.
+** Changes to display options for new ERC buffers.
+The default value for the option 'erc-join-buffer', which determines
+how new buffers are displayed, has been changed to 'bury' for security
+reasons. Although the old value of 'buffer' is still accessible,
+along with its original behavior, users wanting a safer alternative
+can now opt for an improved 'window-noselect' instead. It still
+offers the same pronounced visual cue when connecting and joining but
+now avoids any hijacking of the active window as well.
+
+Beyond this, additional flexibility is now available for controlling
+the behavior of newly created target buffers during reconnection.
** Improved handling of multiline prompt input.
This means better detection and handling of intervening and trailing
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 2715121d3e..20f22c896f 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1651,7 +1651,7 @@ Defaults to the server buffer."
"IRC port to use for encrypted connections if it cannot be \
detected otherwise.")
-(defcustom erc-join-buffer 'buffer
+(defcustom erc-join-buffer 'bury
"Determines how to display a newly created IRC buffer.
The available choices are:
@@ -1662,6 +1662,7 @@ The available choices are:
`bury' - bury it in a new buffer,
`buffer' - in place of the current buffer,
any other value - in place of the current buffer."
+ :package-version '(ERC . "5.4.1") ; FIXME increment upon publishing to ELPA
:group 'erc-buffers
:type '(choice (const :tag "Split window and select" window)
(const :tag "Split window, don't select" window-noselect)
@@ -2148,7 +2149,7 @@ removed from the list will be disabled."
(display-buffer buffer)
(switch-to-buffer-other-window buffer)))
('window-noselect
- (display-buffer buffer))
+ (display-buffer buffer '(nil (inhibit-same-window . t))))
('bury
nil)
('frame
diff --git a/test/lisp/erc/erc-scenarios-base-reconnect.el
b/test/lisp/erc/erc-scenarios-base-reconnect.el
index 30d692058d..49298dc594 100644
--- a/test/lisp/erc/erc-scenarios-base-reconnect.el
+++ b/test/lisp/erc/erc-scenarios-base-reconnect.el
@@ -99,10 +99,11 @@
(funcall test)
+ ;; A manual /JOIN command tells ERC we're done auto-reconnecting
(with-current-buffer "FooNet" (erc-cmd-JOIN "#spam"))
- (erc-d-t-wait-for 5 "Channel #spam shown when autojoined"
- (eq (window-buffer) (get-buffer "#spam")))
+ (erc-d-t-ensure-for 1 "Newly joined chan ignores `erc-reconnect-display'"
+ (not (eq (window-buffer) (get-buffer "#spam"))))
(ert-info ("Wait for auto reconnect")
(with-current-buffer erc-server-buffer
@@ -114,43 +115,43 @@
(with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#spam"))
(funcall expect 10 "her elves come here anon")))))
-(ert-deftest erc-scenarios-base-reconnect-options--default ()
+(ert-deftest erc-scenarios-base-reconnect-options--buffer ()
:tags '(:expensive-test)
- (should (eq erc-join-buffer 'buffer))
+ (should (eq erc-join-buffer 'bury))
(should-not erc-reconnect-display)
;; FooNet (the server buffer) is not switched to because it's
;; already current (but not shown) when `erc-open' is called. See
;; related conditional guard towards the end of that function.
- (erc-scenarios-common--base-reconnect-options
- (lambda ()
- (pop-to-buffer-same-window "*Messages*")
+ (let ((erc-reconnect-display 'buffer))
+ (erc-scenarios-common--base-reconnect-options
+ (lambda ()
+ (pop-to-buffer-same-window "*Messages*")
- (erc-d-t-ensure-for 1 "Server buffer not shown"
- (not (eq (window-buffer) (get-buffer "FooNet"))))
+ (erc-d-t-ensure-for 1 "Server buffer not shown"
+ (not (eq (window-buffer) (get-buffer "FooNet"))))
- (erc-d-t-wait-for 5 "Channel #chan shown when autojoined"
- (eq (window-buffer) (get-buffer "#chan"))))))
+ (erc-d-t-wait-for 5 "Channel #chan shown when autojoined"
+ (eq (window-buffer) (get-buffer "#chan")))))))
-(ert-deftest erc-scenarios-base-reconnect-options--bury ()
+(ert-deftest erc-scenarios-base-reconnect-options--default ()
:tags '(:expensive-test)
- (should (eq erc-join-buffer 'buffer))
+ (should (eq erc-join-buffer 'bury))
(should-not erc-reconnect-display)
- (let ((erc-reconnect-display 'bury))
- (erc-scenarios-common--base-reconnect-options
+ (erc-scenarios-common--base-reconnect-options
- (lambda ()
- (pop-to-buffer-same-window "*Messages*")
+ (lambda ()
+ (pop-to-buffer-same-window "*Messages*")
- (erc-d-t-ensure-for 1 "Server buffer not shown"
- (not (eq (window-buffer) (get-buffer "FooNet"))))
+ (erc-d-t-ensure-for 1 "Server buffer not shown"
+ (not (eq (window-buffer) (get-buffer "FooNet"))))
- (erc-d-t-ensure-for 3 "Channel #chan not shown"
- (not (eq (window-buffer) (get-buffer "#chan"))))
+ (erc-d-t-ensure-for 3 "Channel #chan not shown"
+ (not (eq (window-buffer) (get-buffer "#chan"))))
- (eq (window-buffer) (messages-buffer))))))
+ (eq (window-buffer) (messages-buffer)))))
;; Upon reconnecting, playback for channel and target buffers is
;; routed correctly. Autojoin is irrelevant here, but for the