From 63cdbd986bb8f841717e2d813df6f75b6b02cf8b Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sun, 11 Dec 2022 19:16:07 -0800 Subject: ; Really respect browse-url var in erc-compat * lisp/erc/erc-compat.el: Do what was supposed to be done by 75f26646d4a569cfb485de4baddcda66ff44b2c3 "; Be nicer when updating browse-url var in erc-compat". This is the less harmful version of that patch (from bug#59976#8) but without the cl-lib requirement since users may not want to load the main ERC library right away. * lisp/erc/erc.el: Clarify some comments regarding the core API. --- lisp/erc/erc.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lisp/erc/erc.el') diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 6cfc39c4bda..6a5e0018964 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1765,8 +1765,7 @@ all channel buffers on all servers." ;; to, it was never realized. ;; ;; New library code should use the `erc--target' struct instead. -;; Third-party code can continue to use this until a getter for -;; `erc--target' (or whatever replaces it) is exported. +;; Third-party code can continue to use this and `erc-default-target'. (defvar-local erc-default-recipients nil "List of default recipients of the current buffer.") @@ -6012,13 +6011,14 @@ See also `erc-downcase'." ;; While `erc-default-target' happens to return nil in channel buffers ;; you've parted or from which you've been kicked, using it to detect ;; whether a channel is currently joined may become unreliable in the -;; future. For now, new code should consider using +;; future. For now, third-party code can use ;; ;; (erc-get-channel-user (erc-current-nick)) ;; -;; and expect a nicer option eventually. For retrieving a target -;; regardless of subscription or connection status, use replacements -;; based on `erc--target' instead. See also `erc--default-target'. +;; A predicate may be provided eventually. For retrieving a target's +;; name regardless of subscription or connection status, new library +;; code should use `erc--default-target'. Third-party code should +;; continue to use `erc-default-target'. (defun erc-default-target () "Return the current default target (as a character string) or nil if none." -- cgit v1.2.1 From 2ddc480f4417775d6bf8ebcfc27b8cd7fa761a7d Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Sun, 25 Dec 2022 21:36:53 -0800 Subject: Warn of absent networks module in ERC * doc/misc/erc.texi: Add linkable note in Modules chapter about some modules being required. Also tweak markup in auth-source section. * etc/ERC-NEWS: Mention the special role of `networks'. * lisp/erc/erc-backend.el (erc--server-post-connect-hook): Add internal hook for core modules to perform post-network-process, pre-protocol config validation even when they haven't been loaded. (erc--register-connection): Run `erc--server-post-connect-hook'. * lisp/erc/erc-networks.el (erc-networks--bouncer-targets, erc-networks-on-MOTD-end): Fix comments and doc strings. Also change former from constant to internal variable in case adjustment needed between releases. (erc-networks--warn-on-connect): New function to warn about the `networks' module being absent from `erc-modules'. This could probably run at any time up to and including when the logical IRC connection is established, but doing so at the process/protocol boundary seems ideal. * lisp/erc/erc-sasl.el (erc--register-connection): Defer to base method instead of calling `erc-login' explicitly. * lisp/erc/erc.el (erc-generate-new-buffer-name): Don't reconcile buffer names when networks module not in play. (erc-format-target-and/or-network): Don't assume networks module loaded. * test/lisp/erc/erc-scenarios-base-unstable.el: (erc-scenarios-networks-no-module): New test. * test/lisp/erc/resources/networks/no-module/basic.eld: New test data file. (Bug#60331.) --- lisp/erc/erc.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lisp/erc/erc.el') diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 6a5e0018964..16a0aba77b1 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1607,7 +1607,8 @@ same manner." (when target ; compat (setq tgt-info (erc--target-from-string target))) (if tgt-info - (let* ((esid (erc-networks--id-symbol erc-networks--id)) + (let* ((esid (and erc-networks--id + (erc-networks--id-symbol erc-networks--id))) (name (if esid (erc-networks--reconcile-buffer-names tgt-info erc-networks--id) @@ -6760,7 +6761,8 @@ This should be a string with substitution variables recognized by If the name of the network is not available, then use the shortened server name instead." (if-let ((erc--target) - (name (if-let ((esid (erc-networks--id-symbol erc-networks--id))) + (name (if-let ((erc-networks--id) + (esid (erc-networks--id-symbol erc-networks--id))) (symbol-name esid) (erc-shorten-server-name (or erc-server-announced-name erc-session-server))))) -- cgit v1.2.1