[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d7c18a7b4f2 5/7: Ignore the TGT-LIST parameter in erc-open
From: |
F. Jason Park |
Subject: |
master d7c18a7b4f2 5/7: Ignore the TGT-LIST parameter in erc-open |
Date: |
Fri, 16 Feb 2024 23:04:41 -0500 (EST) |
branch: master
commit d7c18a7b4f218de8c4d2178c9124ea26c7dc5b6b
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Ignore the TGT-LIST parameter in erc-open
* etc/ERC-NEWS: Mention `erc-open' now ignores TGT-LIST.
* lisp/erc/erc.el (erc-open): Set `erc-default-recipients' to a list
containing only the supplied target. Other values may cause ERC to
malfunction. Also redo doc string.
---
etc/ERC-NEWS | 10 ++++++++++
lisp/erc/erc.el | 39 ++++++++++++++++-----------------------
2 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index 1e88500d169..b2aceaa9f39 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -502,6 +502,16 @@ encouraged to keep a module's name aligned with its
group's as well as
the provided feature of its containing library, if only for the usual
reasons of namespace hygiene and discoverability.
+*** The function 'erc-open' no longer uses the 'TGT-LIST' parameter.
+ERC has always used the parameter to initialize the local variable
+'erc-default-recipients', which stores a list of routing targets with
+the topmost considered "active." However, since at least ERC 5.1, a
+buffer and its active target effectively mate for life, making
+'TGT-LIST', in practice, a read-only list of a single target. And
+because that target must also appear as the 'CHANNEL' parameter,
+'TGT-LIST' mainly serves to reinforce 'erc-open's reputation of being
+unruly.
+
*** ERC supports arbitrary CHANTYPES.
Specifically, channels can be prefixed with any predesignated
character, mainly to afford more flexibility to specialty services,
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index db5a9baf5c3..94e98bd7660 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2486,29 +2486,22 @@ nil."
(cl-assert (= (point) (point-max)))))
(defun erc-open (&optional server port nick full-name
- connect passwd tgt-list channel process
+ connect passwd _tgt-list channel process
client-certificate user id)
- "Connect to SERVER on PORT as NICK with USER and FULL-NAME.
-
-If CONNECT is non-nil, connect to the server. Otherwise assume
-already connected and just create a separate buffer for the new
-target given by CHANNEL, meaning these parameters are mutually
-exclusive. Note that CHANNEL may also be a query; its name has
-been retained for historical reasons.
-
-Use PASSWD as user password on the server. If TGT-LIST is
-non-nil, use it to initialize `erc-default-recipients'.
-
-CLIENT-CERTIFICATE, if non-nil, should either be a list where the
-first element is the file name of the private key corresponding
-to a client certificate and the second element is the file name
-of the client certificate itself to use when connecting over TLS,
-or t, which means that `auth-source' will be queried for the
-private key and the certificate.
-
-When non-nil, ID should be a symbol for identifying the connection.
-
-Returns the buffer for the given server or channel."
+ "Return a new or reinitialized server or target buffer.
+If CONNECT is non-nil, connect to SERVER and return its new or
+reassociated buffer. Otherwise, assume PROCESS is non-nil and belongs
+to an active session, and return a new or refurbished target buffer for
+CHANNEL, which may also be a query target (the parameter name remains
+for historical reasons). Pass SERVER, PORT, NICK, USER, FULL-NAME, and
+PASSWD to `erc-determine-parameters' for preserving as session-local
+variables. Do something similar for CLIENT-CERTIFICATE and ID, which
+should be as described by `erc-tls'.
+
+Note that ERC ignores TGT-LIST and initializes `erc-default-recipients'
+with CHANNEL as its only member. Note also that this function has the
+side effect of setting the current buffer to the one it returns. Use
+`with-current-buffer' or `save-excursion' to nullify this effect."
(let* ((target (and channel (erc--target-from-string channel)))
(buffer (erc-get-buffer-create server port nil target id))
(old-buffer (current-buffer))
@@ -2545,7 +2538,7 @@ Returns the buffer for the given server or channel."
;; connection parameters
(setq erc-server-process process)
;; stack of default recipients
- (setq erc-default-recipients tgt-list)
+ (when channel (setq erc-default-recipients (list channel)))
(when target
(setq erc--target target
erc-network (erc-network)))
- master updated (537914561eb -> 3d87e343276), F. Jason Park, 2024/02/16
- master d7c18a7b4f2 5/7: Ignore the TGT-LIST parameter in erc-open,
F. Jason Park <=
- master 1a36d52413c 3/7: Autoload custom-loads for new Custom groups in erc.el, F. Jason Park, 2024/02/16
- master 25d15391f26 6/7: Normalize ISUPPORT params with empty values in ERC, F. Jason Park, 2024/02/16
- master 9668b4f97c2 4/7: Make erc-fill-wrap depend on scrolltobottom, F. Jason Park, 2024/02/16
- master 3d87e343276 7/7: Use modern fallback for channel name detection in ERC, F. Jason Park, 2024/02/16
- master a43b062ee57 2/7: ; Load erc-compat before ert-x in ERC tests, F. Jason Park, 2024/02/16
- master e288e1b2f35 1/7: Remove "erc-" prefixed Compat definitions, F. Jason Park, 2024/02/16