emacs/lisp/erc/erc-networks.el

1625 lines
77 KiB
EmacsLisp
Raw Normal View History

lisp/erc: Use lexical-binding Also remove various redundant `:group` arguments. * lisp/erc/erc-backend.el (define-erc-response-handler): Move `declare` after the docstring. * lisp/erc/erc-capab.el: Use lexical-binding. (erc-capab-identify-activate): Simplify with `member`. * lisp/erc/erc-dcc.el (erc-dcc): Move before erc-dcc-mode definition, which refers to it. (erc-dcc-chat-accept): Remove unused vars `nick` and `buffer`. * lisp/erc/erc-imenu.el: Use lexical-binding. (erc-create-imenu-index): Remove unused var `prev-pos`. * lisp/erc/erc-match.el: Use lexical-binding. (erc-match-message): Remove unused var `old-pt`. (erc-match-message): Strength-reduce `eval` to `symbol-value`. * lisp/erc/erc-page.el: Use lexical-binding. (erc-page): Move Custom group before `erg-page-mode` which refers to it. * lisp/erc/erc-replace.el: Use lexical-binding. (erc-replace-insert): Use `functionp`. * lisp/erc/erc-status-sidebar.el: Use lexical-binding. (erc-status-sidebar-open): Remove unused var `sidebar-window`. * lisp/erc/erc.el: Fix header to use the customary 3 semi-colons. (erc-fill-column): Declare variable. * lisp/erc/erc-autoaway.el: Use lexical-binding. * lisp/erc/erc-ezbounce.el: Use lexical-binding. * lisp/erc/erc-fill.el: Use lexical-binding. * lisp/erc/erc-goodies.el: Use lexical-binding. * lisp/erc/erc-ibuffer.el: Use lexical-binding. * lisp/erc/erc-identd.el: Use lexical-binding. * lisp/erc/erc-join.el: Use lexical-binding. * lisp/erc/erc-lang.el: Use lexical-binding. * lisp/erc/erc-log.el: Use lexical-binding. * lisp/erc/erc-menu.el: Use lexical-binding. * lisp/erc/erc-netsplit.el: Use lexical-binding. * lisp/erc/erc-networks.el: Use lexical-binding. * lisp/erc/erc-pcomplete.el: Use lexical-binding. * lisp/erc/erc-ring.el: Use lexical-binding. * lisp/erc/erc-speedbar.el: Use lexical-binding. * lisp/erc/erc-spelling.el: Use lexical-binding. * lisp/erc/erc-truncate.el: Use lexical-binding. * lisp/erc/erc-xdcc.el: Use lexical-binding.
2021-03-18 23:14:33 -04:00
;;; erc-networks.el --- IRC networks -*- lexical-binding: t; -*-
2023-01-01 05:31:12 -05:00
;; Copyright (C) 2002, 2004-2023 Free Software Foundation, Inc.
;; Author: Mario Lang <mlang@lexx.delysid.org>
;; Maintainer: Amin Bandali <bandali@gnu.org>, F. Jason Park <jp@neverwas.me>
;; Keywords: comm
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This file deals with IRC networks.
;;
;; Usage:
;;
;; This is the "networks" module.
;;
;; You can use (eq (erc-network) 'Network) if you'd like to set variables or do
;; certain actions according to which network you're connected to.
;; If a network you use is not listed in `erc-networks-alist', you can put
;; (add-to-list 'erc-networks-alist '(Network "irc.server-name.net")) in your
;; config file.
;;; Code:
(eval-when-compile (require 'cl-lib))
Move ERC's core dependencies to separate file Asking people to order require's is about as effective as asking kids to keep off the grass. * lisp/erc/erc-backend.el (erc--target, erc-auto-query, erc-channel-list, erc-channel-users, erc-default-nicks, erc-default-recipients, erc-format-nick-function, erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker, erc-insert-marker, erc-invitation, erc-join-buffer, erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p, erc-minibuffer-ignored, erc-networks--id, erc-nick, erc-nick-change-attempt-count, erc-prompt-for-channel-key, erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping, erc-whowas-on-nosuchnick): Forward-declare variables. (erc--open-target, erc--target-from-string, erc-active-buffer, erc-add-default-channel, erc-banlist-update, erc-buffer-filter, erc-buffer-list-with-nick, erc-channel-begin-receiving-names, erc-channel-end-receiving-names, erc-channel-p, erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established, erc-current-nick, erc-current-nick-p, erc-current-time, erc-default-target, erc-delete-default-channel, erc-display-error-notice, erc-display-server-message, erc-emacs-time-to-erc-time, erc-format-message, erc-format-privmessage, erc-get-buffer, erc-handle-login, erc-handle-user-status-change, erc-ignored-reply-p, erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p, erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login, erc-make-notice, erc-network, erc-networks--id-given, erc-networks--id-reload, erc-nickname-in-use, erc-parse-user, erc-process-away, erc-process-ctcp-query, erc-query-buffer-p, erc-remove-channel-member, erc-remove-channel-users, erc-remove-user, erc-sec-to-time, erc-server-buffer, erc-set-active-buffer, erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string, erc-update-mode-line, erc-update-mode-line-buffer, erc-wash-quit-reason, erc-display-message, erc-get-buffer-create, erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes, erc-update-user-nick, erc-open, erc-update-channel-member): Forward-declare functions. (erc-response): Move to lisp/erc/erc-common.el. (erc-compat--with-memoization): Use "erc-compat-" prefixed macro. * lisp/erc/erc-common.el: New file. Change indentation for `erc-with-all-buffers-of-server' from 1 to 2. * lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro from `erc-backend' and rename. * lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'. (erc-controls-highlight-regexp, erc-controls-remove-regexp, erc-input-marker, erc-insert-marker, erc-server-process, erc-modules, erc-log-p): Forward declare variables. (erc-buffer-list, erc-error, erc-extract-command-from-line): Forward-declare functions. * lisp/erc/erc-networks.el (erc--target, erc-insert-marker, erc-kill-buffer-hook, erc-kill-server-hook, erc-modules, erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name, erc-server-connected, erc-server-parameters, erc-server-process, erc-session-server): Forward declare variables. (erc--default-target, erc--get-isupport-entry, erc-buffer-filter, erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer, erc-server-buffer, erc-server-process-alive): Forward-declare functions. (erc-obsolete-var): Also suppress free-variable warnings. * lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and `erc-backend' at top of file. Don't require `erc-compat'. (erc--server-last-reconnect-count, erc--server-reconnecting, erc-channel-members-changed-hook, erc-network, erc-networks--id, erc-server-367-functions, erc-server-announced-name, erc-server-connect-function, erc-server-connected, erc-server-current-nick, erc-server-lag, erc-server-last-sent-time, erc-server-process, erc-server-quitting, erc-server-reconnect-count, erc-server-reconnecting, erc-session-client-certificate, erc-session-connector, erc-session-port, erc-session-server, erc-session-user-full-name) Remove superfluous forward declarations. (erc-message-parsed, tabbar--local-hlf, motif-version-string): Relocate forward declares to central location. (erc-session-password): Move to `erc-backend'. (erc-downcase, erc-with-server-buffer, erc-server-user, erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to lisp/erc/erc-common.el. (erc-add-server-user, erc-remove-server-user, erc-channel-user-owner-p, erc-channel-user-admin-p, erc-channel-user-op-p, erc-channel-user-halfop-p, erc-channel-user-voice-p): Convert from inline functions to normal functions. (define-erc-module, erc--target, erc--target-channel, erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer, erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el. (erc-channel-members-changed-hook): Relocate option to avoid compiler warning. (erc-input, erc--input-split): Move to lisp/erc/erc-common.el. (erc-controls-strip): Remove forward declaration temporarily until this file stops requiring `erc-goodies'. * test/lisp/erc/erc-networks-tests.el: Require `erc' instead of `erc-networks'. * test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
(require 'erc-common)
(defvar erc--target)
(defvar erc-insert-marker)
(defvar erc-kill-buffer-hook)
(defvar erc-kill-server-hook)
(defvar erc-modules)
(defvar erc-rename-buffers)
(defvar erc-reuse-buffers)
(defvar erc-server-announced-name)
(defvar erc-server-connected)
(defvar erc-server-parameters)
(defvar erc-server-process)
(defvar erc-session-server)
(declare-function erc--default-target "erc" nil)
(declare-function erc--get-isupport-entry "erc-backend" (key &optional single))
(declare-function erc-buffer-filter "erc" (predicate &optional proc))
(declare-function erc-current-nick "erc" nil)
(declare-function erc-display-error-notice "erc" (parsed string))
(declare-function erc-display-message "erc" (parsed type buffer msg &rest args))
Move ERC's core dependencies to separate file Asking people to order require's is about as effective as asking kids to keep off the grass. * lisp/erc/erc-backend.el (erc--target, erc-auto-query, erc-channel-list, erc-channel-users, erc-default-nicks, erc-default-recipients, erc-format-nick-function, erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker, erc-insert-marker, erc-invitation, erc-join-buffer, erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p, erc-minibuffer-ignored, erc-networks--id, erc-nick, erc-nick-change-attempt-count, erc-prompt-for-channel-key, erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping, erc-whowas-on-nosuchnick): Forward-declare variables. (erc--open-target, erc--target-from-string, erc-active-buffer, erc-add-default-channel, erc-banlist-update, erc-buffer-filter, erc-buffer-list-with-nick, erc-channel-begin-receiving-names, erc-channel-end-receiving-names, erc-channel-p, erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established, erc-current-nick, erc-current-nick-p, erc-current-time, erc-default-target, erc-delete-default-channel, erc-display-error-notice, erc-display-server-message, erc-emacs-time-to-erc-time, erc-format-message, erc-format-privmessage, erc-get-buffer, erc-handle-login, erc-handle-user-status-change, erc-ignored-reply-p, erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p, erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login, erc-make-notice, erc-network, erc-networks--id-given, erc-networks--id-reload, erc-nickname-in-use, erc-parse-user, erc-process-away, erc-process-ctcp-query, erc-query-buffer-p, erc-remove-channel-member, erc-remove-channel-users, erc-remove-user, erc-sec-to-time, erc-server-buffer, erc-set-active-buffer, erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string, erc-update-mode-line, erc-update-mode-line-buffer, erc-wash-quit-reason, erc-display-message, erc-get-buffer-create, erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes, erc-update-user-nick, erc-open, erc-update-channel-member): Forward-declare functions. (erc-response): Move to lisp/erc/erc-common.el. (erc-compat--with-memoization): Use "erc-compat-" prefixed macro. * lisp/erc/erc-common.el: New file. Change indentation for `erc-with-all-buffers-of-server' from 1 to 2. * lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro from `erc-backend' and rename. * lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'. (erc-controls-highlight-regexp, erc-controls-remove-regexp, erc-input-marker, erc-insert-marker, erc-server-process, erc-modules, erc-log-p): Forward declare variables. (erc-buffer-list, erc-error, erc-extract-command-from-line): Forward-declare functions. * lisp/erc/erc-networks.el (erc--target, erc-insert-marker, erc-kill-buffer-hook, erc-kill-server-hook, erc-modules, erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name, erc-server-connected, erc-server-parameters, erc-server-process, erc-session-server): Forward declare variables. (erc--default-target, erc--get-isupport-entry, erc-buffer-filter, erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer, erc-server-buffer, erc-server-process-alive): Forward-declare functions. (erc-obsolete-var): Also suppress free-variable warnings. * lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and `erc-backend' at top of file. Don't require `erc-compat'. (erc--server-last-reconnect-count, erc--server-reconnecting, erc-channel-members-changed-hook, erc-network, erc-networks--id, erc-server-367-functions, erc-server-announced-name, erc-server-connect-function, erc-server-connected, erc-server-current-nick, erc-server-lag, erc-server-last-sent-time, erc-server-process, erc-server-quitting, erc-server-reconnect-count, erc-server-reconnecting, erc-session-client-certificate, erc-session-connector, erc-session-port, erc-session-server, erc-session-user-full-name) Remove superfluous forward declarations. (erc-message-parsed, tabbar--local-hlf, motif-version-string): Relocate forward declares to central location. (erc-session-password): Move to `erc-backend'. (erc-downcase, erc-with-server-buffer, erc-server-user, erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to lisp/erc/erc-common.el. (erc-add-server-user, erc-remove-server-user, erc-channel-user-owner-p, erc-channel-user-admin-p, erc-channel-user-op-p, erc-channel-user-halfop-p, erc-channel-user-voice-p): Convert from inline functions to normal functions. (define-erc-module, erc--target, erc--target-channel, erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer, erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el. (erc-channel-members-changed-hook): Relocate option to avoid compiler warning. (erc-input, erc--input-split): Move to lisp/erc/erc-common.el. (erc-controls-strip): Remove forward declaration temporarily until this file stops requiring `erc-goodies'. * test/lisp/erc/erc-networks-tests.el: Require `erc' instead of `erc-networks'. * test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
(declare-function erc-error "erc" (&rest args))
(declare-function erc-get-buffer "erc" (target &optional proc))
(declare-function erc-server-buffer "erc" nil)
(declare-function erc-server-process-alive "erc-backend" (&optional buffer))
(declare-function erc-set-active-buffer "erc" (buffer))
Add erc-button helper for substituting command keys * lisp/erc/erc-button.el (erc-button-mode, erc-button-enable): Warn if `erc-button-alist' contains deprecated FORM field in `nicknames' entry. (erc-button-alist): Discourage arbitrary sexp form for third item of entries and offer more useful bounds-modifying function in its place. Mention that anything other than `erc-button-buttonize-nicks' is deprecated as the FORM field in a `nicknames' entry. Bump package-version even though this doesn't introduce a visible change in the default value. (erc-button--maybe-warn-arbitrary-sexp): Add helper for validating third `erc-button-alist' field. (erc-button--check-nicknames-entry): Add helper to check for deprecated items in `erc-button-alist'. (erc-button--preserve-bounds): Add function to serve as default value for `erc-button--modify-nick-function). (erc-button--modify-nick-function): Add new variable to hold a function that filters nickname bounds when buttonizing. (erc-button--phantom-users, erc-button--add-phantom-speaker, erc-button--phantom-users-mode): Add new internal minor mode for treating unseen speakers of PRIVMSGs as known members of the server for things like coloring nicks during buffer playback. (erc-button--get-user-from-speaker-naive): Add temporary utility function to scrape nick from speaker in narrowed buffer. This will be replaced by an account-aware version in next major ERC release. (erc-button-add-nickname-buttons): Accommodate function variant for "form" field of `erc-button-alist' entries. Minor optimizations. This function will likely become the primary juncture for applying text properties that support nickname-related user-intelligence features. (erc-button-add-buttons-1): Show warning when arbitrary sexp for third "form" field encountered. Accommodate binary function instead. (erc-button--substitute-command-keys-in-region): Add helper function for applying key substitutions in ERC warning messages. (erc-button--display-error-notice-with-keys): Add new helper function for displaying ad hoc warnings that possibly require key substitution. (erc-button--display-error-notice-with-keys-and-warn): Add variant of `erc-button--display-error-notice-with-keys' that also emits warnings. * lisp/erc/erc-networks.el (erc-networks--ensure-announced, erc-networks--on-MOTD-end): Use new key-substitutions helper from erc-button. * test/lisp/erc/erc-tests.el (erc-button--display-error-notice-with-keys): New test. * test/lisp/erc/resources/base/assoc/bouncer-history/foonet.eld: Add unknown speaker in channel for phantom store to handle. Currently requires manual intervention to leverage. (Bug#60933.)
2022-12-18 19:01:40 -08:00
(declare-function erc-button--display-error-notice-with-keys
(parsed &rest strings))
;; Variables
(defgroup erc-networks nil
"IRC Networks."
:group 'erc)
(defcustom erc-server-alist
'(("4-irc: Random server" 4-irc "4-irc.com" 6667)
("A5KNet: Random server" A5KNet "irc.a5knet.com" ((6660 6669)))
("AbleNet: Random server" AbleNet "irc.ablenet.org" 6667)
("Accessirc: Random server" Accessirc "irc.accessirc.net" 6667)
("Acestar: Random server" Acestar "irc.acestar.org" 6667)
("Action-IRC: Random server" Action-IRC "irc.action-irc.net" ((6660 6669)))
("AfterNET: Random server" AfterNET "irc.afternet.org" 6667)
("Alternativenet: Random server" Alternativenet "irc.altnet.org" 6667)
("AmigaNet: Random server" AmigaNet "irc.amiganet.org" 6667)
("AngelEyez: Random server" AngelEyez "irc.angeleyez.net" ((6666 7000)))
("AnotherNet: Random server" Anothernet "irc.another.net" (6667 7000 ))
("ArabChat: Random server" ArabChat "irc.arabchat.org" ((6660 6667)))
("Ars-OpenIRC: Random server" Ars "irc.arstechnica.com" 6667)
("AsiaTalk: Random server" AsiaTalk "irc.asiatalk.org" ((6667 6669) 7000 ))
("AstroLink: Random server" AstroLink "irc.astrolink.org" ((6660 6667)))
("Asylumnet: Random server" Asylumnet "irc.asylum-net.org" ((6661 6669) 7000 7777 ))
("Austnet: Random AU server" Austnet "au.austnet.org" 6667)
("Austnet: Random NZ server" Austnet "nz.austnet.org" 6667)
("Austnet: Random SG server" Austnet "sg.austnet.org" 6667)
("Austnet: Random US server" Austnet "us.austnet.org" 6667)
("AwesomeChat: Random server" AwesomeChat "irc.awesomechat.net" ((6661 6669)))
("Awesomechristians: Random server" Awesomechristians "irc.awesomechristians.com" 7000)
("Axenet: Random server" Axenet "irc.axenet.org" ((6660 6667)))
("BeyondIRC: Random server" Beyondirc "irc.beyondirc.net" ((6660 6669)))
("BGIRC: Random server" BGIRC "irc.bulgaria.org" ((6666 6669) 7000 ))
("Blabbernet: Random server" Blabbernet "irc.blabber.net" (6667 7000 ))
("Blitzed: Random server" Blitzed "irc.blitzed.org" (6667 7000 ))
("Brasirc: Random server" Brasirc "irc.brasirc.net" ((6666 6667)))
("Brasirc: BR, PA, Belem" Brasirc "irc.libnet.com.br" ((6666 6668) 7777 8002 ))
("BRASnet: Random European server" BRASnet "eu.brasnet.org" ((6665 6669)))
("BRASnet: Random US server" BRASnet "us.brasnet.org" ((6665 6669)))
("BubbleNet: Random server" BubbleNet "irc.bubblenet.org" ((6667 6669)))
("CCnet: Random server" CCnet "irc.cchat.net" (6667 7000 ))
("CCnet: US, TX, Dallas" CCnet "irc2.cchat.net" (6667 7000 ))
("Chat-Net: Random server" Chat-Net "irc.chat-net.org" 6667)
("Chat-Solutions: Random server" Chat-Solutions "irc.chat-solutions.org" 6667)
("Chatcafe: Random server" Chatcafe "irc.chatcafe.net" 6667)
("Chatchannel: Random server" Chatchannel "irc.chatchannel.org" ((6666 6669) 7000 ))
("ChatCircuit: Random server" ChatCircuit "irc.chatcircuit.com" 6668)
("Chatlink: Random server" Chatlink "irc.chatlink.org" 6667)
("Chatnet: Random AU server" Chatnet "au.chatnet.org" 6667)
("Chatnet: Random EU server" Chatnet "eu.chatnet.org" 6667)
("Chatnet: Random US server" Chatnet "us.chatnet.org" 6667)
("ChatNut: Random server" ChatNut "irc.chatnut.net" (6667 7000 ))
("Chatpinoy: Random server" Chatpinoy "irc.chatpinoy.com" 6667)
("ChatPR: Random server" ChatPR "irc.chatpr.org" 6667)
("Chatroom: Random server" Chatroom "irc.chatroom.org" 6667)
("Chatster: Random server" Chatster "irc.chatster.org" 6667)
("ChatX: Random server" ChatX "irc.chatx.net" 6667)
("China263: Random server" China263 "irc.263.net" 6667)
("Cineplex1: Random server" Cineplex1 "irc.cineplex1.com" ((6666 6668)))
("CNN: CNN News discussions" CNN "chat.cnn.com" ((6667 6669) 7000 ))
("CobraNet: Random server" CobraNet "irc.cobra.net" 6667)
("Coolchat: Random server" Coolchat "irc.coolchat.net" 6667)
("Criten: Random server" Criten "irc.criten.net" 6667)
("Cyberchat: Random server" Cyberchat "irc.cyberchat.org" (6667 6668 ))
("CyGanet: Random server" CyGanet "irc.cyga.net" 6667)
("DALnet: AS, MY, Coins" DALnet "coins.dal.net" ((6663 6668) 7000 ))
("DALnet: CA, ON, Sodre" DALnet "sodre.on.ca.dal.net" ((6661 6669) 7000 ))
("DALnet: EU, DE, Nexgo" DALnet "nexgo.de.eu.dal.net" ((6664 6669) 7000 ))
("DALnet: EU, NO, Powertech" DALnet "powertech.no.eu.dal.net" ((6666 6667) 7000 ))
("DALnet: EU, SE, Borg" DALnet "borg.se.eu.dal.net" (6667 7000 ))
("DALnet: EU, SE, Ced" DALnet "ced.se.eu.dal.net" (6667 7000 ))
("DALnet: US, GA, Astro" DALnet "astro.ga.us.dal.net" ((6661 6669) 7000 ))
("DALnet: US, GA, Dragons" DALnet "dragons.ga.us.dal.net" ((6661 6669) 7000 ))
("DALnet: US, GA, Elysium" DALnet "elysium.ga.us.dal.net" ((6661 6669) 7000 ))
("DALnet: US, MA, Twisted" DALnet "twisted.ma.us.dal.net" ((6660 6669) 7001 7002 ))
("DALnet: US, MO, Global" DALnet "global.mo.us.dal.net" ((6661 6669) 7000 ))
("DALnet: US, NJ, Liberty" DALnet "liberty.nj.us.dal.net" ((6662 6669) 7000 ))
("DALnet: US, VA, Wombat" DALnet "wombat.va.us.dal.net" ((6661 6669) 7000 ))
("DALnet: Random EU server" DALnet "irc.eu.dal.net" 6667)
("DALnet: Random US server" DALnet "irc.dal.net" ((6660 6667)))
("Dark-Tou-Net: Random server" Dark-Tou-Net "irc.d-t-net.de" 6667)
("Darkfire: Random server" Darkfire "irc.darkfire.net" (6667 7000 8000 ))
("DarkMyst: Random server" DarkMyst "irc.darkmyst.org" 6667)
("Darkserv: Random server" Darkserv "irc.darkserv.net" 6667)
("Darksystem: Random server" Darksystem "irc.darksystem.com" 6667)
("Darktree: Random server" Darktree "irc.darktree.net" 6667)
("DayNet: Random server" DayNet "irc.daynet.org" 6667)
("Deepspace: Disability network" Deepspace "irc.deepspace.org" 6667)
("Different: Random server" Different "irc.different.net" 6667)
("Digarix: Random server" Digarix "irc.digarix.net" 6667)
("Digatech: Random server" Digatech "irc.digatech.net" 6667)
("Digital-Base: Random server" Digital-Base "irc.digital-base.net" ((6660 7000)))
("Digitalirc: Random server" Digitalirc "irc.digitalirc.net" 6667)
("Discussioni: Random server" Discussioni "irc.discussioni.org" ((6666 6669)))
("DorukNet: TR, Istanbul" DorukNet "irc.doruk.net.tr" ((6660 6669) 7000 8888 ))
("Dreamcast: Random server" Dreamcast "irc0.dreamcast.com" 6667)
("DWChat: Random server" DWChat "irc.dwchat.net" 6667)
("Dynastynet: Random server" Dynastynet "irc.dynastynet.net" 6667)
("EFnet: CA, AB, Edmonton (arcti)" EFnet "irc.arcti.ca" 6667)
("EFnet: CA, AB, Edmonton (mpls)" EFnet "irc.mpls.ca" ((6660 6669)))
("EFnet: CA, ON, Toronto" EFnet "irc2.magic.ca" 6667)
("EFnet: CA, QB, Montreal" EFnet "irc.qeast.net" 6667)
("EFnet: EU, DK, Aarhus" EFnet "irc.inet.tele.dk" 6667)
("EFnet: EU, FI, Helsinki" EFnet "efnet.cs.hut.fi" 6667)
("EFnet: EU, FR, Paris" EFnet "irc.isdnet.fr" ((6667 6669)))
("EFnet: EU, NL, Amsterdam" EFnet "efnet.vuurwerk.nl" 6667)
("EFnet: EU, NO, Homelien" EFnet "irc.homelien.no" (5190 (6666 6667) (7000 7001) ))
("EFnet: EU, NO, Oslo" EFnet "irc.daxnet.no" ((6666 7000)))
("EFnet: EU, PL, Warszawa" EFnet "irc.efnet.pl" 6667)
("EFnet: EU, RU, Moscow" EFnet "irc.rt.ru" ((6661 6669)))
("EFnet: EU, SE, Dalarna" EFnet "irc.du.se" ((6666 6669)))
2020-09-21 13:29:10 +02:00
("EFnet: EU, SE, Gothenburg" EFnet "irc.hemmet.chalmers.se" ((6666 7000)))
("EFnet: EU, SE, Sweden" EFnet "irc.light.se" 6667)
("EFnet: EU, UK, London (carrier)" EFnet "irc.carrier1.net.uk" ((6666 6669)))
("EFnet: EU, UK, London (demon)" EFnet "efnet.demon.co.uk" ((6665 6669)))
("EFnet: ME, IL, Inter" EFnet "irc.inter.net.il" ((6665 6669)))
("EFnet: US, AZ, Phoenix" EFnet "irc.easynews.com" (6660 (6665 6667) 7000 ))
("EFnet: US, CA, San Jose" EFnet "irc.concentric.net" ((6665 6668)))
("EFnet: US, CA, San Luis Obispo" EFnet "irc.prison.net" ((6666 6667)))
("EFnet: US, GA, Atlanta" EFnet "irc.mindspring.com" ((6660 6669)))
("EFnet: US, MI, Ann Arbor" EFnet "irc.umich.edu" 6667)
("EFnet: US, MN, Twin Cities" EFnet "irc.umn.edu" ((6665 6669)))
("EFnet: US, NY, Mineola" EFnet "irc.lightning.net" ((6665 7000)))
("EFnet: US, NY, New York (east)" EFnet "irc.east.gblx.net" 6667)
("EFnet: US, NY, New York (flamed)" EFnet "irc.flamed.net" ((6665 6669)))
("EFnet: US, TX, Houston" EFnet "ircd.lagged.org" ((6660 6669)))
("EFnet: US, VA, Ashburn" EFnet "irc.secsup.uu.net" ((6665 6669) 8080 ))
("EFnet: Random AU server" EFnet "au.rr.efnet.net" 6667)
("EFnet: Random CA server" EFnet "ca.rr.efnet.net" 6667)
("EFnet: Random EU server" EFnet "eu.rr.efnet.net" 6667)
("EFnet: Random US server" EFnet "us.rr.efnet.net" 6667)
("EgyptianIRC: Random server" EgyptianIRC "irc.egyptianirc.net" ((6667 6669)))
("Eircnet: Random server" Eircnet "irc.eircnet.org" ((6660 6669) 7000 ))
("Eleethal: Random server" Eleethal "irc.eleethal.com" ((6660 6669) 7000 ))
("EntertheGame: Random server" EntertheGame "irc.enterthegame.com" ((6667 6669)))
("EpiKnet: Random server" EpiKnet "irc.epiknet.org" ((6660 6669) 7000 7001 ))
("EsperNet: Random server" EsperNet "irc.esper.net" (5555 (6667 6669) ))
("Esprit: Random server" Esprit "irc.esprit.net" 6667)
("euIRC: Random server" euIRC "irc.euirc.net" ((6665 6669)))
("Evilzinc: Random server" Evilzinc "irc.evilzinc.net" ((6660 6669) 7000 8000 ))
("ExodusIRC: Random server" ExodusIRC "irc.exodusirc.net" ((6660 6669)))
("FDFnet: Random server" FDFnet "irc.fdfnet.net" ((6666 6668) 9999 ))
("FEFnet: Random server" FEFnet "irc.fef.net" 6667)
("Financialchat: Random server" Financialchat "irc.financialchat.com" ((6667 6669) 7000 ))
("Forestnet: Random server" Forestnet "irc.forestnet.org" (6667 7000 ))
("ForeverChat: Random server" ForeverChat "irc.foreverchat.net" ((6660 6669) 7000 ))
("Fraggers: Random server" Fraggers "irc.fraggers.co.uk" ((6661 6669) (7000 7001) ))
("FreedomChat: Random server" FreedomChat "chat.freedomchat.net" 6667)
("FreedomIRC: Random server" FreedomIRC "irc.freedomirc.net" 6667)
("Freenode: Random server" freenode "chat.freenode.net" 6667)
("Freenode: Random EU server" freenode "chat.eu.freenode.net" 6667)
("Freenode: Random US server" freenode "chat.us.freenode.net" 6667)
("FunNet: Random server" FunNet "irc.funnet.org" 6667)
("Galaxynet: Random server" GalaxyNet "irc.galaxynet.org" ((6662 6668) 7000 ))
("Galaxynet: AU, NZ, Auckland" GalaxyNet "auckland.nz.galaxynet.org" ((6661 6669)))
("Galaxynet: EU, BE, Online" GalaxyNet "online.be.galaxynet.org" ((6661 6669)))
("Galaxynet: US, FL, Florida" GalaxyNet "gymnet.us.galaxynet.org" ((6661 6669)))
("Gamesnet: Random east US server" Gamesnet "east.gamesnet.net" 6667)
("Gamesnet: Random west US server" Gamesnet "west.gamesnet.net" 6667)
("GammaForce: Random server" GammaForce "irc.gammaforce.org" ((6660 6669) 7000 ))
("GIKInet: Random server" GIKInet "irc.giki.edu.pk" 6667)
("GizNet: Random server" GizNet "irc.giznet.org" ((6666 6669) 7000 ))
("Globalchat: Random server" Globalchat "irc.globalchat.org" 6667)
("GlobIRC: Random server" GlobIRC "irc.globirc.net" ((6666 6668) 9999 ))
("Goldchat: Random server" Goldchat "irc.goldchat.nl" ((6660 6669) 7000 ))
("Goodchatting: Random server" Goodchatting "irc.goodchatting.com" ((6661 6669) 7000 ))
("GravityLords: Random server" GravityLords "irc.gravitylords.net" 6667)
("Grnet: Random EU server" GRnet "gr.irc.gr" (6667 7000 ))
("Grnet: Random server" GRnet "srv.irc.gr" (6667 7000 ))
("Grnet: Random US server" GRnet "us.irc.gr" (6667 7000 ))
("GulfChat: Random server" GulfChat "irc.gulfchat.net" ((6660 6669)))
("HabberNet: Random server" HabberNet "irc.habber.net" 6667)
("HanIRC: Random server" HanIRC "irc.hanirc.org" 6667)
("Hellenicnet: Random server" Hellenicnet "irc.mirc.gr" (6667 7000 ))
("IceNet: Random server" IceNet "irc.icenet.org.za" 6667)
("ICQnet: Random server" ICQnet "irc.icq.com" 6667)
("Infatech: Random server" Infatech "irc.infatech.net" ((6660 6669)))
("Infinity: Random server" Infinity "irc.infinity-irc.org" 6667)
("Infomatrix: Random server" Infomatrix "irc.infomatrix.net" 6667)
("Inside3D: Random server" Inside3D "irc.inside3d.net" ((6661 6669)))
("InterlinkChat: Random server" InterlinkChat "irc.interlinkchat.net" ((6660 6669) 7000 ))
("IRC-Chile: Random server" IRC-Chile "irc.cl" 6667)
("IRC-Hispano: Random server" IRC-Hispano "irc.irc-hispano.org" 6667)
("IRCchat: Random server" IRCchat "irc.ircchat.tk" 6667)
("IRCGate: Random server" IRCGate "irc.ircgate.net" ((6667 6669)))
("IRCGeeks: Random server" IRCGeeks "irc.ircgeeks.org" ((6660 6669)))
("IRChat: Random server" IRChat "irc.irchat.net" ((6660 6669)))
("IrcLordz: Random server" IrcLordz "irc.irclordz.com" 6667)
("IrcMalta: Random server" IrcMalta "irc.ircmalta.org" ((6660 6667)))
;; This one is dead but used in testing. Please retain.
("IRCnet: EU, FR, Random" IRCnet "irc.fr.ircnet.net" 6667)
("IRCnet: EU, IT, Random" IRCnet "irc.ircd.it" ((6665 6669)))
("IRCnet: AS, IL, Haifa" IRCnet "ircnet.netvision.net.il" ((6661 6668)))
("IRCnet: AS, JP, Tokyo" IRCnet "irc.tokyo.wide.ad.jp" 6667)
("IRCnet: AS, TW, Seed" IRCnet "irc.seed.net.tw" 6667)
("IRCnet: EU, AT, Linz" IRCnet "linz.irc.at" ((6666 6668)))
("IRCnet: EU, AT, Wien" IRCnet "vienna.irc.at" ((6666 6669)))
("IRCnet: EU, BE, Brussels" IRCnet "irc.belnet.be" 6667)
("IRCnet: EU, BE, Zaventem" IRCnet "ircnet.wanadoo.be" ((6661 6669)))
("IRCnet: EU, CZ, Prague" IRCnet "irc.felk.cvut.cz" 6667)
("IRCnet: EU, DE, Berlin" IRCnet "irc.fu-berlin.de" ((6665 6669)))
("IRCnet: EU, DE, Dusseldorf" IRCnet "irc.freenet.de" ((6665 6669)))
("IRCnet: EU, DE, Stuttgart" IRCnet "irc.belwue.de" ((6665 6669)))
("IRCnet: EU, DK, Copenhagen" IRCnet "irc.ircnet.dk" 6667)
("IRCnet: EU, EE, Tallinn" IRCnet "irc.estpak.ee" ((6666 6668)))
("IRCnet: EU, FI, Helsinki" IRCnet "irc.cs.hut.fi" 6667)
("IRCnet: EU, GR, Thessaloniki" IRCnet "irc.ee.auth.gr" ((6666 6669)))
("IRCnet: EU, HU, Budapest" IRCnet "irc.elte.hu" 6667)
("IRCnet: EU, IS, Reykjavik (ircnet)" IRCnet "irc.ircnet.is" ((6661 6669)))
("IRCnet: EU, IS, Reykjavik (simnet)" IRCnet "irc.simnet.is" ((6661 6669)))
("IRCnet: EU, IT, Rome" IRCnet "irc.tin.it" ((6665 6669)))
("IRCnet: EU, NL, Amsterdam (nlnet)" IRCnet "irc.nl.uu.net" ((6660 6669)))
("IRCnet: EU, NL, Amsterdam (xs4all)" IRCnet "irc.xs4all.nl" ((6660 6669)))
("IRCnet: EU, NL, Enschede" IRCnet "irc.snt.utwente.nl" ((6660 6669)))
("IRCnet: EU, NL, Nijmegen" IRCnet "irc.sci.kun.nl" ((6660 6669)))
("IRCnet: EU, NO, Oslo" IRCnet "irc.ifi.uio.no" 6667)
("IRCnet: EU, NO, Trondheim" IRCnet "irc.pvv.ntnu.no" 6667)
("IRCnet: EU, PL, Lublin" IRCnet "lublin.irc.pl" ((6666 6668)))
("IRCnet: EU, PL, Warsaw" IRCnet "warszawa.irc.pl" ((6666 6668)))
("IRCnet: EU, RU, Moscow" IRCnet "irc.msu.ru" 6667)
("IRCnet: EU, SE, Lulea" IRCnet "irc.ludd.luth.se" ((6661 6669)))
("IRCnet: EU, UK, London (Demon)" IRCnet "ircnet.demon.co.uk" ((6665 6669)))
("IRCnet: EU, UK, London (Easynet)" IRCnet "ircnet.easynet.co.uk" ((6666 6669)))
("IRCnet: US, NY, New York" IRCnet "irc.stealth.net" ((6660 6669)))
("IRCnet: Random AU server" IRCnet "au.ircnet.org" 6667)
("IRCnet: Random EU server" IRCnet "eu.ircnet.org" ((6665 6668)))
("IRCnet: Random US server" IRCnet "us.ircnet.org" ((6665 6668)))
("IRCSoulZ: Random server" IRCSoulZ "irc.ircsoulz.net" 6667)
("IRCSul: BR, PR, Maringa" IRCSul "irc.wnet.com.br" 6667)
("IrcTalk: Random server" IrcTalk "irc.irctalk.net" ((6660 6669)))
("Irctoo: Random server" Irctoo "irc.irctoo.net" 6667)
("IRCtown: Random server" IRCtown "irc.irctown.net" ((6666 6669) 7000 ))
("IRCworld: Random server" IRCworld "irc.ircworld.org" 6667)
("ircXtreme: Random server" ircXtreme "irc.ircXtreme.net" ((6660 6669)))
("Israelnet: Random server" Israelnet "irc.israel.net" 6667)
("K0wNet: Random server" K0wNet "irc.k0w.net" ((6660 6669)))
("KDFSnet: Random server" KDFSnet "irc.kdfs.net" ((6667 6669)))
("Kemik: Random server" Kemik "irc.kemik.net" 6667)
("Kewl.Org: Random server" Kewl\.Org "irc.kewl.org" (6667 7000 ))
("Kickchat: Random server" Kickchat "irc.kickchat.com" ((6660 6669) 7000 ))
("Kidsworld: Random server" KidsWorld "irc.kidsworld.org" ((6666 6669)))
("Knightnet: AF, ZA, Durban" Knightnet "orc.dbn.za.knightnet.net" (6667 5555 ))
("Knightnet: US, CA, Goldengate" Knightnet "goldengate.ca.us.knightnet.net" (6667 5555 ))
("Konfido.Net: Random server" Konfido\.Net "irc.konfido.net" 6667)
("KreyNet: Random server" Kreynet "irc.krey.net" 6667)
("Krono: Random server" Krono "irc.krono.net" ((6660 6669) 7000 ))
("Krushnet: Random server" Krushnet "irc.krushnet.org" 6667)
("LagNet: Random server" LagNet "irc.lagnet.org.za" 6667)
("LagNet: AF, ZA, Cape Town" LagNet "reaper.lagnet.org.za" 6667)
("LagNet: AF, ZA, Johannesburg" LagNet "mystery.lagnet.org.za" 6667)
("Libera.Chat: Random server" Libera.Chat "irc.libera.chat"
((6665 6667) (8000 8002)) (6697 7000 7070))
;; If not deprecating this option, use ^ for the rest of these servers.
("Libera.Chat: Random Europe server" Libera.Chat "irc.eu.libera.chat" 6667 6697)
("Libera.Chat: Random US & Canada server" Libera.Chat "irc.us.libera.chat" 6667 6697)
("Libera.Chat: Random Australia & New Zealand server" Libera.Chat "irc.au.libera.chat" 6667 6697)
("Libera.Chat: Random East Asia server" Libera.Chat "irc.ea.libera.chat" 6667 6697)
("Libera.Chat: IPv4 only server" Libera.Chat "irc.ipv4.libera.chat" 6667 6697)
("Libera.Chat: IPv6 only server" Libera.Chat "irc.ipv6.libera.chat" 6667 6697)
("Librenet: Random server" Librenet "irc.librenet.net" 6667)
("LinkNet: Random server" LinkNet "irc.link-net.org" ((6667 6669)))
("LinuxChix: Random server" LinuxChix "irc.linuxchix.org" 6667)
("Liquidized: Random server" Liquidized "irc.liquidized.net" (6667 7000 ))
("M-IRC: Random server" M-IRC "irc.m-sys.org" ((6667 6669)))
("MagicStar: Random server" MagicStar "irc.magicstar.net" 6667)
("Mavra: Random server" Mavra "irc.mavra.net" 6667)
("MediaDriven: Random server" MediaDriven "irc.mediadriven.com" ((6667 6669)))
("mIRC-X: Random server" mIRC-X "irc.mircx.com" (6667 7000 ))
("Morat: Random server" Morat "irc.morat.net" 6667)
("MusicCity: Random server" MusicCity "chat.musiccity.com" 6667)
("Mysteria: Random server" Mysteria "irc.mysteria.net" (6667 7000 ))
("Mysterychat: Random server" Mysterychat "irc.mysterychat.net" ((6667 6669)))
("Mystical: Random server" Mystical "irc.mystical.net" (6667 7000 ))
("Narancs: Random server" Narancs "irc.narancs.com" ((6667 6669) 7000 ))
("Net-France: Random server" Net-France "irc.net-france.com" 6667)
("Nevernet: Random server" Nevernet "irc.nevernet.net" 6667)
("Newnet: Random server" Newnet "irc.newnet.net" ((6665 6667)))
("Nexusirc: Random server" Nexusirc "irc.nexusirc.org" 6667)
("Nightstar: Random server" NightStar "irc.nightstar.net" ((6665 6669)))
("NitrousNet: Random server" NitrousNet "irc.nitrousnet.net" 6667)
("Novernet: Random server" Novernet "irc.novernet.com" ((6665 6669) 7000 ))
("Nullrouted: Random server" Nullrouted "irc.nullrouted.org" ((6666 6669) 7000 ))
("NullusNet: Random server" NullusNet "irc.nullus.net" 6667)
("OFTC: Random server" OFTC "irc.oftc.net" ((6667 6670) 7000) (6697 9999))
("OpChat: Random server" OpChat "irc.opchat.org" ((6667 6669)))
("Othernet: Random server" Othernet "irc.othernet.org" 6667)
("Othernet: US, FL, Miami" Othernet "miami.fl.us.othernet.org" 6667)
("Othernet: US, MO, StLouis" Othernet "stlouis.mo.us.othernet.org" 6667)
("Otherside: Random server" OtherSide "irc.othersideirc.net" 6667)
("Outsiderz: Random server" Outsiderz "irc.outsiderz.com" 6667)
("OzOrg: AU, Perth" OzOrg "iinet.perth.oz.org" 6667)
("Peacefulhaven: Random server" Peacefulhaven "irc.peacefulhaven.net" ((6660 6669) 7000 ))
("PhazedIRC: Random server" PhazedIRC "irc.phazedirc.net" 6667)
("Philchat: Random server" Philchat "irc.philchat.net" 6667)
("phrozN: Random server" phrozN "irc.phrozn.net" 6667)
("PiNet: Random server" PiNet "irc.praetorians.org" ((6665 6669)))
("Pinoycentral: Random server" Pinoycentral "chat.abs-cbn.com" 6667)
("Planetarion: Random server" Planetarion "irc.planetarion.com" 6667)
("POLNet: Random server" POLNet "irc.ircnet.pl" 6667)
("Psionics: CA, PQ, Montreal" Psionics "chat.psionics.net" ((6660 6669)))
("PTirc: Random server" PTirc "irc.ptirc.com.pt" 6667)
("PTlink: Random server" PTlink "irc.ptlink.net" 6667)
("PTnet: Random server" PTnet "irc.ptnet.org" 6667)
("QChat: Random server" QChat "irc.qchat.net" 6667)
("QuakeNet: Random German server" QuakeNet "de.quakenet.org" ((6667 6669)))
("QuakeNet: Random server" QuakeNet "irc.quakenet.eu.org" ((6667 6669)))
("QuakeNet: Random Swedish server" QuakeNet "se.quakenet.org" ((6667 6669)))
("QuakeNet: Random UK server" QuakeNet "uk.quakenet.org" ((6667 6669)))
("QuakeNet: Random US server" QuakeNet "us.quakenet.org" ((6667 6669)))
("Realirc: Random server" Realirc "irc.realirc.org" 6667)
("RealmNET: Random server" RealmNET "irc.realmnet.com" 6667)
("Rebelchat: Random server" Rebelchat "irc.rebelchat.org" 6667)
("Red-Latina: Random server" Red-Latina "irc.red-latina.org" 6667)
("RedLatona: Random server" RedLatona "irc.redlatona.net" (6667 6668 ))
("Relicnet: Random server" Relicnet "irc.relic.net" 6667)
("Rezosup: Random server" Rezosup "irc.rezosup.org" 6667)
("Risanet: Random server" Risanet "irc.risanet.com" ((6667 6669)))
("Rizon: Random server" Rizon "irc.rizon.net" (6633 (6660 6669) 6697 7000 8080 9999))
("Rubiks: Random server" Rubiks "irc.rubiks.net" 6667)
("Rusnet: EU, RU, Tomsk" Rusnet "irc.tsk.ru" ((6667 6669) (7770 7775) ))
("Rusnet: EU, RU, Vladivostok" Rusnet "irc.vladivostok.ru" ((6667 6669) (7770 7775) ))
("Rusnet: EU, UA, Kiev" Rusnet "irc.kar.net" ((6667 6669) (7770 7775) ))
("Sandnet: Random server" Sandnet "irc.sandnet.net" ((6660 6669) 7000 ))
("Scunc: Random server" Scunc "irc.scunc.net" 6667)
("SerbianCafe: Random server" SerbianCafe "irc.serbiancafe.ws" ((6665 6669)))
("SexNet: Random server" SexNet "irc.sexnet.org" 6667)
("ShadowFire: Random server" ShadowFire "irc.shadowfire.org" 6667)
("ShadowWorld: Random server" ShadowWorld "irc.shadowworld.net" 6667)
("SkyNet: Random server" SkyNet "irc.bronowski.pl" ((6666 6668)))
("Slashnet: Random server" Slashnet "irc.slashnet.org" 6667)
("SolarStone: Random server" SolarStone "irc.solarstone.net" ((6660 6669)))
("Sorcerynet: Random server" Sorcery "irc.sorcery.net" (6667 7000 9000 ))
("Sorcerynet: EU, SE, Karlskrona" Sorcery "nexus.sorcery.net" (6667 7000 9000 ))
("Sorcerynet: US, CA, Palo Alto" Sorcery "kechara.sorcery.net" (6667 7000 9000 ))
("SourceIRC: Random server" SourceIRC "irc.sourceirc.net" ((6667 6669) 7000 ))
("SpaceTronix: Random server" SpaceTronix "irc.spacetronix.net" ((6660 6669) 7000 ))
("Spirit-Harmony: Random server" Spirit-Harmony "irc.spirit-harmony.com" ((6661 6669)))
("StarChat: Random server" StarChat "irc.starchat.net" ((6667 6669) 7000 ))
("StarEquinox: Random server" StarEquinox "irc.starequinox.net" ((6660 6669)))
("StarLink: Random server" Starlink "irc.starlink.net" ((6660 6669)))
("StarLink-irc: Random server" starlink-irc "irc.starlink-irc.org" 6667)
("StarWars-IRC: Random server" StarWars-IRC "irc.starwars-irc.net" ((6663 6667)))
("Stormdancing: Random server" Stormdancing "irc.stormdancing.net" ((6664 6669) 7000 9000 ))
("Superchat: Random server" Superchat "irc.superchat.org" ((6660 6668)))
("Sysopnet: Random server" Sysopnet "irc.sysopnet.org" ((6666 6668)))
("Telstra: Random server" Telstra "irc.telstra.com" ((6667 6669)))
("TR-net: EU, TR, Ankara" TR-net "irc.dominet.com.tr" 6667)
("TR-net: EU, Tr, Istanbul" TR-net "irc.teklan.com.tr" 6667)
("Tri-net: Random server" Tri-net "irc.tri-net.org" 6667)
("TriLink: Random server" TriLink "irc.ft4u.net" 6667)
("TurkishChat: Random server" TurkishChat "irc.turkishchat.org" ((6660 6669) 7000 ))
("UberNinja: Random server" UberNinja "irc.uberninja.net" ((6667 6669)))
("UICN: Random server" UICN "irc.uicn.net" 6667)
("UltraIRC: Random server" UltraIRC "irc.ultrairc.net" 6667)
("UnderChat: Random server" UnderChat "irc.underchat.it" ((6660 6669) 7000 ))
("Undernet: CA, ON, Toronto" Undernet "toronto.on.ca.undernet.org" ((6661 6669)))
("Undernet: CA, QC, Montreal" Undernet "montreal.qu.ca.undernet.org" ((6660 6669)))
("Undernet: EU, AT, Graz" Undernet "graz.at.eu.undernet.org" ((6661 6669)))
("Undernet: EU, BE, Antwerp" Undernet "flanders.be.eu.undernet.org" ((6660 6669)))
("Undernet: EU, BE, Brussels" Undernet "brussels.be.eu.undernet.org" 6667)
("Undernet: EU, CH, Geneva" Undernet "geneva.ch.eu.undernet.org" ((6660 6669) 7777 8000 ))
("Undernet: EU, FR, Caen" Undernet "caen.fr.eu.undernet.org" ((6666 6669)))
("Undernet: EU, NL, Diemen" Undernet "diemen.nl.eu.undernet.org" ((6660 6669)))
("Undernet: EU, NL, Haarlem" Undernet "haarlem.nl.eu.undernet.org" ((6660 6669)))
("Undernet: EU, NO, Oslo" Undernet "oslo.no.eu.undernet.org" ((6660 6669)))
("Undernet: EU, SE, Stockholm" Undernet "stockholm.se.eu.undernet.org" ((6666 6669)))
("Undernet: EU, UK, Surrey" Undernet "surrey.uk.eu.undernet.org" ((6660 6669)))
("Undernet: US, AZ, Mesa" Undernet "mesa.az.us.undernet.org" ((6665 6667)))
("Undernet: US, CA, San Diego" Undernet "sandiego.ca.us.undernet.org" ((6660 6670)))
("Undernet: US, DC, Washington" Undernet "washington.dc.us.undernet.org" ((6660 6669)))
("Undernet: US, KS, Manhattan" Undernet "manhattan.ks.us.undernet.org" ((6660 6669)))
("Undernet: US, NV, Las Vegas" Undernet "lasvegas.nv.us.undernet.org" ((6660 6669)))
("Undernet: US, TX, Austin" Undernet "austin.tx.us.undernet.org" ((6660 6669)))
("Undernet: US, UT, Saltlake" Undernet "saltlake.ut.us.undernet.org" ((6660 6669)))
("Undernet: US, VA, Arlington" Undernet "arlington.va.us.undernet.org" ((6660 6669)))
("Undernet: US, VA, McLean" Undernet "mclean.va.us.undernet.org" ((6666 6669)))
("Undernet: Random EU server" Undernet "eu.undernet.org" 6667)
("Undernet: Random US server" Undernet "us.undernet.org" 6667)
("UnderZ: Random server" UnderZ "irc.underz.org" ((6667 6668)))
("UniChat: Random server" UniChat "irc.uni-chat.net" 6667)
("UnionLatina: Random server" UnionLatina "irc.unionlatina.org" 6667)
("Univers: Random server" Univers "irc.univers.org" ((6665 6669)))
("UnixR: Random server" UnixR "irc.unixr.net" ((6667 6669)))
("Vidgamechat: Random server" Vidgamechat "irc.vidgamechat.com" 6667)
("VirtuaNet: Random server" VirtuaNet "irc.virtuanet.org" ((6660 6669) 7000 ))
("Vitamina: Random server" Vitamina "irc.vitamina.ca" 6667)
("Voila: Random server" Voila "irc.voila.fr" 6667)
("Wahou: Random server" Wahou "irc.wahou.org" ((6665 6669)))
("Warpednet: Random server" Warpednet "irc.warped.net" 6667)
("Weaklinks: Random server" Weaklinks "irc.weaklinks.net" ((6667 6669)))
("Webnet: Random server" Webnet "irc.webchat.org" ((6667 6669) 7000 ))
("Webnet: US, CA, Santa Clara" Webnet "webmaster.ca.us.webchat.org" ((6661 6669)))
("WinChat: Random server" WinChat "irc.winchat.net" ((6661 6669)))
("WinIRC: Random server" WinIRC "irc.winirc.org" ((6667 6669) 4400 ))
("WorldIRC: Random server" WorldIRC "irc.worldirc.org" ((6660 6667)))
("WyldRyde: Random server" WyldRyde "irc.wyldryde.net" ((6666 6669)))
("XentoniX: Random server" XentoniX "irc.xentonix.net" ((6661 6669)))
("Xevion: Random server" Xevion "irc.xevion.net" (6667 7000 ))
("XNet: Random server" XNet "irc.xnet.org" 6667)
("XWorld: Random server" XWorld "irc.xworld.org" 6667)
("ZAnet Net: Random server" ZAnetNet "irc.zanet.net" 6667)
("ZAnet Org: UK, London" ZAnetOrg "mystic.zanet.org.za" 6667)
("ZiRC: Random server" ZiRC "irc.zirc.org" ((6660 6669)))
("ZUHnet: Random server" ZUHnet "irc.zuh.net" 6667)
("Zurna: Random server" Zurna "irc.zurna.net" 6667))
lisp/*.el: Fix typos and other trivial doc fixes * lisp/allout-widgets.el (allout-widgets-auto-activation) (allout-current-decorated-p): * lisp/auth-source.el (auth-source-protocols): * lisp/autorevert.el (auto-revert-set-timer): * lisp/battery.el (battery-mode-line-limit): * lisp/calc/calcalg3.el (math-map-binop): * lisp/calendar/cal-dst.el (calendar-dst-find-startend): * lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute): * lisp/calendar/calendar.el (calendar-date-echo-text) (calendar-generate-month, calendar-string-spread) (calendar-cursor-to-date, calendar-read, calendar-read-date) (calendar-mark-visible-date, calendar-dayname-on-or-before): * lisp/calendar/diary-lib.el (diary-ordinal-suffix): * lisp/cedet/ede/autoconf-edit.el (autoconf-new-program) (autoconf-find-last-macro, autoconf-parameter-strip): * lisp/cedet/ede/config.el (ede-target-with-config-build): * lisp/cedet/ede/linux.el (ede-linux--detect-architecture) (ede-linux--get-architecture): * lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache) (semantic-displayer-abstract, semantic-displayer-point-position): * lisp/cedet/semantic/format.el (semantic-format-face-alist) (semantic-format-tag-short-doc): * lisp/cedet/semantic/fw.el (semantic-find-file-noselect): * lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time) (semantic-idle-breadcrumbs-display-function) (semantic-idle-breadcrumbs-format-tag-list-function): * lisp/cedet/semantic/lex.el (semantic-lex-map-types) (define-lex, define-lex-block-type-analyzer): * lisp/cedet/semantic/senator.el (senator-search-default-tag-filter): * lisp/cedet/semantic/symref.el (semantic-symref-result) (semantic-symref-hit-to-tag-via-db): * lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass): * lisp/cedet/semantic/tag.el (semantic-tag-new-variable) (semantic-tag-new-include, semantic-tag-new-package) (semantic-tag-set-faux, semantic-create-tag-proxy) (semantic-tag-function-parent) (semantic-tag-components-with-overlays): * lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces) (srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict): * lisp/cedet/srecode/dictionary.el (srecode-create-dictionary) (srecode-dictionary-add-entries, srecode-dictionary-lookup-name) (srecode-create-dictionaries-from-tags): * lisp/cmuscheme.el (scheme-compile-region): * lisp/color.el (color-lab-to-lch): * lisp/doc-view.el (doc-view-image-width) (doc-view-set-up-single-converter): * lisp/dynamic-setting.el (font-setting-change-default-font) (dynamic-setting-handle-config-changed-event): * lisp/elec-pair.el (electric-pair-text-pairs) (electric-pair-skip-whitespace-function) (electric-pair-string-bound-function): * lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance) (avl-tree-member, avl-tree-mapcar, avl-tree-iter): * lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree): * lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag) (checkdoc-spellcheck-documentation-flag, checkdoc-ispell) (checkdoc-ispell-current-buffer, checkdoc-ispell-interactive) (checkdoc-ispell-message-interactive) (checkdoc-ispell-message-text, checkdoc-ispell-start) (checkdoc-ispell-continue, checkdoc-ispell-comments) (checkdoc-ispell-defun): * lisp/emacs-lisp/cl-generic.el (cl--generic-search-method): * lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group): * lisp/emacs-lisp/lisp.el (forward-sexp, up-list): * lisp/emacs-lisp/package-x.el (package--archive-contents-from-file): * lisp/emacs-lisp/package.el (package-desc) (package--make-autoloads-and-stuff, package-hidden-regexps): * lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup): * lisp/emacs-lisp/testcover.el (testcover-nohits) (testcover-1value): * lisp/epg.el (epg-receive-keys, epg-start-edit-key): * lisp/erc/erc-backend.el (erc-server-processing-p) (erc-split-line-length, erc-server-coding-system) (erc-server-send, erc-message): * lisp/erc/erc-button.el (erc-button-face, erc-button-alist) (erc-browse-emacswiki): * lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login): * lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation): * lisp/erc/erc-log.el (erc-current-logfile): * lisp/erc/erc-match.el (erc-log-match-format) (erc-text-matched-hook): * lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug): * lisp/erc/erc-networks.el (erc-server-alist) (erc-networks-alist, erc-current-network): * lisp/erc/erc-ring.el (erc-input-ring-index): * lisp/erc/erc-speedbar.el (erc-speedbar) (erc-speedbar-update-channel): * lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag): * lisp/erc/erc-track.el (erc-track-position-in-mode-line) (erc-track-remove-from-mode-line, erc-modified-channels-update) (erc-track-last-non-erc-buffer, erc-track-sort-by-importance) (erc-track-get-active-buffer): * lisp/erc/erc.el (erc-get-channel-user-list) (erc-echo-notice-hook, erc-echo-notice-always-hook) (erc-wash-quit-reason, erc-format-@nick): * lisp/ffap.el (ffap-latex-mode): * lisp/files.el (abort-if-file-too-large) (dir-locals--get-sort-score, buffer-stale--default-function): * lisp/filesets.el (filesets-tree-max-level, filesets-data) (filesets-update-pre010505): * lisp/gnus/gnus-agent.el (gnus-agent-flush-cache): * lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol) (gnus-button-prefer-mid-or-mail): * lisp/gnus/gnus-cus.el (gnus-group-parameters): * lisp/gnus/gnus-demon.el (gnus-demon-handlers) (gnus-demon-run-callback): * lisp/gnus/gnus-dired.el (gnus-dired-print): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer): * lisp/gnus/gnus-range.el (gnus-range-normalize): * lisp/gnus/gnus-spec.el (gnus-pad-form): * lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud) (gnus-server-opened, gnus-server-closed, gnus-server-denied) (gnus-server-offline): * lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir) (gnus-refer-thread-limit-to-thread) (gnus-summary-limit-include-thread, gnus-summary-refer-thread) (gnus-summary-find-matching): * lisp/gnus/gnus-util.el (gnus-rescale-image): * lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server): * lisp/gnus/mail-source.el (mail-source-incoming-file-prefix): * lisp/gnus/message.el (message-cite-reply-position) (message-cite-style-outlook, message-cite-style-thunderbird) (message-cite-style-gmail, message--send-mail-maybe-partially): * lisp/gnus/mm-extern.el (mm-inline-external-body): * lisp/gnus/mm-partial.el (mm-inline-partial): * lisp/gnus/mml-sec.el (mml-secure-message-sign) (mml-secure-message-sign-encrypt, mml-secure-message-encrypt): * lisp/gnus/mml2015.el (mml2015-epg-key-image) (mml2015-epg-key-image-to-string): * lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail): * lisp/gnus/nnheader.el (nnheader-directory-files-is-safe): * lisp/gnus/nnir.el (nnir-search-history) (nnir-imap-search-other, nnir-artlist-length) (nnir-artlist-article, nnir-artitem-group, nnir-artitem-number) (nnir-artitem-rsv, nnir-article-group, nnir-article-number) (nnir-article-rsv, nnir-article-ids, nnir-categorize) (nnir-retrieve-headers-override-function) (nnir-imap-default-search-key, nnir-hyrex-additional-switches) (gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms) (nnir-read-parm, nnir-read-server-parm, nnir-search-thread): * lisp/gnus/nnmairix.el (nnmairix-default-group) (nnmairix-propagate-marks): * lisp/gnus/smime.el (smime-keys, smime-crl-check) (smime-verify-buffer, smime-noverify-buffer): * lisp/gnus/spam-report.el (spam-report-url-ping-mm-url): * lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header) (spam-spamassassin-spam-status-header, spam-sa-learn-rebuild) (spam-classifications, spam-check-stat, spam-spamassassin-score): * lisp/help.el (describe-minor-mode-from-symbol): * lisp/hippie-exp.el (hippie-expand-ignore-buffers): * lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face) (hfy-begin-span): * lisp/ibuf-ext.el (ibuffer-update-saved-filters-format) (ibuffer-saved-filters, ibuffer-old-saved-filters-warning) (ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters) (eval, ibuffer-unary-operand, file-extension, directory): * lisp/image-dired.el (image-dired-cmd-pngcrush-options): * lisp/image-mode.el (image-toggle-display): * lisp/international/ccl.el (ccl-compile-read-multibyte-character) (ccl-compile-write-multibyte-character): * lisp/international/kkc.el (kkc-save-init-file): * lisp/international/latin1-disp.el (latin1-display): * lisp/international/ogonek.el (ogonek-name-encoding-alist) (ogonek-information, ogonek-lookup-encoding) (ogonek-deprefixify-region): * lisp/isearch.el (isearch-filter-predicate) (isearch--momentary-message): * lisp/jsonrpc.el (jsonrpc-connection-send) (jsonrpc-process-connection, jsonrpc-shutdown) (jsonrpc--async-request-1): * lisp/language/tibet-util.el (tibetan-char-p): * lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date) (feedmail-last-chance-hook, feedmail-before-fcc-hook) (feedmail-send-it-immediately-wrapper, feedmail-find-eoh): * lisp/mail/hashcash.el (hashcash-generate-payment) (hashcash-generate-payment-async, hashcash-insert-payment) (hashcash-verify-payment): * lisp/mail/rmail.el (rmail-movemail-variant-in-use) (rmail-get-attr-value): * lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime): * lisp/mail/rmailsum.el (rmail-summary-show-message): * lisp/mail/supercite.el (sc-raw-mode-toggle): * lisp/man.el (Man-start-calling): * lisp/mh-e/mh-acros.el (mh-do-at-event-location) (mh-iterate-on-messages-in-region, mh-iterate-on-range): * lisp/mh-e/mh-alias.el (mh-alias-system-aliases) (mh-alias-reload, mh-alias-ali) (mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file) (mh-alias-add-alias): * lisp/mouse.el (mouse-save-then-kill): * lisp/net/browse-url.el (browse-url-default-macosx-browser): * lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value) (eudc-variable-server-value, eudc-update-variable) (eudc-expand-inline): * lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): * lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list): * lisp/net/pop3.el (pop3-list): * lisp/net/soap-client.el (soap-namespace-put) (soap-xs-parse-sequence, soap-parse-envelope): * lisp/net/soap-inspect.el (soap-inspect-xs-complex-type): * lisp/nxml/rng-xsd.el (rng-xsd-date-to-days): * lisp/org/ob-C.el (org-babel-prep-session:C) (org-babel-load-session:C): * lisp/org/ob-J.el (org-babel-execute:J): * lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote): * lisp/org/ob-awk.el (org-babel-execute:awk): * lisp/org/ob-core.el (org-babel-process-file-name): * lisp/org/ob-ebnf.el (org-babel-execute:ebnf): * lisp/org/ob-forth.el (org-babel-execute:forth): * lisp/org/ob-fortran.el (org-babel-execute:fortran) (org-babel-prep-session:fortran, org-babel-load-session:fortran): * lisp/org/ob-groovy.el (org-babel-execute:groovy): * lisp/org/ob-io.el (org-babel-execute:io): * lisp/org/ob-js.el (org-babel-execute:js): * lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond) (org-babel-lilypond-compile-post-tangle) (org-babel-lilypond-display-pdf-post-tangle) (org-babel-lilypond-tangle) (org-babel-lilypond-execute-tangled-ly) (org-babel-lilypond-compile-lilyfile) (org-babel-lilypond-check-for-compile-error) (org-babel-lilypond-process-compile-error) (org-babel-lilypond-mark-error-line) (org-babel-lilypond-parse-error-line) (org-babel-lilypond-attempt-to-open-pdf) (org-babel-lilypond-attempt-to-play-midi) (org-babel-lilypond-switch-extension) (org-babel-lilypond-set-header-args): * lisp/org/ob-lua.el (org-babel-prep-session:lua): * lisp/org/ob-picolisp.el (org-babel-execute:picolisp): * lisp/org/ob-processing.el (org-babel-prep-session:processing): * lisp/org/ob-python.el (org-babel-prep-session:python): * lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message) (org-babel-scheme-execute-with-geiser, org-babel-execute:scheme): * lisp/org/ob-shen.el (org-babel-execute:shen): * lisp/org/org-agenda.el (org-agenda-entry-types) (org-agenda-move-date-from-past-immediately-to-today) (org-agenda-time-grid, org-agenda-sorting-strategy) (org-agenda-filter-by-category, org-agenda-forward-block): * lisp/org/org-colview.el (org-columns--overlay-text): * lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces): * lisp/org/org-indent.el (org-indent-set-line-properties): * lisp/org/org-macs.el (org-get-limited-outline-regexp): * lisp/org/org-mobile.el (org-mobile-files): * lisp/org/org.el (org-use-fast-todo-selection) (org-extend-today-until, org-use-property-inheritance) (org-refresh-effort-properties, org-open-at-point-global) (org-track-ordered-property-with-tag, org-shiftright): * lisp/org/ox-html.el (org-html-checkbox-type): * lisp/org/ox-man.el (org-man-source-highlight) (org-man-verse-block): * lisp/org/ox-publish.el (org-publish-sitemap-default): * lisp/outline.el (outline-head-from-level): * lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1) (dcl-calc-command-indent, dcl-indent-to): * lisp/progmodes/flymake.el (flymake-make-diagnostic) (flymake--overlays, flymake-diagnostic-functions) (flymake-diagnostic-types-alist, flymake--backend-state) (flymake-is-running, flymake--collect, flymake-mode): * lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop) (gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer): * lisp/progmodes/grep.el (grep-error-screen-columns): * lisp/progmodes/gud.el (gud-prev-expr): * lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column) (ps-run-goto-error): * lisp/progmodes/python.el (python-eldoc-get-doc) (python-eldoc-function-timeout-permanent, python-eldoc-function): * lisp/shadowfile.el (shadow-make-group): * lisp/speedbar.el (speedbar-obj-do-check): * lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook): * lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib): * lisp/textmodes/reftex-index.el (reftex-index-goto-entry) (reftex-index-kill, reftex-index-undo): * lisp/textmodes/reftex-parse.el (reftex-context-substring): * lisp/textmodes/reftex.el (reftex-TeX-master-file): * lisp/textmodes/rst.el (rst-next-hdr, rst-toc) (rst-uncomment-region, rst-font-lock-extend-region-internal): * lisp/thumbs.el (thumbs-mode): * lisp/vc/ediff-util.el (ediff-restore-diff): * lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag): * lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p): * lisp/wid-edit.el (widget-field-value-set, string): * lisp/x-dnd.el (x-dnd-version-from-flags) (x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
"Alist of irc servers.
Each server is a list (NAME NET HOST PORTS TLS-PORTS) where
NAME is a name for that server,
lisp/*.el: Fix typos and other trivial doc fixes * lisp/allout-widgets.el (allout-widgets-auto-activation) (allout-current-decorated-p): * lisp/auth-source.el (auth-source-protocols): * lisp/autorevert.el (auto-revert-set-timer): * lisp/battery.el (battery-mode-line-limit): * lisp/calc/calcalg3.el (math-map-binop): * lisp/calendar/cal-dst.el (calendar-dst-find-startend): * lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute): * lisp/calendar/calendar.el (calendar-date-echo-text) (calendar-generate-month, calendar-string-spread) (calendar-cursor-to-date, calendar-read, calendar-read-date) (calendar-mark-visible-date, calendar-dayname-on-or-before): * lisp/calendar/diary-lib.el (diary-ordinal-suffix): * lisp/cedet/ede/autoconf-edit.el (autoconf-new-program) (autoconf-find-last-macro, autoconf-parameter-strip): * lisp/cedet/ede/config.el (ede-target-with-config-build): * lisp/cedet/ede/linux.el (ede-linux--detect-architecture) (ede-linux--get-architecture): * lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache) (semantic-displayer-abstract, semantic-displayer-point-position): * lisp/cedet/semantic/format.el (semantic-format-face-alist) (semantic-format-tag-short-doc): * lisp/cedet/semantic/fw.el (semantic-find-file-noselect): * lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time) (semantic-idle-breadcrumbs-display-function) (semantic-idle-breadcrumbs-format-tag-list-function): * lisp/cedet/semantic/lex.el (semantic-lex-map-types) (define-lex, define-lex-block-type-analyzer): * lisp/cedet/semantic/senator.el (senator-search-default-tag-filter): * lisp/cedet/semantic/symref.el (semantic-symref-result) (semantic-symref-hit-to-tag-via-db): * lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass): * lisp/cedet/semantic/tag.el (semantic-tag-new-variable) (semantic-tag-new-include, semantic-tag-new-package) (semantic-tag-set-faux, semantic-create-tag-proxy) (semantic-tag-function-parent) (semantic-tag-components-with-overlays): * lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces) (srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict): * lisp/cedet/srecode/dictionary.el (srecode-create-dictionary) (srecode-dictionary-add-entries, srecode-dictionary-lookup-name) (srecode-create-dictionaries-from-tags): * lisp/cmuscheme.el (scheme-compile-region): * lisp/color.el (color-lab-to-lch): * lisp/doc-view.el (doc-view-image-width) (doc-view-set-up-single-converter): * lisp/dynamic-setting.el (font-setting-change-default-font) (dynamic-setting-handle-config-changed-event): * lisp/elec-pair.el (electric-pair-text-pairs) (electric-pair-skip-whitespace-function) (electric-pair-string-bound-function): * lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance) (avl-tree-member, avl-tree-mapcar, avl-tree-iter): * lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree): * lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag) (checkdoc-spellcheck-documentation-flag, checkdoc-ispell) (checkdoc-ispell-current-buffer, checkdoc-ispell-interactive) (checkdoc-ispell-message-interactive) (checkdoc-ispell-message-text, checkdoc-ispell-start) (checkdoc-ispell-continue, checkdoc-ispell-comments) (checkdoc-ispell-defun): * lisp/emacs-lisp/cl-generic.el (cl--generic-search-method): * lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group): * lisp/emacs-lisp/lisp.el (forward-sexp, up-list): * lisp/emacs-lisp/package-x.el (package--archive-contents-from-file): * lisp/emacs-lisp/package.el (package-desc) (package--make-autoloads-and-stuff, package-hidden-regexps): * lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup): * lisp/emacs-lisp/testcover.el (testcover-nohits) (testcover-1value): * lisp/epg.el (epg-receive-keys, epg-start-edit-key): * lisp/erc/erc-backend.el (erc-server-processing-p) (erc-split-line-length, erc-server-coding-system) (erc-server-send, erc-message): * lisp/erc/erc-button.el (erc-button-face, erc-button-alist) (erc-browse-emacswiki): * lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login): * lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation): * lisp/erc/erc-log.el (erc-current-logfile): * lisp/erc/erc-match.el (erc-log-match-format) (erc-text-matched-hook): * lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug): * lisp/erc/erc-networks.el (erc-server-alist) (erc-networks-alist, erc-current-network): * lisp/erc/erc-ring.el (erc-input-ring-index): * lisp/erc/erc-speedbar.el (erc-speedbar) (erc-speedbar-update-channel): * lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag): * lisp/erc/erc-track.el (erc-track-position-in-mode-line) (erc-track-remove-from-mode-line, erc-modified-channels-update) (erc-track-last-non-erc-buffer, erc-track-sort-by-importance) (erc-track-get-active-buffer): * lisp/erc/erc.el (erc-get-channel-user-list) (erc-echo-notice-hook, erc-echo-notice-always-hook) (erc-wash-quit-reason, erc-format-@nick): * lisp/ffap.el (ffap-latex-mode): * lisp/files.el (abort-if-file-too-large) (dir-locals--get-sort-score, buffer-stale--default-function): * lisp/filesets.el (filesets-tree-max-level, filesets-data) (filesets-update-pre010505): * lisp/gnus/gnus-agent.el (gnus-agent-flush-cache): * lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol) (gnus-button-prefer-mid-or-mail): * lisp/gnus/gnus-cus.el (gnus-group-parameters): * lisp/gnus/gnus-demon.el (gnus-demon-handlers) (gnus-demon-run-callback): * lisp/gnus/gnus-dired.el (gnus-dired-print): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer): * lisp/gnus/gnus-range.el (gnus-range-normalize): * lisp/gnus/gnus-spec.el (gnus-pad-form): * lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud) (gnus-server-opened, gnus-server-closed, gnus-server-denied) (gnus-server-offline): * lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir) (gnus-refer-thread-limit-to-thread) (gnus-summary-limit-include-thread, gnus-summary-refer-thread) (gnus-summary-find-matching): * lisp/gnus/gnus-util.el (gnus-rescale-image): * lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server): * lisp/gnus/mail-source.el (mail-source-incoming-file-prefix): * lisp/gnus/message.el (message-cite-reply-position) (message-cite-style-outlook, message-cite-style-thunderbird) (message-cite-style-gmail, message--send-mail-maybe-partially): * lisp/gnus/mm-extern.el (mm-inline-external-body): * lisp/gnus/mm-partial.el (mm-inline-partial): * lisp/gnus/mml-sec.el (mml-secure-message-sign) (mml-secure-message-sign-encrypt, mml-secure-message-encrypt): * lisp/gnus/mml2015.el (mml2015-epg-key-image) (mml2015-epg-key-image-to-string): * lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail): * lisp/gnus/nnheader.el (nnheader-directory-files-is-safe): * lisp/gnus/nnir.el (nnir-search-history) (nnir-imap-search-other, nnir-artlist-length) (nnir-artlist-article, nnir-artitem-group, nnir-artitem-number) (nnir-artitem-rsv, nnir-article-group, nnir-article-number) (nnir-article-rsv, nnir-article-ids, nnir-categorize) (nnir-retrieve-headers-override-function) (nnir-imap-default-search-key, nnir-hyrex-additional-switches) (gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms) (nnir-read-parm, nnir-read-server-parm, nnir-search-thread): * lisp/gnus/nnmairix.el (nnmairix-default-group) (nnmairix-propagate-marks): * lisp/gnus/smime.el (smime-keys, smime-crl-check) (smime-verify-buffer, smime-noverify-buffer): * lisp/gnus/spam-report.el (spam-report-url-ping-mm-url): * lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header) (spam-spamassassin-spam-status-header, spam-sa-learn-rebuild) (spam-classifications, spam-check-stat, spam-spamassassin-score): * lisp/help.el (describe-minor-mode-from-symbol): * lisp/hippie-exp.el (hippie-expand-ignore-buffers): * lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face) (hfy-begin-span): * lisp/ibuf-ext.el (ibuffer-update-saved-filters-format) (ibuffer-saved-filters, ibuffer-old-saved-filters-warning) (ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters) (eval, ibuffer-unary-operand, file-extension, directory): * lisp/image-dired.el (image-dired-cmd-pngcrush-options): * lisp/image-mode.el (image-toggle-display): * lisp/international/ccl.el (ccl-compile-read-multibyte-character) (ccl-compile-write-multibyte-character): * lisp/international/kkc.el (kkc-save-init-file): * lisp/international/latin1-disp.el (latin1-display): * lisp/international/ogonek.el (ogonek-name-encoding-alist) (ogonek-information, ogonek-lookup-encoding) (ogonek-deprefixify-region): * lisp/isearch.el (isearch-filter-predicate) (isearch--momentary-message): * lisp/jsonrpc.el (jsonrpc-connection-send) (jsonrpc-process-connection, jsonrpc-shutdown) (jsonrpc--async-request-1): * lisp/language/tibet-util.el (tibetan-char-p): * lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date) (feedmail-last-chance-hook, feedmail-before-fcc-hook) (feedmail-send-it-immediately-wrapper, feedmail-find-eoh): * lisp/mail/hashcash.el (hashcash-generate-payment) (hashcash-generate-payment-async, hashcash-insert-payment) (hashcash-verify-payment): * lisp/mail/rmail.el (rmail-movemail-variant-in-use) (rmail-get-attr-value): * lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime): * lisp/mail/rmailsum.el (rmail-summary-show-message): * lisp/mail/supercite.el (sc-raw-mode-toggle): * lisp/man.el (Man-start-calling): * lisp/mh-e/mh-acros.el (mh-do-at-event-location) (mh-iterate-on-messages-in-region, mh-iterate-on-range): * lisp/mh-e/mh-alias.el (mh-alias-system-aliases) (mh-alias-reload, mh-alias-ali) (mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file) (mh-alias-add-alias): * lisp/mouse.el (mouse-save-then-kill): * lisp/net/browse-url.el (browse-url-default-macosx-browser): * lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value) (eudc-variable-server-value, eudc-update-variable) (eudc-expand-inline): * lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): * lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list): * lisp/net/pop3.el (pop3-list): * lisp/net/soap-client.el (soap-namespace-put) (soap-xs-parse-sequence, soap-parse-envelope): * lisp/net/soap-inspect.el (soap-inspect-xs-complex-type): * lisp/nxml/rng-xsd.el (rng-xsd-date-to-days): * lisp/org/ob-C.el (org-babel-prep-session:C) (org-babel-load-session:C): * lisp/org/ob-J.el (org-babel-execute:J): * lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote): * lisp/org/ob-awk.el (org-babel-execute:awk): * lisp/org/ob-core.el (org-babel-process-file-name): * lisp/org/ob-ebnf.el (org-babel-execute:ebnf): * lisp/org/ob-forth.el (org-babel-execute:forth): * lisp/org/ob-fortran.el (org-babel-execute:fortran) (org-babel-prep-session:fortran, org-babel-load-session:fortran): * lisp/org/ob-groovy.el (org-babel-execute:groovy): * lisp/org/ob-io.el (org-babel-execute:io): * lisp/org/ob-js.el (org-babel-execute:js): * lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond) (org-babel-lilypond-compile-post-tangle) (org-babel-lilypond-display-pdf-post-tangle) (org-babel-lilypond-tangle) (org-babel-lilypond-execute-tangled-ly) (org-babel-lilypond-compile-lilyfile) (org-babel-lilypond-check-for-compile-error) (org-babel-lilypond-process-compile-error) (org-babel-lilypond-mark-error-line) (org-babel-lilypond-parse-error-line) (org-babel-lilypond-attempt-to-open-pdf) (org-babel-lilypond-attempt-to-play-midi) (org-babel-lilypond-switch-extension) (org-babel-lilypond-set-header-args): * lisp/org/ob-lua.el (org-babel-prep-session:lua): * lisp/org/ob-picolisp.el (org-babel-execute:picolisp): * lisp/org/ob-processing.el (org-babel-prep-session:processing): * lisp/org/ob-python.el (org-babel-prep-session:python): * lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message) (org-babel-scheme-execute-with-geiser, org-babel-execute:scheme): * lisp/org/ob-shen.el (org-babel-execute:shen): * lisp/org/org-agenda.el (org-agenda-entry-types) (org-agenda-move-date-from-past-immediately-to-today) (org-agenda-time-grid, org-agenda-sorting-strategy) (org-agenda-filter-by-category, org-agenda-forward-block): * lisp/org/org-colview.el (org-columns--overlay-text): * lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces): * lisp/org/org-indent.el (org-indent-set-line-properties): * lisp/org/org-macs.el (org-get-limited-outline-regexp): * lisp/org/org-mobile.el (org-mobile-files): * lisp/org/org.el (org-use-fast-todo-selection) (org-extend-today-until, org-use-property-inheritance) (org-refresh-effort-properties, org-open-at-point-global) (org-track-ordered-property-with-tag, org-shiftright): * lisp/org/ox-html.el (org-html-checkbox-type): * lisp/org/ox-man.el (org-man-source-highlight) (org-man-verse-block): * lisp/org/ox-publish.el (org-publish-sitemap-default): * lisp/outline.el (outline-head-from-level): * lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1) (dcl-calc-command-indent, dcl-indent-to): * lisp/progmodes/flymake.el (flymake-make-diagnostic) (flymake--overlays, flymake-diagnostic-functions) (flymake-diagnostic-types-alist, flymake--backend-state) (flymake-is-running, flymake--collect, flymake-mode): * lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop) (gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer): * lisp/progmodes/grep.el (grep-error-screen-columns): * lisp/progmodes/gud.el (gud-prev-expr): * lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column) (ps-run-goto-error): * lisp/progmodes/python.el (python-eldoc-get-doc) (python-eldoc-function-timeout-permanent, python-eldoc-function): * lisp/shadowfile.el (shadow-make-group): * lisp/speedbar.el (speedbar-obj-do-check): * lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook): * lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib): * lisp/textmodes/reftex-index.el (reftex-index-goto-entry) (reftex-index-kill, reftex-index-undo): * lisp/textmodes/reftex-parse.el (reftex-context-substring): * lisp/textmodes/reftex.el (reftex-TeX-master-file): * lisp/textmodes/rst.el (rst-next-hdr, rst-toc) (rst-uncomment-region, rst-font-lock-extend-region-internal): * lisp/thumbs.el (thumbs-mode): * lisp/vc/ediff-util.el (ediff-restore-diff): * lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag): * lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p): * lisp/wid-edit.el (widget-field-value-set, string): * lisp/x-dnd.el (x-dnd-version-from-flags) (x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
NET is a symbol indicating to which network from `erc-networks-alist'
this server corresponds,
HOST is the server's hostname, and (TLS-)PORTS is either a
number, a list of numbers, or a list of port ranges."
:package-version '(ERC . "5.6") ; FIXME sync on release
:type '(alist :key-type (string :tag "Name")
:value-type
(group symbol (string :tag "Hostname")
(choice :tag "Ports"
(integer :tag "Port number")
(repeat :tag "List of ports or ranges"
(choice (integer :tag "Port number")
(list :tag "Port range"
integer integer))))
(choice :tag "TLS ports"
(integer :tag "TLS port number")
(repeat :tag "List of TLS ports or ranges"
(choice (integer :tag "TLS port number")
(list :tag "TLS port range"
integer integer)))))))
(make-obsolete-variable 'erc-server-alist
"specify `:server' with `erc-tls'." "30.1")
(defcustom erc-networks-alist
'((4-irc "4-irc.com")
(A5KNet "a5knet.com")
(AbleNet "ablenet.org")
(Accessirc "accessirc.net")
(Acestar "acestar.org")
(Action-IRC "action-irc.net")
(AfterNET "afternet.org")
(Alternativenet "altnet.org")
(AmigaNet "amiganet.org")
(AngelEyez "angeleyez.net")
(Anothernet "another.net")
(ArabChat "arabchat.org")
(Ars "arstechnica.com")
(AsiaTalk "asiatalk.org")
(AstroLink "astrolink.org")
(Asylumnet "asylumnet.org")
(Austnet "austnet.org")
(AwesomeChat "awesomechat.net")
(Awesomechristians "awesomechristians.com")
(Axenet "axenet.org")
(Beyondirc "beyondirc.net")
(BGIRC "bulgaria.org")
(Blabbernet "blabber.net")
(Blitzed "blitzed.org")
(BrasIRC "brasirc.net")
(BRASnet "brasnet.org")
(BubbleNet "bubblenet.org")
(CCnet "christian-chat.net")
(Chat-Net "chat-net.org")
(Chat-Solutions "chat-solutions.org")
(Chatcafe "chatcafe.net")
(Chatchannel "chatchannel.org")
(ChatCircuit "chatcircuit.com")
(Chatlink "chatlink.org")
(Chatnet "chatnet.org")
(ChatNut "chatnut.net")
(Chatpinoy "chatpinoy.com")
(ChatPR "chatpr.org")
(Chatroom "chatroom.org")
(Chatster "chatster.org")
(ChatX "chatx.net")
(China263 "263.net")
(Cineplex1 "cineplex1.com")
(CNN "cnn.com")
(CobraNet "cobra.net")
(Coolchat "coolchat.net")
(Criten "criten.net")
(Cyberchat "cyberchat.org")
(CyGanet "cyga.net")
(DALnet "dal.net")
(Dark-Tou-Net "d-t-net.de")
(Darkfire "darkfire.net")
(DarkMyst "darkmyst.org")
(Darkserv "darkserv.net")
(Darksystem "darksystem.com")
(Darktree "darktree.net")
(DayNet "daynet.org")
(Deepspace "deepspace.org")
(Different "different.net")
(Digarix "digarix.net")
(Digatech "digatech.net")
(Digital-Base "digital-base.net")
(Digitalirc "digitalirc.net")
(Discussioni "discussioni.org")
(DorukNet "doruk.net.tr")
(DWChat "dwchat.net")
(Dynastynet "dynastynet.net")
(EFnet nil)
(EgyptianIRC "egyptianirc.net")
(Eircnet "eircnet.org")
(Eleethal "eleethal.com")
(EntertheGame "enterthegame.com")
(EpiKnet "epiknet.org")
(EsperNet "esper.net")
(Esprit "esprit.net")
(euIRC "euirc.net")
(Evilzinc "evilzinc.net")
(ExodusIRC "exodusirc.net")
(FDFnet "fdfnet.net")
(FEFnet "fef.net")
(Financialchat "financialchat.com")
(Forestnet "forestnet.org")
(ForeverChat "foreverchat.net")
(Fraggers "fraggers.co.uk")
(FreedomChat "freedomchat.net")
(FreedomIRC "freedomirc.net")
(freenode "freenode.net")
(FunNet "funnet.org")
(GalaxyNet "galaxynet.org")
(Gamesnet "gamesnet.net")
(GammaForce "gammaforce.org")
(GIKInet "giki.edu.pk")
(GizNet "giznet.org")
(Globalchat "globalchat.org")
(GlobIRC "globirc.net")
(Goldchat "goldchat.nl")
(Goodchatting "goodchatting.com")
(GravityLords "gravitylords.net")
(GRnet "irc.gr")
(GulfChat "gulfchat.net")
(HabberNet "habber.net")
(HanIRC "hanirc.org")
(Hellenicnet "mirc.gr")
(IceNet "icenet.org.za")
(ICQnet "icq.com")
(iip "anon.iip")
(Infatech "infatech.net")
(Infinity "infinity-irc.org")
(Infomatrix "infomatrix.net")
(Inside3D "inside3d.net")
(InterlinkChat "interlinkchat.net")
(IRC-Chile "irc.cl")
(IRC-Hispano "irc-hispano.org")
(IRCchat "ircchat.tk")
(IRCGate "ircgate.net")
(IRCGeeks "ircgeeks.org")
(IRChat "irchat.net")
(IrcLordz "irclordz.com")
(IrcMalta "ircmalta.org")
(IRCnet nil)
(IRCSoulZ "ircsoulz.net")
(IRCSul "wnet.com.br")
(IrcTalk "irctalk.net")
(Irctoo "irctoo.net")
(IRCtown "irc.irctown.net")
(IRCworld "ircworld.org")
(ircXtreme "ircXtreme.net")
(Israelnet "israel.net")
(K0wNet "k0w.net")
(KDFSnet "kdfs.net")
(Kemik "kemik.net")
(Kewl\.Org "kewl.org")
(Kickchat "kickchat.com")
(KidsWorld "kidsworld.org")
(Knightnet "knightnet.net")
(Konfido\.Net "konfido.net")
(Kreynet "krey.net")
(Krono "krono.net")
(Krushnet "krushnet.org")
(LagNet "lagnet.org.za")
(Libera.Chat "libera.chat")
(Librenet "librenet.net")
(LinkNet "link-net.org")
Fix several backslash typos in Elisp strings * lisp/calendar/todo-mode.el (todo-files, todo-rename-file) (todo-find-filtered-items-file, todo-reset-nondiary-marker) (todo-reset-done-string, todo-reset-comment-string) (todo-reset-highlight-item): * lisp/erc/erc-networks.el (erc-networks-alist): * lisp/gnus/gnus-art.el (gnus-button-handle-library): * lisp/gnus/gnus-group.el (gnus-read-ephemeral-gmane-group-url): * lisp/gnus/nntp.el (nntp-via-shell-prompt) (nntp-telnet-shell-prompt): * lisp/gnus/spam-report.el (spam-report-gmane-regex): * lisp/image-dired.el (image-dired-rotate-original): (image-dired-get-exif-file-name): * lisp/international/latin1-disp.el (latin1-display-ucs-per-lynx): * lisp/mail/undigest.el (rmail-digest-parse-rfc1153strict): * lisp/mh-e/mh-letter.el (mh-file-is-vcard-p): * lisp/mh-e/mh-mime.el (mh-file-mime-type-substitutions): * lisp/net/shr-color.el (shr-color->hexadecimal): * lisp/org/org-bibtex.el (org-bibtex-fields): * lisp/org/org-docview.el (org-docview-export): * lisp/org/org-entities.el (org-entities): * lisp/org/ox-icalendar.el (org-icalendar-cleanup-string): * lisp/progmodes/cperl-mode.el (cperl-indent-exp): * lisp/progmodes/ebnf2ps.el (ebnf-file-suffix-regexp) (ebnf-style-database): * lisp/progmodes/idlw-help.el (idlwave-do-context-help1): * lisp/progmodes/ruby-mode.el (ruby-imenu-create-index-in-block): * lisp/progmodes/sql.el (sql-product-alist): * lisp/progmodes/verilog-mode.el (verilog-error-regexp-emacs-alist) (verilog-error-font-lock-keywords) (verilog-assignment-operator-re): * lisp/progmodes/vhdl-mode.el (vhdl-compiler-alist): * lisp/textmodes/reftex-parse.el (reftex-parse-from-file): * lisp/vc/add-log.el (change-log-version-number-regexp-list): Fix typo by replacing ‘\’ with ‘\\’ in a string literal. For example, to get the regular expression ‘\.’ use the string literal "\\.", not "\." (which is equivalent to "."). * lisp/emulation/viper-util.el (viper-glob-unix-files): Remove stray ‘\j’ from string. * lisp/gnus/nntp.el (nntp-via-shell-prompt) (nntp-telnet-shell-prompt): Treat > like $ when matching a shell prompt. * lisp/progmodes/make-mode.el (makefile-browse): Properly quote a diagnostic.
2015-09-17 12:28:45 -07:00
(LinuxChix "cats\\.meow\\.at\\|linuxchix\\.org")
(Liquidized "liquidized.net")
(M-IRC "m-sys.org")
(MagicStar "magicstar.net")
(Mavra "mavra.net")
(MediaDriven "mediadriven.com")
(mIRC-X "mircx.com")
(Morat "morat.net")
(MusicCity "musiccity.com")
(Mysteria "mysteria.net")
(Mysterychat "mysterychat.net")
(Mystical "mystical.net")
(Narancs "narancs.com")
(Net-France "net-france.com")
(Nevernet "nevernet.net")
(Newnet "newnet.net")
(Nexusirc "nexusirc.org")
(NightStar "nightstar.net")
(NitrousNet "nitrousnet.net")
(Novernet "novernet.com")
(Nullrouted "nullrouted.org")
(NullusNet "nullus.net")
(OFTC "oftc.net")
(OpChat "opchat.org")
(Openprojects "openprojects.net")
(Othernet "othernet.org")
(OtherSide "othersideirc.net")
(Outsiderz "outsiderz.com")
(OzOrg "oz.org")
(Peacefulhaven "peacefulhaven.net")
(PhazedIRC "phazedirc.net")
(Philchat "philchat.net")
(phrozN "phrozn.net")
(PiNet "praetorians.org")
(Pinoycentral "abs-cbn.com")
(Planetarion "planetarion.com")
(POLNet "ircnet.pl")
(Psionics "psionics.net")
(PTirc "ptirc.com.pt")
(PTlink "ptlink.net")
(PTnet "ptnet.org")
(QChat "qchat.net")
(QuakeNet "quakenet.org")
(Realirc "realirc.org")
(RealmNET "realmnet.com")
(Rebelchat "rebelchat.org")
(Red-Latina "red-latina.org")
(RedLatona "redlatona.net")
(Relicnet "relic.net")
(Rezosup "rezosup.org")
(Risanet "risanet.com")
(Rubiks "rubiks.net")
(Rusnet "nil")
(Sandnet "sandnet.net")
(Scunc "scunc.net")
(SerbianCafe "serbiancafe.ws")
(SexNet "sexnet.org")
(ShadowFire "shadowfire.org")
(ShadowWorld "shadowworld.net")
(SkyNet "bronowski.pl")
(SlashNET "slashnet.org")
(SolarStone "solarstone.net")
(Sorcery "sorcery.net")
(SourceIRC "sourceirc.net")
(SpaceTronix "spacetronix.net")
(Spirit-Harmony "spirit-harmony.com")
(StarChat "starchat.net")
(StarEquinox "starequinox.net")
(Starlink "starlink.net")
(starlink-irc "starlink-irc.org")
(StarWars-IRC "starwars-irc.net")
(Stormdancing "stormdancing.net")
(Superchat "superchat.org")
(Sysopnet "sysopnet.org")
(Telstra "telstra.com")
(TR-net "dominet.com.tr")
(Tri-net "tri-net.org")
(TriLink "ft4u.net")
(TurkishChat "turkishchat.org")
(UberNinja "uberninja.net")
(UICN "uicn.net")
(UltraIRC "ultrairc.net")
(UnderChat "underchat.it")
(Undernet "undernet.org")
(UnderZ "underz.org")
(UniChat "irc.uni-chat.net")
(UnionLatina "unionlatina.org")
(Univers "univers.org")
(UnixR "unixr.net")
(Vidgamechat "vidgamechat.com")
(VirtuaNet "virtuanet.org")
(Vitamina "vitamina.ca")
(Voila "voila.fr")
(Wahou "wf-net.org")
(Warpednet "warped.net")
(Weaklinks "weaklinks.net")
(Webnet "webchat.org")
(WinChat "winchat.net")
(WinIRC "winirc.org")
(WorldIRC "worldirc.org")
(WyldRyde "wyldryde.net")
(XentoniX "xentonix.net")
(Xevion "xevion.net")
(XNet "xnet.org")
(XWorld "xworld.org")
(ZAnetNet "zanet.net")
(ZAnetOrg "zanet.org.za")
(ZiRC "zirc.org")
(ZUHnet "zuh.net")
(Zurna "zurna.net"))
lisp/*.el: Fix typos and other trivial doc fixes * lisp/allout-widgets.el (allout-widgets-auto-activation) (allout-current-decorated-p): * lisp/auth-source.el (auth-source-protocols): * lisp/autorevert.el (auto-revert-set-timer): * lisp/battery.el (battery-mode-line-limit): * lisp/calc/calcalg3.el (math-map-binop): * lisp/calendar/cal-dst.el (calendar-dst-find-startend): * lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute): * lisp/calendar/calendar.el (calendar-date-echo-text) (calendar-generate-month, calendar-string-spread) (calendar-cursor-to-date, calendar-read, calendar-read-date) (calendar-mark-visible-date, calendar-dayname-on-or-before): * lisp/calendar/diary-lib.el (diary-ordinal-suffix): * lisp/cedet/ede/autoconf-edit.el (autoconf-new-program) (autoconf-find-last-macro, autoconf-parameter-strip): * lisp/cedet/ede/config.el (ede-target-with-config-build): * lisp/cedet/ede/linux.el (ede-linux--detect-architecture) (ede-linux--get-architecture): * lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache) (semantic-displayer-abstract, semantic-displayer-point-position): * lisp/cedet/semantic/format.el (semantic-format-face-alist) (semantic-format-tag-short-doc): * lisp/cedet/semantic/fw.el (semantic-find-file-noselect): * lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time) (semantic-idle-breadcrumbs-display-function) (semantic-idle-breadcrumbs-format-tag-list-function): * lisp/cedet/semantic/lex.el (semantic-lex-map-types) (define-lex, define-lex-block-type-analyzer): * lisp/cedet/semantic/senator.el (senator-search-default-tag-filter): * lisp/cedet/semantic/symref.el (semantic-symref-result) (semantic-symref-hit-to-tag-via-db): * lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass): * lisp/cedet/semantic/tag.el (semantic-tag-new-variable) (semantic-tag-new-include, semantic-tag-new-package) (semantic-tag-set-faux, semantic-create-tag-proxy) (semantic-tag-function-parent) (semantic-tag-components-with-overlays): * lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces) (srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict): * lisp/cedet/srecode/dictionary.el (srecode-create-dictionary) (srecode-dictionary-add-entries, srecode-dictionary-lookup-name) (srecode-create-dictionaries-from-tags): * lisp/cmuscheme.el (scheme-compile-region): * lisp/color.el (color-lab-to-lch): * lisp/doc-view.el (doc-view-image-width) (doc-view-set-up-single-converter): * lisp/dynamic-setting.el (font-setting-change-default-font) (dynamic-setting-handle-config-changed-event): * lisp/elec-pair.el (electric-pair-text-pairs) (electric-pair-skip-whitespace-function) (electric-pair-string-bound-function): * lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance) (avl-tree-member, avl-tree-mapcar, avl-tree-iter): * lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree): * lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag) (checkdoc-spellcheck-documentation-flag, checkdoc-ispell) (checkdoc-ispell-current-buffer, checkdoc-ispell-interactive) (checkdoc-ispell-message-interactive) (checkdoc-ispell-message-text, checkdoc-ispell-start) (checkdoc-ispell-continue, checkdoc-ispell-comments) (checkdoc-ispell-defun): * lisp/emacs-lisp/cl-generic.el (cl--generic-search-method): * lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group): * lisp/emacs-lisp/lisp.el (forward-sexp, up-list): * lisp/emacs-lisp/package-x.el (package--archive-contents-from-file): * lisp/emacs-lisp/package.el (package-desc) (package--make-autoloads-and-stuff, package-hidden-regexps): * lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup): * lisp/emacs-lisp/testcover.el (testcover-nohits) (testcover-1value): * lisp/epg.el (epg-receive-keys, epg-start-edit-key): * lisp/erc/erc-backend.el (erc-server-processing-p) (erc-split-line-length, erc-server-coding-system) (erc-server-send, erc-message): * lisp/erc/erc-button.el (erc-button-face, erc-button-alist) (erc-browse-emacswiki): * lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login): * lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation): * lisp/erc/erc-log.el (erc-current-logfile): * lisp/erc/erc-match.el (erc-log-match-format) (erc-text-matched-hook): * lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug): * lisp/erc/erc-networks.el (erc-server-alist) (erc-networks-alist, erc-current-network): * lisp/erc/erc-ring.el (erc-input-ring-index): * lisp/erc/erc-speedbar.el (erc-speedbar) (erc-speedbar-update-channel): * lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag): * lisp/erc/erc-track.el (erc-track-position-in-mode-line) (erc-track-remove-from-mode-line, erc-modified-channels-update) (erc-track-last-non-erc-buffer, erc-track-sort-by-importance) (erc-track-get-active-buffer): * lisp/erc/erc.el (erc-get-channel-user-list) (erc-echo-notice-hook, erc-echo-notice-always-hook) (erc-wash-quit-reason, erc-format-@nick): * lisp/ffap.el (ffap-latex-mode): * lisp/files.el (abort-if-file-too-large) (dir-locals--get-sort-score, buffer-stale--default-function): * lisp/filesets.el (filesets-tree-max-level, filesets-data) (filesets-update-pre010505): * lisp/gnus/gnus-agent.el (gnus-agent-flush-cache): * lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol) (gnus-button-prefer-mid-or-mail): * lisp/gnus/gnus-cus.el (gnus-group-parameters): * lisp/gnus/gnus-demon.el (gnus-demon-handlers) (gnus-demon-run-callback): * lisp/gnus/gnus-dired.el (gnus-dired-print): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer): * lisp/gnus/gnus-range.el (gnus-range-normalize): * lisp/gnus/gnus-spec.el (gnus-pad-form): * lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud) (gnus-server-opened, gnus-server-closed, gnus-server-denied) (gnus-server-offline): * lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir) (gnus-refer-thread-limit-to-thread) (gnus-summary-limit-include-thread, gnus-summary-refer-thread) (gnus-summary-find-matching): * lisp/gnus/gnus-util.el (gnus-rescale-image): * lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server): * lisp/gnus/mail-source.el (mail-source-incoming-file-prefix): * lisp/gnus/message.el (message-cite-reply-position) (message-cite-style-outlook, message-cite-style-thunderbird) (message-cite-style-gmail, message--send-mail-maybe-partially): * lisp/gnus/mm-extern.el (mm-inline-external-body): * lisp/gnus/mm-partial.el (mm-inline-partial): * lisp/gnus/mml-sec.el (mml-secure-message-sign) (mml-secure-message-sign-encrypt, mml-secure-message-encrypt): * lisp/gnus/mml2015.el (mml2015-epg-key-image) (mml2015-epg-key-image-to-string): * lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail): * lisp/gnus/nnheader.el (nnheader-directory-files-is-safe): * lisp/gnus/nnir.el (nnir-search-history) (nnir-imap-search-other, nnir-artlist-length) (nnir-artlist-article, nnir-artitem-group, nnir-artitem-number) (nnir-artitem-rsv, nnir-article-group, nnir-article-number) (nnir-article-rsv, nnir-article-ids, nnir-categorize) (nnir-retrieve-headers-override-function) (nnir-imap-default-search-key, nnir-hyrex-additional-switches) (gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms) (nnir-read-parm, nnir-read-server-parm, nnir-search-thread): * lisp/gnus/nnmairix.el (nnmairix-default-group) (nnmairix-propagate-marks): * lisp/gnus/smime.el (smime-keys, smime-crl-check) (smime-verify-buffer, smime-noverify-buffer): * lisp/gnus/spam-report.el (spam-report-url-ping-mm-url): * lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header) (spam-spamassassin-spam-status-header, spam-sa-learn-rebuild) (spam-classifications, spam-check-stat, spam-spamassassin-score): * lisp/help.el (describe-minor-mode-from-symbol): * lisp/hippie-exp.el (hippie-expand-ignore-buffers): * lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face) (hfy-begin-span): * lisp/ibuf-ext.el (ibuffer-update-saved-filters-format) (ibuffer-saved-filters, ibuffer-old-saved-filters-warning) (ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters) (eval, ibuffer-unary-operand, file-extension, directory): * lisp/image-dired.el (image-dired-cmd-pngcrush-options): * lisp/image-mode.el (image-toggle-display): * lisp/international/ccl.el (ccl-compile-read-multibyte-character) (ccl-compile-write-multibyte-character): * lisp/international/kkc.el (kkc-save-init-file): * lisp/international/latin1-disp.el (latin1-display): * lisp/international/ogonek.el (ogonek-name-encoding-alist) (ogonek-information, ogonek-lookup-encoding) (ogonek-deprefixify-region): * lisp/isearch.el (isearch-filter-predicate) (isearch--momentary-message): * lisp/jsonrpc.el (jsonrpc-connection-send) (jsonrpc-process-connection, jsonrpc-shutdown) (jsonrpc--async-request-1): * lisp/language/tibet-util.el (tibetan-char-p): * lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date) (feedmail-last-chance-hook, feedmail-before-fcc-hook) (feedmail-send-it-immediately-wrapper, feedmail-find-eoh): * lisp/mail/hashcash.el (hashcash-generate-payment) (hashcash-generate-payment-async, hashcash-insert-payment) (hashcash-verify-payment): * lisp/mail/rmail.el (rmail-movemail-variant-in-use) (rmail-get-attr-value): * lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime): * lisp/mail/rmailsum.el (rmail-summary-show-message): * lisp/mail/supercite.el (sc-raw-mode-toggle): * lisp/man.el (Man-start-calling): * lisp/mh-e/mh-acros.el (mh-do-at-event-location) (mh-iterate-on-messages-in-region, mh-iterate-on-range): * lisp/mh-e/mh-alias.el (mh-alias-system-aliases) (mh-alias-reload, mh-alias-ali) (mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file) (mh-alias-add-alias): * lisp/mouse.el (mouse-save-then-kill): * lisp/net/browse-url.el (browse-url-default-macosx-browser): * lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value) (eudc-variable-server-value, eudc-update-variable) (eudc-expand-inline): * lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): * lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list): * lisp/net/pop3.el (pop3-list): * lisp/net/soap-client.el (soap-namespace-put) (soap-xs-parse-sequence, soap-parse-envelope): * lisp/net/soap-inspect.el (soap-inspect-xs-complex-type): * lisp/nxml/rng-xsd.el (rng-xsd-date-to-days): * lisp/org/ob-C.el (org-babel-prep-session:C) (org-babel-load-session:C): * lisp/org/ob-J.el (org-babel-execute:J): * lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote): * lisp/org/ob-awk.el (org-babel-execute:awk): * lisp/org/ob-core.el (org-babel-process-file-name): * lisp/org/ob-ebnf.el (org-babel-execute:ebnf): * lisp/org/ob-forth.el (org-babel-execute:forth): * lisp/org/ob-fortran.el (org-babel-execute:fortran) (org-babel-prep-session:fortran, org-babel-load-session:fortran): * lisp/org/ob-groovy.el (org-babel-execute:groovy): * lisp/org/ob-io.el (org-babel-execute:io): * lisp/org/ob-js.el (org-babel-execute:js): * lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond) (org-babel-lilypond-compile-post-tangle) (org-babel-lilypond-display-pdf-post-tangle) (org-babel-lilypond-tangle) (org-babel-lilypond-execute-tangled-ly) (org-babel-lilypond-compile-lilyfile) (org-babel-lilypond-check-for-compile-error) (org-babel-lilypond-process-compile-error) (org-babel-lilypond-mark-error-line) (org-babel-lilypond-parse-error-line) (org-babel-lilypond-attempt-to-open-pdf) (org-babel-lilypond-attempt-to-play-midi) (org-babel-lilypond-switch-extension) (org-babel-lilypond-set-header-args): * lisp/org/ob-lua.el (org-babel-prep-session:lua): * lisp/org/ob-picolisp.el (org-babel-execute:picolisp): * lisp/org/ob-processing.el (org-babel-prep-session:processing): * lisp/org/ob-python.el (org-babel-prep-session:python): * lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message) (org-babel-scheme-execute-with-geiser, org-babel-execute:scheme): * lisp/org/ob-shen.el (org-babel-execute:shen): * lisp/org/org-agenda.el (org-agenda-entry-types) (org-agenda-move-date-from-past-immediately-to-today) (org-agenda-time-grid, org-agenda-sorting-strategy) (org-agenda-filter-by-category, org-agenda-forward-block): * lisp/org/org-colview.el (org-columns--overlay-text): * lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces): * lisp/org/org-indent.el (org-indent-set-line-properties): * lisp/org/org-macs.el (org-get-limited-outline-regexp): * lisp/org/org-mobile.el (org-mobile-files): * lisp/org/org.el (org-use-fast-todo-selection) (org-extend-today-until, org-use-property-inheritance) (org-refresh-effort-properties, org-open-at-point-global) (org-track-ordered-property-with-tag, org-shiftright): * lisp/org/ox-html.el (org-html-checkbox-type): * lisp/org/ox-man.el (org-man-source-highlight) (org-man-verse-block): * lisp/org/ox-publish.el (org-publish-sitemap-default): * lisp/outline.el (outline-head-from-level): * lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1) (dcl-calc-command-indent, dcl-indent-to): * lisp/progmodes/flymake.el (flymake-make-diagnostic) (flymake--overlays, flymake-diagnostic-functions) (flymake-diagnostic-types-alist, flymake--backend-state) (flymake-is-running, flymake--collect, flymake-mode): * lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop) (gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer): * lisp/progmodes/grep.el (grep-error-screen-columns): * lisp/progmodes/gud.el (gud-prev-expr): * lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column) (ps-run-goto-error): * lisp/progmodes/python.el (python-eldoc-get-doc) (python-eldoc-function-timeout-permanent, python-eldoc-function): * lisp/shadowfile.el (shadow-make-group): * lisp/speedbar.el (speedbar-obj-do-check): * lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook): * lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib): * lisp/textmodes/reftex-index.el (reftex-index-goto-entry) (reftex-index-kill, reftex-index-undo): * lisp/textmodes/reftex-parse.el (reftex-context-substring): * lisp/textmodes/reftex.el (reftex-TeX-master-file): * lisp/textmodes/rst.el (rst-next-hdr, rst-toc) (rst-uncomment-region, rst-font-lock-extend-region-internal): * lisp/thumbs.el (thumbs-mode): * lisp/vc/ediff-util.el (ediff-restore-diff): * lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag): * lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p): * lisp/wid-edit.el (widget-field-value-set, string): * lisp/x-dnd.el (x-dnd-version-from-flags) (x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
"Alist of IRC networks.
Each network is a list (NET MATCHER) where
NET is a symbol naming that IRC network and
lisp/*.el: Fix typos and other trivial doc fixes * lisp/allout-widgets.el (allout-widgets-auto-activation) (allout-current-decorated-p): * lisp/auth-source.el (auth-source-protocols): * lisp/autorevert.el (auto-revert-set-timer): * lisp/battery.el (battery-mode-line-limit): * lisp/calc/calcalg3.el (math-map-binop): * lisp/calendar/cal-dst.el (calendar-dst-find-startend): * lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute): * lisp/calendar/calendar.el (calendar-date-echo-text) (calendar-generate-month, calendar-string-spread) (calendar-cursor-to-date, calendar-read, calendar-read-date) (calendar-mark-visible-date, calendar-dayname-on-or-before): * lisp/calendar/diary-lib.el (diary-ordinal-suffix): * lisp/cedet/ede/autoconf-edit.el (autoconf-new-program) (autoconf-find-last-macro, autoconf-parameter-strip): * lisp/cedet/ede/config.el (ede-target-with-config-build): * lisp/cedet/ede/linux.el (ede-linux--detect-architecture) (ede-linux--get-architecture): * lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache) (semantic-displayer-abstract, semantic-displayer-point-position): * lisp/cedet/semantic/format.el (semantic-format-face-alist) (semantic-format-tag-short-doc): * lisp/cedet/semantic/fw.el (semantic-find-file-noselect): * lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time) (semantic-idle-breadcrumbs-display-function) (semantic-idle-breadcrumbs-format-tag-list-function): * lisp/cedet/semantic/lex.el (semantic-lex-map-types) (define-lex, define-lex-block-type-analyzer): * lisp/cedet/semantic/senator.el (senator-search-default-tag-filter): * lisp/cedet/semantic/symref.el (semantic-symref-result) (semantic-symref-hit-to-tag-via-db): * lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass): * lisp/cedet/semantic/tag.el (semantic-tag-new-variable) (semantic-tag-new-include, semantic-tag-new-package) (semantic-tag-set-faux, semantic-create-tag-proxy) (semantic-tag-function-parent) (semantic-tag-components-with-overlays): * lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces) (srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict): * lisp/cedet/srecode/dictionary.el (srecode-create-dictionary) (srecode-dictionary-add-entries, srecode-dictionary-lookup-name) (srecode-create-dictionaries-from-tags): * lisp/cmuscheme.el (scheme-compile-region): * lisp/color.el (color-lab-to-lch): * lisp/doc-view.el (doc-view-image-width) (doc-view-set-up-single-converter): * lisp/dynamic-setting.el (font-setting-change-default-font) (dynamic-setting-handle-config-changed-event): * lisp/elec-pair.el (electric-pair-text-pairs) (electric-pair-skip-whitespace-function) (electric-pair-string-bound-function): * lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance) (avl-tree-member, avl-tree-mapcar, avl-tree-iter): * lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree): * lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag) (checkdoc-spellcheck-documentation-flag, checkdoc-ispell) (checkdoc-ispell-current-buffer, checkdoc-ispell-interactive) (checkdoc-ispell-message-interactive) (checkdoc-ispell-message-text, checkdoc-ispell-start) (checkdoc-ispell-continue, checkdoc-ispell-comments) (checkdoc-ispell-defun): * lisp/emacs-lisp/cl-generic.el (cl--generic-search-method): * lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group): * lisp/emacs-lisp/lisp.el (forward-sexp, up-list): * lisp/emacs-lisp/package-x.el (package--archive-contents-from-file): * lisp/emacs-lisp/package.el (package-desc) (package--make-autoloads-and-stuff, package-hidden-regexps): * lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup): * lisp/emacs-lisp/testcover.el (testcover-nohits) (testcover-1value): * lisp/epg.el (epg-receive-keys, epg-start-edit-key): * lisp/erc/erc-backend.el (erc-server-processing-p) (erc-split-line-length, erc-server-coding-system) (erc-server-send, erc-message): * lisp/erc/erc-button.el (erc-button-face, erc-button-alist) (erc-browse-emacswiki): * lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login): * lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation): * lisp/erc/erc-log.el (erc-current-logfile): * lisp/erc/erc-match.el (erc-log-match-format) (erc-text-matched-hook): * lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug): * lisp/erc/erc-networks.el (erc-server-alist) (erc-networks-alist, erc-current-network): * lisp/erc/erc-ring.el (erc-input-ring-index): * lisp/erc/erc-speedbar.el (erc-speedbar) (erc-speedbar-update-channel): * lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag): * lisp/erc/erc-track.el (erc-track-position-in-mode-line) (erc-track-remove-from-mode-line, erc-modified-channels-update) (erc-track-last-non-erc-buffer, erc-track-sort-by-importance) (erc-track-get-active-buffer): * lisp/erc/erc.el (erc-get-channel-user-list) (erc-echo-notice-hook, erc-echo-notice-always-hook) (erc-wash-quit-reason, erc-format-@nick): * lisp/ffap.el (ffap-latex-mode): * lisp/files.el (abort-if-file-too-large) (dir-locals--get-sort-score, buffer-stale--default-function): * lisp/filesets.el (filesets-tree-max-level, filesets-data) (filesets-update-pre010505): * lisp/gnus/gnus-agent.el (gnus-agent-flush-cache): * lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol) (gnus-button-prefer-mid-or-mail): * lisp/gnus/gnus-cus.el (gnus-group-parameters): * lisp/gnus/gnus-demon.el (gnus-demon-handlers) (gnus-demon-run-callback): * lisp/gnus/gnus-dired.el (gnus-dired-print): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer): * lisp/gnus/gnus-range.el (gnus-range-normalize): * lisp/gnus/gnus-spec.el (gnus-pad-form): * lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud) (gnus-server-opened, gnus-server-closed, gnus-server-denied) (gnus-server-offline): * lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir) (gnus-refer-thread-limit-to-thread) (gnus-summary-limit-include-thread, gnus-summary-refer-thread) (gnus-summary-find-matching): * lisp/gnus/gnus-util.el (gnus-rescale-image): * lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server): * lisp/gnus/mail-source.el (mail-source-incoming-file-prefix): * lisp/gnus/message.el (message-cite-reply-position) (message-cite-style-outlook, message-cite-style-thunderbird) (message-cite-style-gmail, message--send-mail-maybe-partially): * lisp/gnus/mm-extern.el (mm-inline-external-body): * lisp/gnus/mm-partial.el (mm-inline-partial): * lisp/gnus/mml-sec.el (mml-secure-message-sign) (mml-secure-message-sign-encrypt, mml-secure-message-encrypt): * lisp/gnus/mml2015.el (mml2015-epg-key-image) (mml2015-epg-key-image-to-string): * lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail): * lisp/gnus/nnheader.el (nnheader-directory-files-is-safe): * lisp/gnus/nnir.el (nnir-search-history) (nnir-imap-search-other, nnir-artlist-length) (nnir-artlist-article, nnir-artitem-group, nnir-artitem-number) (nnir-artitem-rsv, nnir-article-group, nnir-article-number) (nnir-article-rsv, nnir-article-ids, nnir-categorize) (nnir-retrieve-headers-override-function) (nnir-imap-default-search-key, nnir-hyrex-additional-switches) (gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms) (nnir-read-parm, nnir-read-server-parm, nnir-search-thread): * lisp/gnus/nnmairix.el (nnmairix-default-group) (nnmairix-propagate-marks): * lisp/gnus/smime.el (smime-keys, smime-crl-check) (smime-verify-buffer, smime-noverify-buffer): * lisp/gnus/spam-report.el (spam-report-url-ping-mm-url): * lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header) (spam-spamassassin-spam-status-header, spam-sa-learn-rebuild) (spam-classifications, spam-check-stat, spam-spamassassin-score): * lisp/help.el (describe-minor-mode-from-symbol): * lisp/hippie-exp.el (hippie-expand-ignore-buffers): * lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face) (hfy-begin-span): * lisp/ibuf-ext.el (ibuffer-update-saved-filters-format) (ibuffer-saved-filters, ibuffer-old-saved-filters-warning) (ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters) (eval, ibuffer-unary-operand, file-extension, directory): * lisp/image-dired.el (image-dired-cmd-pngcrush-options): * lisp/image-mode.el (image-toggle-display): * lisp/international/ccl.el (ccl-compile-read-multibyte-character) (ccl-compile-write-multibyte-character): * lisp/international/kkc.el (kkc-save-init-file): * lisp/international/latin1-disp.el (latin1-display): * lisp/international/ogonek.el (ogonek-name-encoding-alist) (ogonek-information, ogonek-lookup-encoding) (ogonek-deprefixify-region): * lisp/isearch.el (isearch-filter-predicate) (isearch--momentary-message): * lisp/jsonrpc.el (jsonrpc-connection-send) (jsonrpc-process-connection, jsonrpc-shutdown) (jsonrpc--async-request-1): * lisp/language/tibet-util.el (tibetan-char-p): * lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date) (feedmail-last-chance-hook, feedmail-before-fcc-hook) (feedmail-send-it-immediately-wrapper, feedmail-find-eoh): * lisp/mail/hashcash.el (hashcash-generate-payment) (hashcash-generate-payment-async, hashcash-insert-payment) (hashcash-verify-payment): * lisp/mail/rmail.el (rmail-movemail-variant-in-use) (rmail-get-attr-value): * lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime): * lisp/mail/rmailsum.el (rmail-summary-show-message): * lisp/mail/supercite.el (sc-raw-mode-toggle): * lisp/man.el (Man-start-calling): * lisp/mh-e/mh-acros.el (mh-do-at-event-location) (mh-iterate-on-messages-in-region, mh-iterate-on-range): * lisp/mh-e/mh-alias.el (mh-alias-system-aliases) (mh-alias-reload, mh-alias-ali) (mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file) (mh-alias-add-alias): * lisp/mouse.el (mouse-save-then-kill): * lisp/net/browse-url.el (browse-url-default-macosx-browser): * lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value) (eudc-variable-server-value, eudc-update-variable) (eudc-expand-inline): * lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): * lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list): * lisp/net/pop3.el (pop3-list): * lisp/net/soap-client.el (soap-namespace-put) (soap-xs-parse-sequence, soap-parse-envelope): * lisp/net/soap-inspect.el (soap-inspect-xs-complex-type): * lisp/nxml/rng-xsd.el (rng-xsd-date-to-days): * lisp/org/ob-C.el (org-babel-prep-session:C) (org-babel-load-session:C): * lisp/org/ob-J.el (org-babel-execute:J): * lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote): * lisp/org/ob-awk.el (org-babel-execute:awk): * lisp/org/ob-core.el (org-babel-process-file-name): * lisp/org/ob-ebnf.el (org-babel-execute:ebnf): * lisp/org/ob-forth.el (org-babel-execute:forth): * lisp/org/ob-fortran.el (org-babel-execute:fortran) (org-babel-prep-session:fortran, org-babel-load-session:fortran): * lisp/org/ob-groovy.el (org-babel-execute:groovy): * lisp/org/ob-io.el (org-babel-execute:io): * lisp/org/ob-js.el (org-babel-execute:js): * lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond) (org-babel-lilypond-compile-post-tangle) (org-babel-lilypond-display-pdf-post-tangle) (org-babel-lilypond-tangle) (org-babel-lilypond-execute-tangled-ly) (org-babel-lilypond-compile-lilyfile) (org-babel-lilypond-check-for-compile-error) (org-babel-lilypond-process-compile-error) (org-babel-lilypond-mark-error-line) (org-babel-lilypond-parse-error-line) (org-babel-lilypond-attempt-to-open-pdf) (org-babel-lilypond-attempt-to-play-midi) (org-babel-lilypond-switch-extension) (org-babel-lilypond-set-header-args): * lisp/org/ob-lua.el (org-babel-prep-session:lua): * lisp/org/ob-picolisp.el (org-babel-execute:picolisp): * lisp/org/ob-processing.el (org-babel-prep-session:processing): * lisp/org/ob-python.el (org-babel-prep-session:python): * lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message) (org-babel-scheme-execute-with-geiser, org-babel-execute:scheme): * lisp/org/ob-shen.el (org-babel-execute:shen): * lisp/org/org-agenda.el (org-agenda-entry-types) (org-agenda-move-date-from-past-immediately-to-today) (org-agenda-time-grid, org-agenda-sorting-strategy) (org-agenda-filter-by-category, org-agenda-forward-block): * lisp/org/org-colview.el (org-columns--overlay-text): * lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces): * lisp/org/org-indent.el (org-indent-set-line-properties): * lisp/org/org-macs.el (org-get-limited-outline-regexp): * lisp/org/org-mobile.el (org-mobile-files): * lisp/org/org.el (org-use-fast-todo-selection) (org-extend-today-until, org-use-property-inheritance) (org-refresh-effort-properties, org-open-at-point-global) (org-track-ordered-property-with-tag, org-shiftright): * lisp/org/ox-html.el (org-html-checkbox-type): * lisp/org/ox-man.el (org-man-source-highlight) (org-man-verse-block): * lisp/org/ox-publish.el (org-publish-sitemap-default): * lisp/outline.el (outline-head-from-level): * lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1) (dcl-calc-command-indent, dcl-indent-to): * lisp/progmodes/flymake.el (flymake-make-diagnostic) (flymake--overlays, flymake-diagnostic-functions) (flymake-diagnostic-types-alist, flymake--backend-state) (flymake-is-running, flymake--collect, flymake-mode): * lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop) (gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer): * lisp/progmodes/grep.el (grep-error-screen-columns): * lisp/progmodes/gud.el (gud-prev-expr): * lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column) (ps-run-goto-error): * lisp/progmodes/python.el (python-eldoc-get-doc) (python-eldoc-function-timeout-permanent, python-eldoc-function): * lisp/shadowfile.el (shadow-make-group): * lisp/speedbar.el (speedbar-obj-do-check): * lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook): * lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib): * lisp/textmodes/reftex-index.el (reftex-index-goto-entry) (reftex-index-kill, reftex-index-undo): * lisp/textmodes/reftex-parse.el (reftex-context-substring): * lisp/textmodes/reftex.el (reftex-TeX-master-file): * lisp/textmodes/rst.el (rst-next-hdr, rst-toc) (rst-uncomment-region, rst-font-lock-extend-region-internal): * lisp/thumbs.el (thumbs-mode): * lisp/vc/ediff-util.el (ediff-restore-diff): * lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag): * lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p): * lisp/wid-edit.el (widget-field-value-set, string): * lisp/x-dnd.el (x-dnd-version-from-flags) (x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-21 00:27:53 +02:00
MATCHER is used to find a corresponding network to a server while
connected to it. If it is regexp, it's used to match against
`erc-server-announced-name'. It can also be a function (predicate).
Then it is executed with the server buffer as current buffer."
:type '(repeat
(list :tag "Network"
(symbol :tag "Network name")
(choice :tag "Network's common server ending"
(regexp)
(const :tag "Network has no common server ending" nil)))))
Prefer defvar-local in erc * lisp/erc/erc-backend.el (erc-server-current-nick) (erc-server-process, erc-session-server, erc-session-connector) (erc-session-port, erc-server-announced-name) (erc-server-version, erc-server-parameters) (erc-server-connected, erc-server-reconnect-count) (erc-server-quitting, erc-server-reconnecting) (erc-server-timed-out, erc-server-banned) (erc-server-error-occurred, erc-server-lines-sent) (erc-server-last-peers, erc-server-last-sent-time) (erc-server-last-ping-time, erc-server-last-received-time) (erc-server-lag, erc-server-filter-data, erc-server-duplicates) (erc-server-processing-p, erc-server-flood-last-message) (erc-server-flood-queue, erc-server-flood-timer) (erc-server-ping-handler): * lisp/erc/erc-capab.el (erc-capab-identify-activated) (erc-capab-identify-sent): * lisp/erc/erc-dcc.el (erc-dcc-byte-count, erc-dcc-entry-data) (erc-dcc-file-name): * lisp/erc/erc-ezbounce.el (erc-ezb-session-list): * lisp/erc/erc-join.el (erc--autojoin-timer): * lisp/erc/erc-netsplit.el (erc-netsplit-list): * lisp/erc/erc-networks.el (erc-network): * lisp/erc/erc-notify.el (erc-last-ison, erc-last-ison-time): * lisp/erc/erc-ring.el (erc-input-ring, erc-input-ring-index): * lisp/erc/erc-stamp.el (erc-timestamp-last-inserted) (erc-timestamp-last-inserted-left) (erc-timestamp-last-inserted-right): * lisp/erc/erc.el (erc-session-password, erc-channel-users) (erc-server-users, erc-channel-topic, erc-channel-modes) (erc-insert-marker, erc-input-marker, erc-last-saved-position) (erc-dbuf, erc-active-buffer, erc-default-recipients) (erc-session-user-full-name, erc-channel-user-limit) (erc-channel-key, erc-invitation, erc-channel-list) (erc-bad-nick, erc-logged-in, erc-default-nicks) (erc-nick-change-attempt-count, erc-send-input-line-function) (erc-channel-new-member-names, erc-channel-banlist) (erc-current-message-catalog): Prefer defvar-local.
2021-01-31 03:19:41 +01:00
(defvar-local erc-network nil
"The name of the network you are connected to (a symbol).")
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;;;; Identifying session context
;; This section is concerned with identifying and managing the
;; relationship between an IRC connection and its unique identity on a
;; given network (as seen by that network's nick-granting system).
;; This relationship is quasi-permanent and transcends IRC connections
;; and Emacs sessions. As of mid 2022, only nicknames matter, and
;; whether a user is authenticated does not directly impact network
;; identity from a client's perspective. However, ERC must be
;; equipped to adapt should this ever change. And while a connection
;; is normally associated with exactly one nick, some networks (or
;; intermediaries) may allow multiple clients to control the same nick
;; by combining instance activity into a single logical client. ERC
;; must be limber enough to handle such situations.
(defvar-local erc-networks--id nil
"Server-local instance of its namesake struct.
Also shared among all target buffers for a given connection. See
\\[describe-symbol] `erc-networks--id' for more.")
(cl-defstruct erc-networks--id
"Persistent identifying info for a network presence.
Here, \"presence\" refers to some local state representing a
client's existence on a network. Some clients refer to this as a
\"context\" or a \"net-id\". The management of this state
involves tracking associated buffers and what they're displaying.
Since a presence can outlast physical connections and survive
changes in back-end transports (and even outlive Emacs sessions),
its identity must be resilient.
Essential to this notion of an enduring existence on a network is
ensuring recovery from the loss of a server buffer. Thus, any
useful identifier must be shared among server and target buffers
to allow for reassociation. Beyond that, it must ideally be
derivable from the same set of connection parameters. See the
constructor `erc-networks--id-create' for more info."
(ts nil :type float :read-only t :documentation "Creation timestamp.")
(symbol nil :type symbol :documentation "ID as a symbol."))
(cl-defstruct (erc-networks--id-fixed
(:include erc-networks--id)
(:constructor erc-networks--id-fixed-create
(given &aux (ts (float-time)) (symbol given)))))
(cl-defstruct (erc-networks--id-qualifying
(:include erc-networks--id)
(:constructor erc-networks--id-qualifying-create
(&aux
(ts (float-time))
(parts (erc-networks--id-qualifying-init-parts))
(symbol (erc-networks--id-qualifying-init-symbol
parts))
(len 1))))
"A session context composed of hierarchical connection parameters.
Two identifiers are considered equivalent when their non-empty
`parts' slots compare equal. Related identifiers share a common
prefix of `parts' taken from connection parameters (given or
discovered). An identifier's unique `symbol', intended for
display purposes, is created by concatenating the shortest common
prefix among its relatives. For example, related presences [b a
r d o] and [b a z a r] would have symbols b/a/r and b/a/z
respectively. The separator is given by `erc-networks--id-sep'."
(parts nil :type sequence ; a vector of atoms
:documentation "Sequence of identifying components.")
(len 0 :type integer
:documentation "Length of active `parts' interval."))
;; For now, please use this instead of `erc-networks--id-fixed-p'.
(cl-defgeneric erc-networks--id-given (net-id)
"Return the preassigned identifier for a network context, if any.
When non-nil, assume NET-ID originated from an `:id' argument to
entry-point commands `erc-tls' or `erc'.")
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(cl-defmethod erc-networks--id-given (_) nil) ; _ may be nil
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(cl-defmethod erc-networks--id-given ((nid erc-networks--id-fixed))
(erc-networks--id-symbol nid))
(cl-generic-define-context-rewriter erc-obsolete-var (var spec)
Move ERC's core dependencies to separate file Asking people to order require's is about as effective as asking kids to keep off the grass. * lisp/erc/erc-backend.el (erc--target, erc-auto-query, erc-channel-list, erc-channel-users, erc-default-nicks, erc-default-recipients, erc-format-nick-function, erc-format-query-as-channel-p, erc-hide-prompt, erc-input-marker, erc-insert-marker, erc-invitation, erc-join-buffer, erc-kill-buffer-on-part, erc-kill-server-buffer-on-quit, erc-log-p, erc-minibuffer-ignored, erc-networks--id, erc-nick, erc-nick-change-attempt-count, erc-prompt-for-channel-key, erc-prompt-hidden, erc-reuse-buffers, erc-verbose-server-ping, erc-whowas-on-nosuchnick): Forward-declare variables. (erc--open-target, erc--target-from-string, erc-active-buffer, erc-add-default-channel, erc-banlist-update, erc-buffer-filter, erc-buffer-list-with-nick, erc-channel-begin-receiving-names, erc-channel-end-receiving-names, erc-channel-p, erc-channel-receive-names, erc-cmd-JOIN, erc-connection-established, erc-current-nick, erc-current-nick-p, erc-current-time, erc-default-target, erc-delete-default-channel, erc-display-error-notice, erc-display-server-message, erc-emacs-time-to-erc-time, erc-format-message, erc-format-privmessage, erc-get-buffer, erc-handle-login, erc-handle-user-status-change, erc-ignored-reply-p, erc-ignored-user-p, erc-is-message-ctcp-and-not-action-p, erc-is-message-ctcp-p, erc-log-irc-protocol, erc-login, erc-make-notice, erc-network, erc-networks--id-given, erc-networks--id-reload, erc-nickname-in-use, erc-parse-user, erc-process-away, erc-process-ctcp-query, erc-query-buffer-p, erc-remove-channel-member, erc-remove-channel-users, erc-remove-user, erc-sec-to-time, erc-server-buffer, erc-set-active-buffer, erc-set-current-nick, erc-set-modes, erc-time-diff, erc-trim-string, erc-update-mode-line, erc-update-mode-line-buffer, erc-wash-quit-reason, erc-display-message, erc-get-buffer-create, erc-process-ctcp-reply, erc-update-channel-topic, erc-update-modes, erc-update-user-nick, erc-open, erc-update-channel-member): Forward-declare functions. (erc-response): Move to lisp/erc/erc-common.el. (erc-compat--with-memoization): Use "erc-compat-" prefixed macro. * lisp/erc/erc-common.el: New file. Change indentation for `erc-with-all-buffers-of-server' from 1 to 2. * lisp/erc/erc-compat.el (erc-compat--with-memoization): Migrate macro from `erc-backend' and rename. * lisp/erc/erc-goodies.el: Require `erc-common' instead of `erc'. (erc-controls-highlight-regexp, erc-controls-remove-regexp, erc-input-marker, erc-insert-marker, erc-server-process, erc-modules, erc-log-p): Forward declare variables. (erc-buffer-list, erc-error, erc-extract-command-from-line): Forward-declare functions. * lisp/erc/erc-networks.el (erc--target, erc-insert-marker, erc-kill-buffer-hook, erc-kill-server-hook, erc-modules, erc-rename-buffers, erc-reuse-buffers, erc-server-announced-name, erc-server-connected, erc-server-parameters, erc-server-process, erc-session-server): Forward declare variables. (erc--default-target, erc--get-isupport-entry, erc-buffer-filter, erc-current-nick, erc-display-error-notice, erc-error, erc-get-buffer, erc-server-buffer, erc-server-process-alive): Forward-declare functions. (erc-obsolete-var): Also suppress free-variable warnings. * lisp/erc/erc.el: Require `erc-networks', `erc-goodies', and `erc-backend' at top of file. Don't require `erc-compat'. (erc--server-last-reconnect-count, erc--server-reconnecting, erc-channel-members-changed-hook, erc-network, erc-networks--id, erc-server-367-functions, erc-server-announced-name, erc-server-connect-function, erc-server-connected, erc-server-current-nick, erc-server-lag, erc-server-last-sent-time, erc-server-process, erc-server-quitting, erc-server-reconnect-count, erc-server-reconnecting, erc-session-client-certificate, erc-session-connector, erc-session-port, erc-session-server, erc-session-user-full-name) Remove superfluous forward declarations. (erc-message-parsed, tabbar--local-hlf, motif-version-string): Relocate forward declares to central location. (erc-session-password): Move to `erc-backend'. (erc-downcase, erc-with-server-buffer, erc-server-user, erc-channel-user, erc-get-channel-user, erc-get-server-user): Move to lisp/erc/erc-common.el. (erc-add-server-user, erc-remove-server-user, erc-channel-user-owner-p, erc-channel-user-admin-p, erc-channel-user-op-p, erc-channel-user-halfop-p, erc-channel-user-voice-p): Convert from inline functions to normal functions. (define-erc-module, erc--target, erc--target-channel, erc--target-channel-local, erc-log, erc-log-aux, erc-with-buffer, erc-with-all-buffers-of-server): Move to lisp/erc/erc-common.el. (erc-channel-members-changed-hook): Relocate option to avoid compiler warning. (erc-input, erc--input-split): Move to lisp/erc/erc-common.el. (erc-controls-strip): Remove forward declaration temporarily until this file stops requiring `erc-goodies'. * test/lisp/erc/erc-networks-tests.el: Require `erc' instead of `erc-networks'. * test/lisp/erc/erc.el (erc--meta--backend-dependencies): Remove obsolete test. Don't require `erc-networks'. Bug#56340.
2022-07-01 11:06:51 -04:00
`((with-suppressed-warnings ((obsolete ,var) (free-vars ,var)) ,var) ,spec))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;; As a catch-all, derive the symbol from the unquoted printed repr.
(cl-defgeneric erc-networks--id-create (id)
"Invoke an appropriate constructor for an `erc-networks--id' object."
(erc-networks--id-fixed-create (intern (format "%s" id))))
;; When a given ID is a symbol, trust it unequivocally.
(cl-defmethod erc-networks--id-create ((id symbol))
(erc-networks--id-fixed-create id))
;; Otherwise, use an adaptive name derived from network params.
(cl-defmethod erc-networks--id-create ((_ null))
(erc-networks--id-qualifying-create))
;; But honor an explicitly set `erc-rename-buffers' (compat).
(cl-defmethod erc-networks--id-create
((_ null) &context (erc-obsolete-var erc-rename-buffers null))
(erc-networks--id-fixed-create (intern (buffer-name))))
;; But honor an explicitly set `erc-reuse-buffers' (compat).
(cl-defmethod erc-networks--id-create
((_ null) &context (erc-obsolete-var erc-reuse-buffers null))
(erc-networks--id-fixed-create (intern (buffer-name))))
(cl-defmethod erc-networks--id-create
((_ symbol) &context (erc-obsolete-var erc-reuse-buffers null))
(erc-networks--id-fixed-create (intern (buffer-name))))
(cl-defgeneric erc-networks--id-equal-p (self other)
"Return non-nil when two network IDs exhibit underlying equality.
Expect SELF and OTHER to be `erc-networks--id' struct instances
and that this will only be called for ID recovery or merging,
after which no two identities should be `equal' (timestamps
aside) that aren't also `eq'.")
(cl-defmethod erc-networks--id-equal-p ((_ null) (_ erc-networks--id)) nil)
(cl-defmethod erc-networks--id-equal-p ((_ erc-networks--id) (_ null)) nil)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(cl-defmethod erc-networks--id-equal-p ((self erc-networks--id)
(other erc-networks--id))
(eq self other))
(cl-defmethod erc-networks--id-equal-p ((a erc-networks--id-fixed)
(b erc-networks--id-fixed))
(or (eq a b) (eq (erc-networks--id-symbol a) (erc-networks--id-symbol b))))
(cl-defmethod erc-networks--id-equal-p ((a erc-networks--id-qualifying)
(b erc-networks--id-qualifying))
(or (eq a b) (equal (erc-networks--id-qualifying-parts a)
(erc-networks--id-qualifying-parts b))))
;; ERASE-ME: if some future extension were to come along offering
;; additional members, e.g., [Libera.Chat "bob" laptop], it'd likely
;; be cleaner to create a new struct type descending from
;; `erc-networks--id-qualifying' than to convert this function into a
;; generic. However, the latter would be simpler because it'd just
;; require something like &context (erc-v3-device erc-v3--device-t).
(defun erc-networks--id-qualifying-init-parts ()
"Return opaque list of atoms to serve as canonical identifier."
(when-let ((network (erc-network))
(nick (erc-current-nick)))
(vector network (erc-downcase nick))))
(defvar erc-networks--id-sep "/"
"Separator for joining `erc-networks--id-qualifying-parts' into a net ID.")
(defun erc-networks--id-qualifying-init-symbol (elts &optional len)
"Return symbol appropriate for network context identified by ELTS.
Use leading interval of length LEN as contributing components.
Combine them with string separator `erc-networks--id-sep'."
(when elts
(unless len
(setq len 1))
(intern (mapconcat (lambda (s) (prin1-to-string s t))
(seq-subseq elts 0 len)
erc-networks--id-sep))))
(defun erc-networks--id-qualifying-grow-id (nid)
"Grow NID by one component or return nil when at capacity."
(unless (= (length (erc-networks--id-qualifying-parts nid))
(erc-networks--id-qualifying-len nid))
(setf (erc-networks--id-symbol nid)
(erc-networks--id-qualifying-init-symbol
(erc-networks--id-qualifying-parts nid)
(cl-incf (erc-networks--id-qualifying-len nid))))))
(defun erc-networks--id-qualifying-reset-id (nid)
"Restore NID to its initial state."
(setf (erc-networks--id-qualifying-len nid) 1
(erc-networks--id-symbol nid)
(erc-networks--id-qualifying-init-symbol
(erc-networks--id-qualifying-parts nid))))
(defun erc-networks--id-qualifying-prefix-length (nid-a nid-b)
"Return length of common initial prefix of NID-A and NID-B.
Return nil when no such sequence exists (instead of zero)."
(when-let* ((a (erc-networks--id-qualifying-parts nid-a))
(b (erc-networks--id-qualifying-parts nid-b))
(n (min (length a) (length b)))
((> n 0))
((equal (elt a 0) (elt b 0)))
(i 1))
(while (and (< i n)
(equal (elt a i)
(elt b i)))
(cl-incf i))
i))
(defun erc-networks--id-qualifying-update (dest source &rest overrides)
"Update DEST from SOURCE in place.
Copy slots into DEST from SOURCE and recompute ID. Both SOURCE
and DEST must be `erc-networks--id' objects. OVERRIDES is an
optional plist of SLOT VAL pairs."
(setf (erc-networks--id-qualifying-parts dest)
(or (plist-get overrides :parts)
(erc-networks--id-qualifying-parts source))
(erc-networks--id-qualifying-len dest)
(or (plist-get overrides :len)
(erc-networks--id-qualifying-len source))
(erc-networks--id-symbol dest)
(or (plist-get overrides :symbol)
(erc-networks--id-qualifying-init-symbol
(erc-networks--id-qualifying-parts dest)
(erc-networks--id-qualifying-len dest)))))
(cl-defgeneric erc-networks--id-reload (_nid &optional _proc _parsed)
"Handle an update to the current network identity.
If provided, PROC should be the current `erc-server-process' and
PARSED the current `erc-response'. NID is an `erc-networks--id'
object."
nil)
(cl-defmethod erc-networks--id-reload ((nid erc-networks--id-qualifying)
&optional proc parsed)
"Refresh identity after an `erc-networks--id-qualifying-parts'update."
(erc-networks--id-qualifying-update nid (erc-networks--id-qualifying-create)
:len
(erc-networks--id-qualifying-len nid))
(erc-networks--rename-server-buffer (or proc erc-server-process) parsed)
(erc-networks--shrink-ids-and-buffer-names-any)
(erc-with-all-buffers-of-server
erc-server-process #'erc--default-target
(when-let* ((new-name (erc-networks--reconcile-buffer-names erc--target
nid))
((not (equal (buffer-name) new-name))))
(rename-buffer new-name 'unique))))
(cl-defgeneric erc-networks--id-ensure-comparable (self other)
"Take measures to ensure two net identities are in comparable states.")
(cl-defmethod erc-networks--id-ensure-comparable ((_ erc-networks--id)
(_ erc-networks--id))
nil)
(cl-defmethod erc-networks--id-ensure-comparable
((nid erc-networks--id-qualifying) (other erc-networks--id-qualifying))
"Grow NID along with that of the current buffer.
Rename the current buffer if its NID has grown."
(when-let ((n (erc-networks--id-qualifying-prefix-length other nid)))
(while (and (<= (erc-networks--id-qualifying-len nid) n)
(erc-networks--id-qualifying-grow-id nid)))
;; Grow and rename a visited buffer and all its targets
(when (and (> (erc-networks--id-qualifying-len nid)
(erc-networks--id-qualifying-len other))
(erc-networks--id-qualifying-grow-id other))
;; Rename NID's buffers using current ID
(erc-buffer-filter (lambda ()
(when (eq erc-networks--id other)
(erc-networks--maybe-update-buffer-name)))))))
(defun erc-networks--id-sort-buffers (buffers)
"Return a list of target BUFFERS, newest to oldest."
(sort buffers
(lambda (a b)
(> (erc-networks--id-ts (buffer-local-value 'erc-networks--id a))
(erc-networks--id-ts (buffer-local-value 'erc-networks--id b))))))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;;;; Buffer association
(cl-defgeneric erc-networks--shrink-ids-and-buffer-names ()
nil) ; concrete default implementation for non-eliding IDs
(defun erc-networks--refresh-buffer-names (identity &optional omit)
"Ensure all colliding buffers for network IDENTITY have suffixes.
Then rename current buffer appropriately. Don't consider buffer OMIT
when determining collisions."
(if (erc-networks--examine-targets identity erc--target
#'ignore
(lambda ()
(unless (or (not omit) (eq (current-buffer) omit))
(erc-networks--ensure-unique-target-buffer-name)
t)))
(erc-networks--ensure-unique-target-buffer-name)
(rename-buffer (erc--target-string erc--target) 'unique)))
;; This currently doesn't equalize related identities that may have
;; become mismatched because that shouldn't happen after a connection
;; is up (other than for a brief moment while renicking or similar,
;; when states are inconsistent).
(defun erc-networks--shrink-ids-and-buffer-names-any (&rest omit)
(let (grown)
;; Gather all grown identities.
(erc-buffer-filter
(lambda ()
(when (and erc-networks--id
(erc-networks--id-qualifying-p erc-networks--id)
(not (memq (current-buffer) omit))
(not (memq erc-networks--id grown))
(> (erc-networks--id-qualifying-len erc-networks--id) 1))
(push erc-networks--id grown))))
;; Check for other identities with shared prefix. If none exists,
;; and an identity is overlong, shrink it.
(dolist (nid grown)
(let ((skip (not (null omit))))
(catch 'found
(if (cdr grown)
(dolist (other grown)
(unless (eq nid other)
(setq skip nil)
(when (erc-networks--id-qualifying-prefix-length nid other)
(throw 'found (setq skip t)))))
(setq skip nil)))
(unless (or skip (< (erc-networks--id-qualifying-len nid) 2))
(erc-networks--id-qualifying-reset-id nid)
(erc-buffer-filter
(lambda ()
(when (and (eq erc-networks--id nid)
(not (memq (current-buffer) omit)))
(if erc--target
(erc-networks--refresh-buffer-names nid omit)
(erc-networks--maybe-update-buffer-name))))))))))
(cl-defmethod erc-networks--shrink-ids-and-buffer-names
(&context (erc-networks--id erc-networks--id-qualifying))
(erc-networks--shrink-ids-and-buffer-names-any (current-buffer)))
(defun erc-networks-rename-surviving-target-buffer ()
"Maybe drop qualifying suffix from fellow target-buffer's name.
But only do so when there's a single survivor with a target
matching that of the dying buffer."
(when-let*
(((with-suppressed-warnings ((obsolete erc-reuse-buffers))
erc-reuse-buffers))
(target erc--target)
;; Buffer name includes ID suffix
((not (string= (erc--target-symbol target) ; string= t "t" -> t
(erc-downcase (buffer-name)))))
(buf (current-buffer))
;; All buffers, not just those belonging to same process
(others (erc-buffer-filter
(lambda ()
(and-let* ((erc--target)
((not (eq buf (current-buffer))))
((eq (erc--target-symbol target)
(erc--target-symbol erc--target))))))))
((not (cdr others))))
(with-current-buffer (car others)
(unless (get-buffer (erc--target-string target))
(rename-buffer (erc--target-string target))))))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(defun erc-networks-shrink-ids-and-buffer-names ()
"Recompute network IDs and buffer names, ignoring the current buffer.
Only do so when an IRC connection's context supports qualified
naming. Do not discriminate based on whether a buffer's
connection is active."
(erc-networks--shrink-ids-and-buffer-names))
(defun erc-networks--examine-targets (identity target on-dupe on-collision)
"Visit all ERC target buffers with the same TARGET.
Call ON-DUPE when a buffer's identity belongs to a network
IDENTITY or \"should\" after reconciliation. Call ON-COLLISION
otherwise. Neither function should accept any args. Expect
TARGET to be an `erc--target' object."
(declare (indent 2))
(let ((announced erc-server-announced-name))
(erc-buffer-filter
(lambda ()
(when (and erc--target (eq (erc--target-symbol erc--target)
(erc--target-symbol target)))
(let ((oursp (if (erc--target-channel-local-p target)
(equal announced erc-server-announced-name)
(erc-networks--id-equal-p identity erc-networks--id))))
(funcall (if oursp on-dupe on-collision))))))))
(defconst erc-networks--qualified-sep "@"
"Separator used for naming a target buffer.")
(defun erc-networks--construct-target-buffer-name (target)
"Return TARGET@suffix."
(concat (erc--target-string target)
(if (with-suppressed-warnings ((obsolete erc-reuse-buffers))
erc-reuse-buffers)
erc-networks--qualified-sep "/")
(cond
((not (with-suppressed-warnings ((obsolete erc-reuse-buffers))
erc-reuse-buffers))
(cadr (split-string
(symbol-name (erc-networks--id-symbol erc-networks--id))
"/")))
((erc--target-channel-local-p target) erc-server-announced-name)
(t (symbol-name (erc-networks--id-symbol erc-networks--id))))))
(defun erc-networks--ensure-unique-target-buffer-name ()
(when-let* ((new-name (erc-networks--construct-target-buffer-name
erc--target))
((not (equal (buffer-name) new-name))))
(rename-buffer new-name 'unique)))
(defun erc-networks--ensure-unique-server-buffer-name ()
(when-let* ((new-name (symbol-name (erc-networks--id-symbol
erc-networks--id)))
((not (equal (buffer-name) new-name))))
(rename-buffer new-name 'unique)))
(defun erc-networks--maybe-update-buffer-name ()
"Update current buffer name to reflect display ID if necessary."
(if erc--target
(erc-networks--ensure-unique-target-buffer-name)
(erc-networks--ensure-unique-server-buffer-name)))
(defun erc-networks--reconcile-buffer-names (target nid)
"Reserve preferred buffer name for TARGET and network identifier.
Expect TARGET to be an `erc--target' instance. Guarantee that at
most one existing buffer has the same `erc-networks--id' and a
case-mapped target, i.e., `erc--target-symbol'. If other buffers
with equivalent targets exist, rename them to TARGET@their-NID
and return TARGET@our-NID. Otherwise return TARGET as a string.
When multiple buffers for TARGET exist for the current NID,
rename them with <n> suffixes going from newest to oldest."
(let* (existing ; Former selves or unexpected dupes (for now allow > 1)
;; Renamed ERC buffers on other networks matching target
(namesakes (erc-networks--examine-targets nid target
(lambda () (push (current-buffer) existing) nil)
;; Append network ID as TARGET@NID,
;; possibly qualifying to achieve uniqueness.
(lambda ()
(unless (erc--target-channel-local-p erc--target)
(erc-networks--id-ensure-comparable
nid erc-networks--id))
(erc-networks--ensure-unique-target-buffer-name)
t)))
;; Must follow ^ because NID may have been modified
(name (if (or namesakes (not (with-suppressed-warnings
((obsolete erc-reuse-buffers))
erc-reuse-buffers)))
(erc-networks--construct-target-buffer-name target)
(erc--target-string target)))
placeholder)
;; If we don't exist, claim name temporarily while renaming others
(when-let* ((ex (get-buffer name))
((not (memq ex existing))))
(if namesakes ; if namesakes is nonempty, it contains ex
(with-current-buffer ex
(let ((temp-name (generate-new-buffer-name (format "*%s*" name))))
(rename-buffer temp-name)
(setq placeholder (get-buffer-create name))
(rename-buffer name 'unique)))
;; Here, ex must be a server buffer or a non-ERC buffer
(setq name (erc-networks--construct-target-buffer-name target))))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(unless (with-suppressed-warnings ((obsolete erc-reuse-buffers))
erc-reuse-buffers)
(when (string-suffix-p ">" name)
(setq name (string-trim-right name (rx "<" (+ digit) ">")))))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(dolist (ex (erc-networks--id-sort-buffers existing))
(with-current-buffer ex
(rename-buffer name 'unique)))
(when placeholder (kill-buffer placeholder))
name))
;; Functions:
;;;###autoload
(defun erc-determine-network ()
lisp/*.el: Fix typos and improve some docstrings * lisp/auth-source.el (auth-source-backend-parse-parameters) (auth-source-search-collection) (auth-source-secrets-listify-pattern) (auth-source--decode-octal-string, auth-source-plstore-search): * lisp/registry.el (registry-lookup) (registry-lookup-breaks-before-lexbind) (registry-lookup-secondary, registry-lookup-secondary-value) (registry-search, registry-delete, registry-size, registry-full) (registry-insert, registry-reindex, registry-prune) (registry-collect-prune-candidates): * lisp/subr.el (nbutlast, process-live-p): * lisp/tab-bar.el (tab-bar-list): * lisp/cedet/ede/linux.el (ede-linux--get-archs) (ede-linux--include-path, ede-linux-load): * lisp/erc/erc-log.el (erc-log-all-but-server-buffers): * lisp/erc/erc-pcomplete.el (pcomplete-erc-commands) (pcomplete-erc-ops, pcomplete-erc-not-ops, pcomplete-erc-nicks) (pcomplete-erc-all-nicks, pcomplete-erc-channels) (pcomplete-erc-command-name, pcomplete-erc-parse-arguments): * lisp/eshell/em-term.el (eshell-visual-command-p): * lisp/gnus/gnus-cache.el (gnus-cache-fully-p): * lisp/gnus/nnmail.el (nnmail-get-active) (nnmail-fancy-expiry-target): * lisp/mail/mail-utils.el (mail-string-delete): * lisp/mail/supercite.el (sc-hdr, sc-valid-index-p): * lisp/net/ange-ftp.el (ange-ftp-use-smart-gateway-p): * lisp/net/nsm.el (nsm-save-fingerprint-maybe) (nsm-network-same-subnet, nsm-should-check): * lisp/net/rcirc.el (rcirc-looking-at-input): * lisp/net/tramp-cache.el (tramp-get-hash-table): * lisp/net/tramp-compat.el (tramp-compat-process-running-p): * lisp/net/tramp-smb.el (tramp-smb-get-share) (tramp-smb-get-localname, tramp-smb-read-file-entry) (tramp-smb-get-cifs-capabilities, tramp-smb-get-stat-capability): * lisp/net/zeroconf.el (zeroconf-list-service-names) (zeroconf-list-service-types, zeroconf-list-services) (zeroconf-get-host, zeroconf-get-domain) (zeroconf-get-host-domain): * lisp/nxml/rng-xsd.el (rng-xsd-compile) (rng-xsd-make-date-time-regexp, rng-xsd-convert-date-time): * lisp/obsolete/erc-hecomplete.el (erc-hecomplete) (erc-command-list, erc-complete-at-prompt): * lisp/org/ob-scheme.el (org-babel-scheme-get-buffer-impl): * lisp/org/ob-shell.el (org-babel--variable-assignments:sh-generic) (org-babel--variable-assignments:bash_array) (org-babel--variable-assignments:bash_assoc) (org-babel--variable-assignments:bash): * lisp/org/org-clock.el (org-day-of-week): * lisp/progmodes/cperl-mode.el (cperl-char-ends-sub-keyword-p): * lisp/progmodes/gud.el (gud-find-c-expr, gud-innermost-expr) (gud-prev-expr, gud-next-expr): * lisp/textmodes/table.el (table--at-cell-p, table--probe-cell) (table--get-cell-justify-property) (table--get-cell-valign-property) (table--put-cell-justify-property) (table--put-cell-valign-property): Fix typos. * lisp/so-long.el (fboundp): Doc fix. (so-long-mode-line-info, so-long-mode) (so-long--check-header-modes): Fix typos. * lisp/emulation/viper-mous.el (viper-surrounding-word) (viper-mouse-click-get-word): Fix typos. (viper-mouse-click-search-word): Doc fix. * lisp/erc/erc-backend.el (erc-forward-word, erc-word-at-arg-p) (erc-bounds-of-word-at-point): Fix typos. (erc-decode-string-from-target, define-erc-response-handler): Refill docstring. * lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): Fix typo. (erc-dcc-get-host, erc-dcc-auto-mask-p, erc-dcc-get-file): Doc fixes. * lisp/erc/erc-networks.el (erc-network-name): Fix typo. (erc-determine-network): Refill docstring. * lisp/net/dbus.el (dbus-list-hash-table) (dbus-string-to-byte-array, dbus-byte-array-to-string) (dbus-check-event): Fix typos. (dbus-introspect-get-property): Doc fix. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler): Rename ARGS to ARGUMENTS. Doc fix. (tramp-adb-sh-fix-ls-output, tramp-adb-execute-adb-command) (tramp-adb-find-test-command): Fix typos. * lisp/net/tramp.el (tramp-set-completion-function) (tramp-get-completion-function) (tramp-completion-dissect-file-name) (tramp-completion-dissect-file-name1) (tramp-get-completion-methods, tramp-get-completion-user-host) (tramp-get-inode, tramp-get-device, tramp-mode-string-to-int) (tramp-call-process, tramp-call-process-region) (tramp-process-lines): Fix typos. (tramp-interrupt-process): Doc fix. * lisp/org/ob-core.el (org-babel-named-src-block-regexp-for-name) (org-babel-named-data-regexp-for-name): Doc fix. (org-babel-src-block-names, org-babel-result-names): Fix typos. * lisp/progmodes/inf-lisp.el (lisp-input-filter): Doc fix. (lisp-fn-called-at-pt): Fix typo. * lisp/progmodes/xref.el (xref-backend-identifier-at-point): Doc fix. (xref-backend-identifier-completion-table): Fix typo.
2019-10-20 12:12:27 +02:00
"Return the name of the network or \"Unknown\" as a symbol.
Use the server parameter NETWORK if provided, otherwise parse the
server name and search for a match in `erc-networks-alist'."
;; The server made it easy for us and told us the name of the NETWORK
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(declare (obsolete "maybe see `erc-networks--determine'" "29.1"))
(let ((network-name (cdr (assoc "NETWORK" erc-server-parameters))))
(if network-name
(intern network-name)
(or
;; Loop through `erc-networks-alist' looking for a match.
(let ((server (or erc-server-announced-name erc-session-server)))
(cl-loop for (name matcher) in erc-networks-alist
when (and matcher
(string-match (concat matcher "\\'") server))
do (cl-return name)))
'Unknown))))
(defun erc-network ()
"Return the value of `erc-network' for the current server."
(or erc-network (erc-with-server-buffer erc-network)))
(defun erc-network-name ()
lisp/*.el: Fix typos and improve some docstrings * lisp/auth-source.el (auth-source-backend-parse-parameters) (auth-source-search-collection) (auth-source-secrets-listify-pattern) (auth-source--decode-octal-string, auth-source-plstore-search): * lisp/registry.el (registry-lookup) (registry-lookup-breaks-before-lexbind) (registry-lookup-secondary, registry-lookup-secondary-value) (registry-search, registry-delete, registry-size, registry-full) (registry-insert, registry-reindex, registry-prune) (registry-collect-prune-candidates): * lisp/subr.el (nbutlast, process-live-p): * lisp/tab-bar.el (tab-bar-list): * lisp/cedet/ede/linux.el (ede-linux--get-archs) (ede-linux--include-path, ede-linux-load): * lisp/erc/erc-log.el (erc-log-all-but-server-buffers): * lisp/erc/erc-pcomplete.el (pcomplete-erc-commands) (pcomplete-erc-ops, pcomplete-erc-not-ops, pcomplete-erc-nicks) (pcomplete-erc-all-nicks, pcomplete-erc-channels) (pcomplete-erc-command-name, pcomplete-erc-parse-arguments): * lisp/eshell/em-term.el (eshell-visual-command-p): * lisp/gnus/gnus-cache.el (gnus-cache-fully-p): * lisp/gnus/nnmail.el (nnmail-get-active) (nnmail-fancy-expiry-target): * lisp/mail/mail-utils.el (mail-string-delete): * lisp/mail/supercite.el (sc-hdr, sc-valid-index-p): * lisp/net/ange-ftp.el (ange-ftp-use-smart-gateway-p): * lisp/net/nsm.el (nsm-save-fingerprint-maybe) (nsm-network-same-subnet, nsm-should-check): * lisp/net/rcirc.el (rcirc-looking-at-input): * lisp/net/tramp-cache.el (tramp-get-hash-table): * lisp/net/tramp-compat.el (tramp-compat-process-running-p): * lisp/net/tramp-smb.el (tramp-smb-get-share) (tramp-smb-get-localname, tramp-smb-read-file-entry) (tramp-smb-get-cifs-capabilities, tramp-smb-get-stat-capability): * lisp/net/zeroconf.el (zeroconf-list-service-names) (zeroconf-list-service-types, zeroconf-list-services) (zeroconf-get-host, zeroconf-get-domain) (zeroconf-get-host-domain): * lisp/nxml/rng-xsd.el (rng-xsd-compile) (rng-xsd-make-date-time-regexp, rng-xsd-convert-date-time): * lisp/obsolete/erc-hecomplete.el (erc-hecomplete) (erc-command-list, erc-complete-at-prompt): * lisp/org/ob-scheme.el (org-babel-scheme-get-buffer-impl): * lisp/org/ob-shell.el (org-babel--variable-assignments:sh-generic) (org-babel--variable-assignments:bash_array) (org-babel--variable-assignments:bash_assoc) (org-babel--variable-assignments:bash): * lisp/org/org-clock.el (org-day-of-week): * lisp/progmodes/cperl-mode.el (cperl-char-ends-sub-keyword-p): * lisp/progmodes/gud.el (gud-find-c-expr, gud-innermost-expr) (gud-prev-expr, gud-next-expr): * lisp/textmodes/table.el (table--at-cell-p, table--probe-cell) (table--get-cell-justify-property) (table--get-cell-valign-property) (table--put-cell-justify-property) (table--put-cell-valign-property): Fix typos. * lisp/so-long.el (fboundp): Doc fix. (so-long-mode-line-info, so-long-mode) (so-long--check-header-modes): Fix typos. * lisp/emulation/viper-mous.el (viper-surrounding-word) (viper-mouse-click-get-word): Fix typos. (viper-mouse-click-search-word): Doc fix. * lisp/erc/erc-backend.el (erc-forward-word, erc-word-at-arg-p) (erc-bounds-of-word-at-point): Fix typos. (erc-decode-string-from-target, define-erc-response-handler): Refill docstring. * lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): Fix typo. (erc-dcc-get-host, erc-dcc-auto-mask-p, erc-dcc-get-file): Doc fixes. * lisp/erc/erc-networks.el (erc-network-name): Fix typo. (erc-determine-network): Refill docstring. * lisp/net/dbus.el (dbus-list-hash-table) (dbus-string-to-byte-array, dbus-byte-array-to-string) (dbus-check-event): Fix typos. (dbus-introspect-get-property): Doc fix. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler): Rename ARGS to ARGUMENTS. Doc fix. (tramp-adb-sh-fix-ls-output, tramp-adb-execute-adb-command) (tramp-adb-find-test-command): Fix typos. * lisp/net/tramp.el (tramp-set-completion-function) (tramp-get-completion-function) (tramp-completion-dissect-file-name) (tramp-completion-dissect-file-name1) (tramp-get-completion-methods, tramp-get-completion-user-host) (tramp-get-inode, tramp-get-device, tramp-mode-string-to-int) (tramp-call-process, tramp-call-process-region) (tramp-process-lines): Fix typos. (tramp-interrupt-process): Doc fix. * lisp/org/ob-core.el (org-babel-named-src-block-regexp-for-name) (org-babel-named-data-regexp-for-name): Doc fix. (org-babel-src-block-names, org-babel-result-names): Fix typos. * lisp/progmodes/inf-lisp.el (lisp-input-filter): Doc fix. (lisp-fn-called-at-pt): Fix typo. * lisp/progmodes/xref.el (xref-backend-identifier-at-point): Doc fix. (xref-backend-identifier-completion-table): Fix typo.
2019-10-20 12:12:27 +02:00
"Return the name of the current network as a string."
(erc-with-server-buffer (symbol-name erc-network)))
lisp/erc: Use lexical-binding Also remove various redundant `:group` arguments. * lisp/erc/erc-backend.el (define-erc-response-handler): Move `declare` after the docstring. * lisp/erc/erc-capab.el: Use lexical-binding. (erc-capab-identify-activate): Simplify with `member`. * lisp/erc/erc-dcc.el (erc-dcc): Move before erc-dcc-mode definition, which refers to it. (erc-dcc-chat-accept): Remove unused vars `nick` and `buffer`. * lisp/erc/erc-imenu.el: Use lexical-binding. (erc-create-imenu-index): Remove unused var `prev-pos`. * lisp/erc/erc-match.el: Use lexical-binding. (erc-match-message): Remove unused var `old-pt`. (erc-match-message): Strength-reduce `eval` to `symbol-value`. * lisp/erc/erc-page.el: Use lexical-binding. (erc-page): Move Custom group before `erg-page-mode` which refers to it. * lisp/erc/erc-replace.el: Use lexical-binding. (erc-replace-insert): Use `functionp`. * lisp/erc/erc-status-sidebar.el: Use lexical-binding. (erc-status-sidebar-open): Remove unused var `sidebar-window`. * lisp/erc/erc.el: Fix header to use the customary 3 semi-colons. (erc-fill-column): Declare variable. * lisp/erc/erc-autoaway.el: Use lexical-binding. * lisp/erc/erc-ezbounce.el: Use lexical-binding. * lisp/erc/erc-fill.el: Use lexical-binding. * lisp/erc/erc-goodies.el: Use lexical-binding. * lisp/erc/erc-ibuffer.el: Use lexical-binding. * lisp/erc/erc-identd.el: Use lexical-binding. * lisp/erc/erc-join.el: Use lexical-binding. * lisp/erc/erc-lang.el: Use lexical-binding. * lisp/erc/erc-log.el: Use lexical-binding. * lisp/erc/erc-menu.el: Use lexical-binding. * lisp/erc/erc-netsplit.el: Use lexical-binding. * lisp/erc/erc-networks.el: Use lexical-binding. * lisp/erc/erc-pcomplete.el: Use lexical-binding. * lisp/erc/erc-ring.el: Use lexical-binding. * lisp/erc/erc-speedbar.el: Use lexical-binding. * lisp/erc/erc-spelling.el: Use lexical-binding. * lisp/erc/erc-truncate.el: Use lexical-binding. * lisp/erc/erc-xdcc.el: Use lexical-binding.
2021-03-18 23:14:33 -04:00
(defun erc-set-network-name (_proc _parsed)
"Set `erc-network' to the value returned by `erc-determine-network'."
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(declare (obsolete "maybe see `erc-networks--set-name'" "29.1"))
(unless erc-server-connected
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(setq erc-network (with-suppressed-warnings
((obsolete erc-determine-network))
(erc-determine-network))))
nil)
(defconst erc-networks--name-missing-sentinel (gensym "Unknown ")
"Value to cover rare case of a literal NETWORK=nil.")
(defun erc-networks--determine (&optional server)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
"Return the name of the network as a symbol.
Search `erc-networks-alist' for a known entity matching SERVER or
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
`erc-server-announced-name'. If that fails, use the display name
given by the `RPL_ISUPPORT' NETWORK parameter."
(or (cl-loop for (name matcher) in erc-networks-alist
when (and matcher
(string-match (concat matcher "\\'")
(or server erc-server-announced-name)))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
return name)
(and-let* ((vanity (erc--get-isupport-entry 'NETWORK 'single))
((intern vanity))))
(erc-networks--id-given erc-networks--id)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
erc-networks--name-missing-sentinel))
(defvar erc-networks--allow-unknown-network nil
"Whether to ignore a failure in identifying the network.
If you need this as a user option, please say so via \\[erc-bug].
Otherwise, expect it to vanish at any time.") ; Bug#59976
(defun erc-networks--set-name (proc parsed)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
"Set `erc-network' to the value returned by `erc-networks--determine'.
Print an error message when the network cannot be determined before
shutting down the connection."
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;; Always update (possibly clobber) current value, if any.
(pcase (setq erc-network (erc-networks--determine))
((and (pred (eq (erc-networks--id-given erc-networks--id)))
(let m (format "Couldn't determine network. Using given ID `%s'."
erc-network)))
(erc-display-message parsed 'notice nil m)
nil)
((and
(guard (eq erc-network erc-networks--name-missing-sentinel))
;; This can happen theoretically, e.g., when adjusting settings
;; on a proxy service that partially impersonates IRC but isn't
;; currently conveying anything through to a real network. The
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;; service may send a 422 but no NETWORK param (or *any* 005s).
(let m (concat "Failed to determine network. Please set entry for \""
erc-server-announced-name "\" in `erc-networks-alist'"
" or consider calling `erc-tls' with the keyword `:id'."
" See Info:\"(erc) Network Identifier\" for more.")))
(erc-display-error-notice parsed m)
(if erc-networks--allow-unknown-network
(progn
(erc-display-error-notice
parsed (format "Continuing anyway with network set to `%s'."
erc-network))
nil)
(delete-process proc)
'error))))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;; This lives here in this file because all the other "on connect"
;; MOTD stuff ended up here (but perhaps that needs to change).
(defun erc-networks--ensure-announced (_ parsed)
"Set a fallback `erc-server-announced-name' if still unset.
Copy source (prefix) from MOTD-ish message as a last resort."
;; The 004 handler never ran; see 2004-03-10 Diane Murray in change log
(unless erc-server-announced-name
Add erc-button helper for substituting command keys * lisp/erc/erc-button.el (erc-button-mode, erc-button-enable): Warn if `erc-button-alist' contains deprecated FORM field in `nicknames' entry. (erc-button-alist): Discourage arbitrary sexp form for third item of entries and offer more useful bounds-modifying function in its place. Mention that anything other than `erc-button-buttonize-nicks' is deprecated as the FORM field in a `nicknames' entry. Bump package-version even though this doesn't introduce a visible change in the default value. (erc-button--maybe-warn-arbitrary-sexp): Add helper for validating third `erc-button-alist' field. (erc-button--check-nicknames-entry): Add helper to check for deprecated items in `erc-button-alist'. (erc-button--preserve-bounds): Add function to serve as default value for `erc-button--modify-nick-function). (erc-button--modify-nick-function): Add new variable to hold a function that filters nickname bounds when buttonizing. (erc-button--phantom-users, erc-button--add-phantom-speaker, erc-button--phantom-users-mode): Add new internal minor mode for treating unseen speakers of PRIVMSGs as known members of the server for things like coloring nicks during buffer playback. (erc-button--get-user-from-speaker-naive): Add temporary utility function to scrape nick from speaker in narrowed buffer. This will be replaced by an account-aware version in next major ERC release. (erc-button-add-nickname-buttons): Accommodate function variant for "form" field of `erc-button-alist' entries. Minor optimizations. This function will likely become the primary juncture for applying text properties that support nickname-related user-intelligence features. (erc-button-add-buttons-1): Show warning when arbitrary sexp for third "form" field encountered. Accommodate binary function instead. (erc-button--substitute-command-keys-in-region): Add helper function for applying key substitutions in ERC warning messages. (erc-button--display-error-notice-with-keys): Add new helper function for displaying ad hoc warnings that possibly require key substitution. (erc-button--display-error-notice-with-keys-and-warn): Add variant of `erc-button--display-error-notice-with-keys' that also emits warnings. * lisp/erc/erc-networks.el (erc-networks--ensure-announced, erc-networks--on-MOTD-end): Use new key-substitutions helper from erc-button. * test/lisp/erc/erc-tests.el (erc-button--display-error-notice-with-keys): New test. * test/lisp/erc/resources/base/assoc/bouncer-history/foonet.eld: Add unknown speaker in channel for phantom store to handle. Currently requires manual intervention to leverage. (Bug#60933.)
2022-12-18 19:01:40 -08:00
(require 'erc-button)
(erc-button--display-error-notice-with-keys
parsed "Failed to determine server name. Using \""
(setq erc-server-announced-name (erc-response.sender parsed)) "\" instead"
". If this was unexpected, consider reporting it via \\[erc-bug]" "."))
nil)
lisp/erc: Use lexical-binding Also remove various redundant `:group` arguments. * lisp/erc/erc-backend.el (define-erc-response-handler): Move `declare` after the docstring. * lisp/erc/erc-capab.el: Use lexical-binding. (erc-capab-identify-activate): Simplify with `member`. * lisp/erc/erc-dcc.el (erc-dcc): Move before erc-dcc-mode definition, which refers to it. (erc-dcc-chat-accept): Remove unused vars `nick` and `buffer`. * lisp/erc/erc-imenu.el: Use lexical-binding. (erc-create-imenu-index): Remove unused var `prev-pos`. * lisp/erc/erc-match.el: Use lexical-binding. (erc-match-message): Remove unused var `old-pt`. (erc-match-message): Strength-reduce `eval` to `symbol-value`. * lisp/erc/erc-page.el: Use lexical-binding. (erc-page): Move Custom group before `erg-page-mode` which refers to it. * lisp/erc/erc-replace.el: Use lexical-binding. (erc-replace-insert): Use `functionp`. * lisp/erc/erc-status-sidebar.el: Use lexical-binding. (erc-status-sidebar-open): Remove unused var `sidebar-window`. * lisp/erc/erc.el: Fix header to use the customary 3 semi-colons. (erc-fill-column): Declare variable. * lisp/erc/erc-autoaway.el: Use lexical-binding. * lisp/erc/erc-ezbounce.el: Use lexical-binding. * lisp/erc/erc-fill.el: Use lexical-binding. * lisp/erc/erc-goodies.el: Use lexical-binding. * lisp/erc/erc-ibuffer.el: Use lexical-binding. * lisp/erc/erc-identd.el: Use lexical-binding. * lisp/erc/erc-join.el: Use lexical-binding. * lisp/erc/erc-lang.el: Use lexical-binding. * lisp/erc/erc-log.el: Use lexical-binding. * lisp/erc/erc-menu.el: Use lexical-binding. * lisp/erc/erc-netsplit.el: Use lexical-binding. * lisp/erc/erc-networks.el: Use lexical-binding. * lisp/erc/erc-pcomplete.el: Use lexical-binding. * lisp/erc/erc-ring.el: Use lexical-binding. * lisp/erc/erc-speedbar.el: Use lexical-binding. * lisp/erc/erc-spelling.el: Use lexical-binding. * lisp/erc/erc-truncate.el: Use lexical-binding. * lisp/erc/erc-xdcc.el: Use lexical-binding.
2021-03-18 23:14:33 -04:00
(defun erc-unset-network-name (_nick _ip _reason)
"Set `erc-network' to nil."
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(declare (obsolete "`erc-network' is now effectively read-only" "29.1"))
(setq erc-network nil)
nil)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;; TODO add note in Commentary saying that this module is considered a
;; core module and that it's as much about buffer naming and network
;; identity as anything else.
(defun erc-networks--insert-transplanted-content (content)
(let ((inhibit-read-only t)
(buffer-undo-list t))
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(insert-before-markers content)))))
;; This should run whenever a network identity is updated.
(defun erc-networks--reclaim-orphaned-target-buffers (new-proc nid announced)
"Visit disowned buffers for same NID and associate with NEW-PROC.
ANNOUNCED is the server's reported host name."
(erc-buffer-filter
(lambda ()
(when (and erc--target
(not erc-server-connected)
(erc-networks--id-equal-p erc-networks--id nid)
(or (not (erc--target-channel-local-p erc--target))
(string= erc-server-announced-name announced)))
;; If a target buffer exists for the current process, kill this
;; stale one after transplanting its content; else reinstate.
(if-let ((existing (erc-get-buffer
(erc--target-string erc--target) new-proc)))
(progn
(widen)
(let ((content (buffer-substring (point-min)
erc-insert-marker)))
(kill-buffer) ; allow target-buf renaming hook to run
(with-current-buffer existing
(erc-networks--ensure-unique-target-buffer-name)
(erc-networks--insert-transplanted-content content))))
(setq erc-server-process new-proc
erc-server-connected t
erc-networks--id nid))))))
(defvar erc-networks--copy-server-buffer-functions nil
"Abnormal hook run in new server buffers when deduping.
Passed the existing buffer to be killed, whose contents have
already been copied over to the current, replacement buffer.")
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(defun erc-networks--copy-over-server-buffer-contents (existing name)
"Kill off existing server buffer after copying its contents.
Must be called from the replacement buffer."
;; ERC expects `erc-open' to be idempotent when setting up local
;; vars and other context properties for a new identity. Thus, it's
;; unlikely we'll have to copy anything else over besides text. And
;; no reconciling of user tables, etc. happens during a normal
;; reconnect, so we should be fine just sticking to text. (Right?)
(let ((text (with-current-buffer existing
;; This `erc-networks--id' should be
;; `erc-networks--id-equal-p' to caller's network
;; identity and older if not eq.
;;
;; `erc-server-process' should be set but dead
;; and eq `get-buffer-process' unless latter nil
(delete-process erc-server-process)
(buffer-substring (point-min) erc-insert-marker)))
erc-kill-server-hook
erc-kill-buffer-hook)
(erc-networks--insert-transplanted-content text)
(run-hook-with-args 'erc-networks--copy-server-buffer-functions existing)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(kill-buffer name)))
;; This stands alone for testing purposes
(defun erc-networks--update-server-identity ()
"Maybe grow or replace the current network identity.
If a dupe is found, adopt its identity by overwriting ours.
Otherwise, take steps to ensure it can effectively be compared to
ours, now and into the future. Note that target buffers are
considered as well because server buffers are often killed."
(let* ((identity erc-networks--id)
(buffer (current-buffer))
(f (lambda ()
(unless (or (not erc-networks--id)
(eq (current-buffer) buffer)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(eq erc-networks--id identity))
(if (erc-networks--id-equal-p identity erc-networks--id)
(throw 'buffer erc-networks--id)
(erc-networks--id-ensure-comparable identity
erc-networks--id)
nil))))
(found (catch 'buffer (erc-buffer-filter f))))
(when found
(setq erc-networks--id found))))
;; These steps should only run when initializing a newly connected
;; server buffer, whereas `erc-networks--rename-server-buffer' can run
;; mid-session, after an identity's core components have changed.
(defun erc-networks--init-identity (proc parsed)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
"Update identity with real network name."
;; Initialize identity for real now that we know the network
(cl-assert erc-network)
(if erc-networks--id
(erc-networks--id-reload erc-networks--id proc parsed)
(setq erc-networks--id (erc-networks--id-create nil))
;; Find duplicate identities or other conflicting ones and act
;; accordingly.
(erc-networks--update-server-identity)
(erc-networks--rename-server-buffer proc parsed))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
nil)
(defun erc-networks--rename-server-buffer (new-proc &optional _parsed)
"Rename a server buffer based on its network identity.
Assume that the current buffer is a server buffer, either one
with a newly established connection whose identity has just been
fully fleshed out, or an existing one whose identity has just
been updated. Either way, assume the current identity is ready
to serve as a canonical identifier.
When a server buffer already exists with the chosen name, copy
over its contents and kill it. However, when its process is
still alive, kill off the current buffer. This can happen, for
example, after a perceived loss in network connectivity turns out
to be a false alarm. If `erc-reuse-buffers' is nil, let
`generate-new-buffer-name' do the actual renaming."
(cl-assert (eq new-proc erc-server-process))
(cl-assert (erc-networks--id-symbol erc-networks--id))
;; Always look for targets to reassociate because original server
;; buffer may have been deleted.
(erc-networks--reclaim-orphaned-target-buffers new-proc erc-networks--id
erc-server-announced-name)
(let* ((name (symbol-name (erc-networks--id-symbol erc-networks--id)))
;; When this ends up being the current buffer, either we have
;; a "given" ID or the buffer was reused on reconnecting.
(existing (get-buffer name)))
Add preset styles to erc-status-sidebar * lisp/erc/erc-networks.el (erc-networks--rename-server-buffer): Store `erc-networks--id' in process object's plist. * lisp/erc/erc-status-sidebar.el (erc-status-sidebar): Change group parent from `convenience' to `erc'. (erc-status-sidebar-channel-format): Mention in doc string that it depends on new option `erc-status-sidebar-style'. (erc-status-sidebar-highlight-active-buffer): New option to control whether the current window's target is highlighted in the status bar. (erc-status-sidebar-style): New option to determine whether servers and queries also appear in the sidebar. (erc-status-sidebar-click-display-action, erc-status-sidebar-singular): New options. (erc-status-sidebar-get-window): Consider `erc-status-sidebar-singular'. (erc-status-sidebar-open): Fix toggle functionality that somehow fell through the cracks after the adoption of the package into ERC proper. (erc-bufbar-mode, erc-bufbar-enable, erc-bufbar-disable): New module named `bufbar' instead of `sidebar', which is more easily confusable with `speedbar'. The preferred name, `status-sidebar' was unavailable because its minor-mode would have been `erc-status-sidebar-mode', which is already taken by the major mode used for status-bar buffers themselves. (erc-status-sidebar-toggle): Ignore `erc-status-sidebar-singular'. (erc-status-sidebar--trimpat, erc-status-sidebar--prechan): Add helper vars for new sorting function, allowing it to honor the existing interface, which only expects one argument. (erc-status-sidebar-prefer-target-as-name): New function for determining buffer name, preferring targets for target buffers. (erc-status-sidebar-get-channame): Use internal API to help determine name of buffer in sidebar. (erc-status-sidebar-prefer-target-as-name, erc-status-sidebar--show-disconnected, erc-status-sidebar-all-target-buffers, erc-status-sidebar-default-allsort): Add new naming and sorting functions and associated helper functions and variables. (erc-status-sidebar--active-marker, erc-status-sidebar--set-active-line): New variable and function for highlighting the active target in the status bar. (erc-status-sidebar-default-insert, erc-status-sidebar-pad-hierarchy): New functions for visiting various stages of buffer modification when rendering sidebar. (erc-status-sidebar-refresh): Consider presets and new options when rendering sidebar. (erc-status-sidebar-kill): Disable `erc-bufbar-mode' when active. (erc-status-sidebar-click): Appeal to option `erc-status-sidebar-display-action' for `pop-to-buffer' action. (erc-status-sidebar-scroll-up, erc-status-sidebar-scroll-down, erc-status-sidebar-recenter): Add commands to scroll and recenter sidebar from a target buffer's window. (erc-status-sidebar-set-window-preserve-size): Ignore `erc-status-sidebar-singular'. (erc-status-sidebar-mode): Make non-interactive to avoid confusion when folks run "M-x erc-status-sidebar-mode" expecting a module toggle. * test/lisp/erc/erc-scenarios-status-sidebar.el: New file. * test/lisp/erc/resources/base/gapless-connect/foonet.eld: Fix wrong manifest for channel and extend PASS timeout. (Bug#63595)
2023-05-04 00:01:11 -07:00
(process-put new-proc 'erc-networks--id erc-networks--id)
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(cond ((or (not existing)
(erc-networks--id-given erc-networks--id)
(eq existing (current-buffer)))
(rename-buffer name))
;; Abort on accidental reconnect or failure to pass :id param for
;; avoidable collisions.
((erc-server-process-alive existing)
(kill-local-variable 'erc-network)
(delete-process new-proc)
(erc-display-error-notice nil (format "Buffer %s still connected"
name))
(erc-set-active-buffer existing))
;; Copy over old buffer's contents and kill it
((with-suppressed-warnings ((obsolete erc-reuse-buffers))
erc-reuse-buffers)
(erc-networks--copy-over-server-buffer-contents existing name)
(rename-buffer name))
(t (rename-buffer (generate-new-buffer-name name)))))
nil)
;; Soju v0.4.0 sends ISUPPORT and nothing else on upstream reconnect,
;; so this actually doesn't apply. ZNC 1.8.2, however, still sends
;; the entire burst.
(defvar erc-networks--bouncer-targets '(*status bouncerserv)
"Symbols matching proxy-bot targets.")
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(defun erc-networks-on-MOTD-end (proc parsed)
"Call on-connect functions with server PROC and PARSED message."
;; This should normally run before `erc-server-connected' is set.
;; However, bouncers and other proxies may interfere with that.
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(when erc-server-connected
(unless (erc-buffer-filter (lambda ()
(and erc--target
(memq (erc--target-symbol erc--target)
erc-networks--bouncer-targets)))
proc)
Add erc-button helper for substituting command keys * lisp/erc/erc-button.el (erc-button-mode, erc-button-enable): Warn if `erc-button-alist' contains deprecated FORM field in `nicknames' entry. (erc-button-alist): Discourage arbitrary sexp form for third item of entries and offer more useful bounds-modifying function in its place. Mention that anything other than `erc-button-buttonize-nicks' is deprecated as the FORM field in a `nicknames' entry. Bump package-version even though this doesn't introduce a visible change in the default value. (erc-button--maybe-warn-arbitrary-sexp): Add helper for validating third `erc-button-alist' field. (erc-button--check-nicknames-entry): Add helper to check for deprecated items in `erc-button-alist'. (erc-button--preserve-bounds): Add function to serve as default value for `erc-button--modify-nick-function). (erc-button--modify-nick-function): Add new variable to hold a function that filters nickname bounds when buttonizing. (erc-button--phantom-users, erc-button--add-phantom-speaker, erc-button--phantom-users-mode): Add new internal minor mode for treating unseen speakers of PRIVMSGs as known members of the server for things like coloring nicks during buffer playback. (erc-button--get-user-from-speaker-naive): Add temporary utility function to scrape nick from speaker in narrowed buffer. This will be replaced by an account-aware version in next major ERC release. (erc-button-add-nickname-buttons): Accommodate function variant for "form" field of `erc-button-alist' entries. Minor optimizations. This function will likely become the primary juncture for applying text properties that support nickname-related user-intelligence features. (erc-button-add-buttons-1): Show warning when arbitrary sexp for third "form" field encountered. Accommodate binary function instead. (erc-button--substitute-command-keys-in-region): Add helper function for applying key substitutions in ERC warning messages. (erc-button--display-error-notice-with-keys): Add new helper function for displaying ad hoc warnings that possibly require key substitution. (erc-button--display-error-notice-with-keys-and-warn): Add variant of `erc-button--display-error-notice-with-keys' that also emits warnings. * lisp/erc/erc-networks.el (erc-networks--ensure-announced, erc-networks--on-MOTD-end): Use new key-substitutions helper from erc-button. * test/lisp/erc/erc-tests.el (erc-button--display-error-notice-with-keys): New test. * test/lisp/erc/resources/base/assoc/bouncer-history/foonet.eld: Add unknown speaker in channel for phantom store to handle. Currently requires manual intervention to leverage. (Bug#60933.)
2022-12-18 19:01:40 -08:00
(require 'erc-button)
(erc-button--display-error-notice-with-keys
parsed "Unexpected state detected. Please report via \\[erc-bug].")))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
;; For now, retain compatibility with erc-server-NNN-functions.
(or (erc-networks--ensure-announced proc parsed)
(erc-networks--set-name proc parsed)
(erc-networks--init-identity proc parsed)))
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
(define-erc-module networks nil
"Provide data about IRC networks."
Address long-standing ERC buffer-naming issues * lisp/erc/erc-backend.el (erc-server-connected): Revise doc string. (erc-server-reconnect, erc-server-JOIN): Reuse original ID param from the first connection when calling `erc-open'. (erc-server-NICK): Apply same name generation process used by `erc-open'; except here, do so for the purpose of "re-nicking". Update network identifier and maybe buffer names after a user's own nick changes. * lisp/erc/erc-networks.el (erc-networks--id, erc-networks--id-fixed, erc-networks--id-qualifying): Define new set of structs to contain all info relevant to specifying a unique identifier for a network context. Add a new variable `erc-networks--id' to store a local reference to a `erc-networks--id' object, shared among all buffers in a logical session. (erc-networks--id-given, erc-networks--id-create, erc-networks--id-on-connect, erc-networks--id--equal-p, erc-networks--id-qualifying-init-parts, erc-networks--id-qualifying-init-symbol, erc-networks--id-qualifying-grow-id, erc-networks--id-qualifying-reset-id, erc-networks--id-qualifying-prefix-length, erc-networks--id-qualifying-update, erc-networks--id-reload, erc-networks--id-ensure-comparable, erc-networks--id-sort-buffers): Add new functions to support management of `erc-networks--id' struct instances. (erc-networks--id-sep): New variable for to help when formatting buffer names. (erc-obsolete-var): Define new generic context rewriter. (erc-networks-shrink-ids-and-buffer-names, erc-networks--refresh-buffer-names, erc-networks--shrink-ids-and-buffer-names-any): Add functions to reassess all network IDs and shrink them if necessary along with affected buffer names. Also add function to rename buffers so that their names are unique. Register these on all three of ERC's kill-buffer hooks because an orphaned target buffer is enough to keep its session alive. (erc-networks-rename-surviving-target-buffer): Add new function that renames a target buffer when it becomes the sole bearer of a name based on a target that has become unique across all sessions and, in most cases, all networks. IOW, remove the @NETWORK-ID suffix from the last remaining channel or query buffer after its namesakes have all been killed off. Register this function with ERC's target-related kill-buffer hooks. (erc-networks--examine-targets): Add new utility function that visits all ERC buffers and runs callbacks when a buffer-name collision is encountered. (erc-networks--qualified-sep): Add constant to hold separator between target and suffix. (erc-networks--construct-target-buffer-name, erc-networks--ensure-unique-target-buffer-name, erc-networks--ensure-unique-server-buffer-name, erc-networks--maybe-update-buffer-name): Add helpers to support `erc-networks--reconcile-buffer-names' and friends. (erc-networks--reconcile-buffer-names): Add new buffer-naming strategy function and helper for `erc-generate-new-buffer-name' that only run in target buffers. (erc-determine-network, erc-networks--determine): Deprecate former and partially replace with latter, which demotes RPL_ISUPPORT-derived NETWORK name to fallback in favor of known `erc-networks-alist' members as part of shift to network-based connection-identity policy. Return sentinel on failure. Expect `erc-server-announced-name' to be set, and signal when it's not. (erc-networks--name-missing-sentinel): Value returned when new function `erc-networks--determine' fails to find network name. The rationale for not making this customizable is that the value signifies the pathological case where a user of an uncommon IRC setup has not yet set a mapping from announced- to network name. And the chances of there being multiple unknown networks is low. (erc-set-network-name, erc-networks--set-name): Deprecate former and partially replace with latter. Ding with helpful message, and don't set `erc-network' when network name is not found. (erc-networks--ensure-announced): Add new fallback function to ensure `erc-server-announced-name' is set. Register with post-MOTD hooks. (erc-unset-network-name): Deprecate function unused internally. (erc-networks--insert-transplanted-content, erc-networks--reclaim-orphaned-target-buffers, erc-networks--copy-over-server-buffer-contents, erc--update-server-identity): Add helpers for `erc-networks--rename-server-buffer'. The first re-associates all existing target buffers that ought to be owned by the new server process. The second grabs buffer text from an old, dead server buffer before killing it. It then inserts that text above everything in the current, replacement server buffer. The other two massage the IDs of related sessions, possibly renaming them as well. They may also uniquify the current session's network ID. (erc-networks--init-identity): Add new function to perform one-time session-related setup. This could be combined with `erc-set-network-name'. (erc-networks--rename-server-buffer): Add new function to replace `erc-unset-network-name' as default `erc-disconnected-hook' member; renames server buffers once network is discovered; added to/removed from `erc-after-connect' hook on `erc-networks' minor mode. (erc-networks--bouncer-targets): Add constant to hold target symbols of well known bouncer-configuration bots. (erc-networks-on-MOTD-end): Add primary network-context handler to run on 376/422 functions, just before logical connection is officially established. (erc-networks-enable, erc-networks-mode): Register main network-setup handler with 376/422 hooks. * lisp/erc/erc.el (erc-rename-buffers): Change this option's default to t, remove the only instance where it's actually used, and make it an obsolete variable. (erc-reuse-buffers): Make this an obsolete variable, but take pains to ensure its pre-28.1 behavior is preserved. That is, undo the regression involving unwanted automatic reassociation of channel buffers during joins, which arrived in ERC 5.4 and effectively inverted the meaning of this variable, when nil, for channel buffers, all without accompanying documentation or announcement. (erc-generate-new-buffer-name): Replace current policy of appending a slash and the invocation host name. Favor instead temporary names for server buffers and network-based uniquifying suffixes for channels and query buffers. Fall back to the TCP host:port<n> convention when necessary. Accept additional optional params after the others. (erc-get-buffer-create): Don't generate a new name when reconnecting, just return the same buffer. `erc-open' starts from a clean slate anyway, so this just keeps things simple. Also add optional params. (erc-open): Add new ID param to for a network identifier explicitly passed to an entry-point command. This is stored in the `given' slot of the `erc-network--id' object. Also initialize the latter in new connections and otherwise copy it over. As part of the push to recast erc-networks.el as an essential library, set `erc-network' explicitly, when known, rather than via hooks. (erc, erc-tls): Add new ID keyword parameter and pass it to `erc-open'. (erc-log-irc-protocol): Use `erc--network-id' instead of the function `erc-network' to determine preferred peer name. (erc-format-target-and/or-network): This is called frequently from mode-line updates, so renaming buffers here is not ideal. Instead, do so in `erc-networks--rename-server-buffer'. (erc-kill-server-hook): Add `erc-networks-shrink-ids-and-buffer-names' as default member. (erc-kill-channel-hook, erc-kill-buffer-hook): Add `erc-networks-shrink-ids-and-buffer-names' and `erc-networks-rename-surviving-target-buffer' as default member. * test/lisp/erc/erc-tests.el (erc-log-irc-protocol): Use network-ID focused internal API. * test/lisp/erc/erc-networks-tests.el: Add new file that includes tests for the above network-ID focused functions. See bug#48598 for background on all of the above.
2021-05-03 05:54:56 -07:00
((add-hook 'erc-server-376-functions #'erc-networks-on-MOTD-end)
(add-hook 'erc-server-422-functions #'erc-networks-on-MOTD-end))
((remove-hook 'erc-server-376-functions #'erc-networks-on-MOTD-end)
(remove-hook 'erc-server-422-functions #'erc-networks-on-MOTD-end)))
(defun erc-networks--warn-on-connect ()
"Emit warning when the `networks' module hasn't been loaded.
Ideally, do so upon opening the network process."
(unless (or erc--target erc-networks-mode)
(let ((m (concat "Required module `networks' not loaded. If this "
" was unexpected, please add it to `erc-modules'.")))
;; Assume the server buffer has been marked as active.
(erc-display-error-notice
nil (concat m " See Info:\"(erc) Required Modules\" for more."))
(lwarn 'erc :warning m))))
(defun erc-ports-list (ports)
"Return a list of PORTS.
PORTS should be a list of either:
A number, in which case it is returned a list.
Or a pair of the form (LOW HIGH), in which case, a list of all the
numbers between LOW and HIGH (inclusive) is returned.
As an example:
(erc-ports-list \\='(1)) => (1)
(erc-ports-list \\='((1 5))) => (1 2 3 4 5)
(erc-ports-list \\='(1 (3 5))) => (1 3 4 5)"
(let (result)
(dolist (p (ensure-list ports))
(cond ((numberp p)
(push p result))
((listp p)
(setq result (nconc (cl-loop for i from (cadr p) downto (car p)
collect i)
result)))))
(nreverse result)))
(defun erc-networks--server-select ()
"Prompt for a server in `erc-server-alist' and return its irc(s):// URL.
Choose port at random if multiple candidates exist, but always
prefer TLS without asking. When a port can't be determined,
return the host alone sans URL formatting (for compatibility)."
(let* ((completion-ignore-case t)
(net (intern
(completing-read "Network: "
(delete-dups
(mapcar (lambda (x)
(list (nth 1 x)))
erc-server-alist)))))
(s-choose (lambda (entry)
(and (equal (nth 1 entry) net)
(if-let ((b (string-search ": " (car entry))))
(cons (format "%s (%s)" (nth 2 entry)
(substring (car entry) (+ b 2)))
(cdr entry))
entry))))
(s-entries (delq nil (mapcar s-choose erc-server-alist)))
(srv (assoc (completing-read "Server: " s-entries) s-entries))
(host (nth 2 srv))
(pspec (nthcdr 3 srv))
(ports (erc-ports-list (or (cadr pspec) (car pspec))))
(scheme (if (cdr pspec) "ircs" "irc")))
(if ports (format "%s://%s:%d" scheme host (seq-random-elt ports)) host)))
;;; The following experimental
;; It does not work yet, help me with it if you
;; think it is worth the effort.
(defvar erc-settings
'((pals Libera.Chat ("kensanata" "shapr" "anti\\(fuchs\\|gone\\)"))
(format-nick-function (Libera.Chat "#emacs") erc-format-@nick))
"Experimental: Alist of configuration options.
The format is (VARNAME SCOPE VALUE) where
VARNAME is a symbol identifying the configuration option,
SCOPE is either a symbol which identifies an entry from
`erc-networks-alist' or a list (NET TARGET) where NET is a network symbol and
TARGET is a string identifying the channel/query target.
VALUE is the options value.")
(defun erc-get (var &optional net target)
(let ((items erc-settings)
elt val)
(while items
(setq elt (car items)
items (cdr items))
(when (eq (car elt) var)
(cond ((and net target (listp (nth 1 elt))
(eq net (car (nth 1 elt)))
(string-equal target (nth 1 (nth 1 elt))))
(setq val (nth 2 elt)
items nil))
((and net (eq net (nth 1 elt)))
(setq val (nth 2 elt)
items nil))
((and (not net) (not target) (not (nth 1 elt)))
(setq val (nth 2 elt)
items nil)))))
val))
;; (erc-get 'pals 'Libera.Chat)
(provide 'erc-networks)
;;; erc-networks.el ends here