* lisp/erc/erc.el (erc-login): Also known as connection passwords,
these are sent as the sole arg to the PASS command, which is nowadays
often overloaded with other semantics imposed by various entities to
convey things like bouncer or services creds.
* lisp/erc/erc.el (erc-downcase, erc--casemapping-rfc1459-strict,
erc--casemapping-rfc1459): Add new translation tables for the latter
two mappings and use them in `erc-downcase'.
* test/lisp/erc/erc-tests.el: Add test for `erc-downcase'.
* lisp/erc/erc-backend (erc--isupport-params): Add new variable to
hold a hashmap of parsed `erc-server-parameters' in a more useful
format. But keep `erc-server-parameters' around for public use. We
currently lack dedicated local variables for certain discovered IRC
session properties, such as what prefix characters are supported for
channels, etc. And the truth of this needs querying many times per
second at various points. As such, caching here seems justified but
can be easily removed if deemed otherwise because all ingredients are
internal.
(erc--parse-isupport-value): Add helper function that parses an
ISUPPORT value and returns the component parts with backslash-x hex
escapes removed. This can probably use some streamlining.
(erc--with-memoization): Add compat alias for use in internal ISUPPORT
getter. Should be moved to `erc-compat.el' when that library is fully
reincorporated.
(erc--get-isupport-entry): Add internal getter to look up ISUPPORT
items.
(erc-server-005): Treat `erc-server-response' "command args" field as
read-only. Previously, this field was set to nil after processing,
which was unhelpful to other parts of the library. Also call above
mentioned helper to parse values. And add some bookkeeping to handle
negation.
* lisp/erc/erc-capab.el (erc-capab-identify-send-messages): Use
internal ISUPPORT getter.
* lisp/erc/erc.el (erc-cmd-NICK, erc-parse-prefix,
erc-nickname-in-use): Use internal ISUPPORT getter.
* test/lisp/erc/erc-tests.el: Add tests for the above mentioned
changes in erc-backend.el.
* lisp/erc/erc.el: Require erc-networks.el, which ERC can't run
without these days. To sidestep the circular dependency, require it
last, just after erc-goodies. Remove the `declare-function' for
`erc-network-name' because it's not currently needed at load time.
(erc-log-irc-protocol, erc-hide-current-message-p): Remove `fboundp'
guard logic from `erc-network-name' invocations but preserve meaning
by interpreting `erc-network' being unset to mean module isn't loaded
or authoritative network detection has failed.
(erc-format-network): Likewise here. At the moment, this function
always returns the empty string because the function
`erc-network-name' always returns non-nil, perhaps from the
fallback/failure sentinel "Unknown", perhaps from the printed form of
nil.
* lisp/erc/erc-networks.el (erc-network): This is called throughout
erc.el but was previously cumbersome to use on account of being
guarded by `fboundp'. It now relies on the fact that its namesake
variable is set in target buffers as well.
* lisp/erc/erc.el (erc-open): whenever this function is called, the
variable `erc-server-announced-name' may be set locally in the calling
server buffer. However, if that buffer's dialed server matches that
of the one being created, the announced name is copied over on faith.
But there's no guarantee that the name will match the one ultimately
emitted by the server during its introductory burst. Beyond
potentially causing confusion in protocol logs, this behavior may
complicate debugging efforts. Setting the variable to nil helps
ensure a consistent environment when preparing a buffer for all newly
dialed connections. This commit also simplifies the setting of
`erc-server-connected', which is always nil when connecting and
vice-versa.
* lisp/erc/erc-backend.el (erc--server-last-reconnect-count):
Add variable to record last reconnect tally.
* lisp/erc/erc.el (erc-reconnect-display): Add new option to specify
channel-buffer display behavior on reconnect.
(erc-setup-buffer): Use option `erc-reconnect-display' if warranted.
(erc-cmd-JOIN): Forget last reconnect count when issuing a manual
/JOIN command.
(erc-connection-established): Record reconnect count in internal var
before resetting.
(Bug#51753)
* lisp/erc/erc-backend.el (erc--unhide-prompt, erc--hide-prompt,
erc--unhide-prompt-on-self-insert): Add functions to ensure prompt is
hidden on disconnect and shown when a user types /reconnect in a
disconnected server buffer.
(erc-process-sentinel): Register aforementioned function with
`pre-command-hook' when prompt is deleted after disconnecting.
(erc-server-PRIVMSG): Ensure prompt is showing when a new message
arrives from target.
* lisp/erc/erc.el (erc-hide-prompt): Repurpose unused option by
changing meaning slightly to mean "selectively hide prompt when
disconnected." Also delete obsolete, commented-out code that at some
point used this option in its prior incarnation.
(erc-prompt-hidden): Add new option to specify look of prompt when
hidden.
(erc-unhide-query-prompt): Add option to force-reveal query prompts on
reconnect.
(erc-open): Augment earlier reconnect-detection semantics by
incorporating `erc--server-reconnecting'. In existing buffers, remove
prompt-related hooks and reveal prompt, if necessary.
(erc-cmd-RECONNECT): Allow a user to reconnect when already
connected (by first disconnecting).
(erc-connection-established): Possibly unhide query prompts.
(Bug#54826)
* test/lisp/erc/erc-tests.el (erc-tests--test-prep,
erc-tests--set-fake-server-process): Factor out some common
buffer-prep boilerplate involving user input and the server process.
Shared with bug#54536.
* lisp/erc/erc-backend.el (erc-server-reconnect): Reuse the username
argument from the previous session's USER command when reconnecting.
Also pass the existing client certificate, fixing an issue related to
bug#47788.
(erc-session-user-full-name): Move variable here from erc.el.
(erc-session-username): Add new local variable to store entry point
parameter.
* lisp/erc/erc.el (erc-session-user-full-name): Move variable to
erc-backend.
(erc-open, erc-determine-parameters, erc, erc-tls): Accept new
optional user parameter.
(erc-query): Preserve current `erc-session-username' when calling
`erc-open'.
(erc-login): Use `erc-session-username' instead of deriving it.
(erc-compute-user): Add new function to determine user name from
explicit argument or user options.
(Bug#54824)
* lisp/erc/erc-backend.el (erc-server-connect): Set
`erc-server-filter-data' to nil upon (re)connecting.
* lisp/erc/erc.el (erc-open): For the sake of clarity, don't
initialize `erc-server-filter-data' here because non-connect
invocations merely set up a target buffer and have no business
touching this variable.
* lisp/erc/erc.el: Declare needed variables exported by erc-backend.el
as special near the top of the file, and only require `erc-backend'
after providing `erc' as a feature at the very end.
* lisp/erc/erc-backend.el: Don't preemptively provide `erc-backend'.
* test/lisp/erc/erc-tests.el (erc--meta--backend-dependencies): Add
utility test to scrape for unused vars that may accumulate over time.
(Bug#54825)
* lisp/erc/erc.el (erc--switch-to-buffer): Commit
f925fc93ba "Add `predicate' arg to
`read-buffer' and use it for erc-iswitchb" meant to remove this, but
it was left behind. (Bug#53617)
Copyright-paperwork-exempt: yes
* lisp/erc/erc.el (erc-cmd-QUERY): Be less enthusiastic about
announcing missing/broken functionality. The comment "except this is
broken right now" has been there since 2008, and it's not obvious to
me that we should ever re-add it.
* lisp/erc/erc.el (erc-cmd-default): prevent excess trailing newlines
from being sent.
* test/lisp/erc/erc-tests.el: Update `erc-process-input-line' test to
check for excess line feeds with unknown commands.
* lisp/erc/erc-backend.el (erc-server-reconnecting,
erc--server-reconnecting): obsolete and replace the former with new
internal variant, which carries a simplified meaning.
(erc-server-reconnect-p, erc--server-reconnect-p): Obsolete and
replace the former with an internal function, and change behavior to
disregard `erc-server-reconnecting' when rendering verdict.
(erc-process-sentinel-2): ensure local var `erc--server-reconnecting'
is t when timers are scheduled or firing, and nil otherwise, including
after retries exhausted. This agrees with the straightforward way
`erc-server-reconnecting' has always been used by `erc-cmd-RECONNECT'.
(erc-server-connect): set `erc--server-reconnecting'.
* lisp/erc/erc.el (erc-cmd-RECONNECT): use `erc--server-reconnecting'
instead of `erc-server-reconnecting'.
* erc.el (erc-send-input-line): Previously, any line typed into a
query or channel buffer without an explicit user-command
handler (meaning most lines), would be sent twice because a trailing
newline (linefeed) would be appended. This has been verified by
checking IRCd server logs. IRCds won't return an error upon receiving
an empty message, but they also won't forward them to channel
subscribers and DM pals.
* erc-tests.el: Add test for erc-process-input-line, which also
indirectly tests erc-send-input-line. It also tests the command
lookup and dispatch facility (bug#50008).
That autoload file is created as part of the Emacs compilation
process, however we would like ERC to be usable if used outside
emacs.git (e.g. if installed from GNU ELPA).
* etc/ERC-NEWS: Announce the new command, and mention it at the top of
the file along with 'report-emacs-bug'.
* lisp/erc/erc.el (erc-bug): New command for reporting ERC bugs. It
prompts for a subject, and passes it on to 'report-emacs-bug' along
with the current ERC version, with the ERC mailing list in Cc.
* lisp/erc/erc.el (erc-version): New constant holding the current ERC
version, now used in the function with the same name to produce a
version string for use across ERC for consistency. Also, add another
optional argument, 'bold-erc', which when non-nil, marks the "ERC"
portion of the string with the control character for bold display.
(erc-quit/part-reason-default): Use the 'erc-version' function for a
consistent version string.
(erc-cmd-SV): Mention the ERC version number from the 'erc-version'
constant.
(erc-ctcp-query-VERSION): Use the 'erc-version' function for a
consistent version string.
* etc/NEWS: Announce the addition of the command.
* lisp/erc/erc.el (erc-cmd-WII): Add '/wii' convenience command which
calls the '/whois' command with the given nick as both arguments,
which is useful for displaying the whois information for the nick
along with idle time, even if the nick is on a different server than
the one we are currently connected to.
* etc/NEWS: Remove unneeded entry.
* lisp/erc/erc.el (erc-cmd-WHOIS): Restore the previous order of
arguments sent to the server, so that there's no change in the
function's behavior. Instead, rename the arguments to be more
accurate, and expand upon them in the doc string.
* lisp/erc/erc.el (erc-cmd-WHOIS): Switch the order of 'server' and
'user' arguments sent to the server. Per RFC 1459 and RFC 2812, the
optional 'server' argument command comes before the 'user' argument,
not after. While at it, update the doc string to explain why one may
want to specify the 'server' argument.
* etc/NEWS: Announce the change.
* lisp/erc/erc.el (erc-cmd-OPME, erc-cmd-DEOPME): Add convenience
commands for setting and unsetting the operator status on the current
nick in the current channel. 'erc-cmd-OPME' relies on ChanServ for
obtaining the operator status (see doc string for more details).
* etc/NEWS: Announce the addition of the commands.
* erc.el (erc-debug-irc-protocol): Fix line-ending mismatch between
incoming and outgoing logger lines without changing interface. Do this
by adding carriage returns to the latter to improve machine
readability. Change printed peer labels to most accurately reflect
logical endpoints.
(erc-debug-irc-protocol-time-format): Add new variable to support
timestamps in protocol logger output.
(erc-debug-irc-protocol-version): Add new variable to help tooling
track logging format independent of ERC and Emacs versions.
(erc-toggle-debug-irc-protocol): Add headers to protocol-log buffer
to aid future bug-reproduction tools. Clean up overlong lines (bug#50009).
* lisp/erc/erc.el (erc-lurker-maybe-trim): Prevent warning from
showing up in third-party code using this function by autoloading
rx.el when needed. Remove trailing chars appended for uniquifying
purposes when a nick is already taken. Special thanks to Mattias
Engdegård for making this more respectable (Bug#50005).
* test/lisp/erc/erc-tests.el: Add tests for the above and require
erc-networks.
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART): Use
'string-replace' only on Emacs 28 and later, otherwise use
'replace-regexp-in-string' on older Emacsen.
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input): Use 'string-search' only on
Emacs 28 and later, otherwise use 'string-match' on older Emacsen.
* doc/misc/erc.texi (Connecting): Add a reference to the auth manual.
* etc/NEWS: Remove the verbose, detailed example of client certificate
specification and refer to the ERC manual instead.
* lisp/erc/erc.el (erc-tls): Fix leftover path example in docstring.
* lisp/erc/erc-backend.el (erc-session-client-certificate): New
buffer-local variable storing the TLS client certificate used for the
current connection.
(erc-open-network-stream): Use open-network-stream instead of
make-network-process, and pass any additional arguments to it.
(erc-server-connect): Add an optional client-certificate argument
that if present is passed with the :client-certificate keyword as part
of the arguments to erc-server-connect-function.
* lisp/erc/erc.el (erc-open): Add new optional client-certificate
argument, set it as erc-session-client-certificate, and pass it along
to erc-server-connect.
(erc): Clarify documentation string with respect to the full-name
argument.
(erc-tls): Add new client-certificate keyword argument and pass it in
the direct call to erc-open (instead of going through erc).
(erc-open-tls-stream): Pass any additional arguments (such as
:client-certificate) to open-network-stream. Also allow overriding
:nowait if desired.
* doc/misc/erc.texi: Add documentation for erc-tls, including the new
:client-certificate argument.
* etc/NEWS: Announce the change.
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.
[ Also use `read-string` instead of `read-from-minibuffer`. ]
(erc-part-from-channel): Comment out improbable
reference to the formal argument from within the interactive spec.
(erc-process-input-line): A function can be `listp`.
(erc-send-input): Use `run-hook-with-args` for `erc-pre-send-functions`.
(erc-display-command): Comment out, unused.
74a77ef299 Improve documentation of 'network-lookup-address-info'
c6d5555646 Display messages sent using ERC's /say
c156723769 Fix Rmail summary display when From: header is malformed
chat.freenode.net has been the preferred address for connecting to the
freenode IRC network for years now. Replace the occurrences of
irc.freenode.net with chat.freenode.net.
* lisp/textmodes/rst.el (rst-insert-list-new-item):
* lisp/tab-bar.el (tab-bar-switch-to-tab):
* lisp/profiler.el (profiler-start):
* lisp/frame.el (set-frame-font):
* lisp/erc/erc.el (erc-join-channel):
* lisp/emacs-lock.el (emacs-lock--set-mode):
* lisp/emacs-lisp/elp.el (elp-set-master):
* lisp/emacs-lisp/checkdoc.el ()
(checkdoc-this-string-valid-engine):
* lisp/calendar/todo-mode.el (todo-find-filtered-items-file):
* lisp/calendar/calendar.el (calendar-set-date-style): Use
`format-prompt' in calls to completing-read that has a default
value, but didn't mention that in the prompt.
* lisp/erc/erc.el (erc-generate-new-buffer-name): Fixes behavior 1,
also determines if the '#channel/server' buffer already exists
and will reuse that buffer when joining on the same
server. Additionally when creating a new buffer with
'#channel/serverB', the existing buffer '#channel' on 'severA' will be
renamed to '#channel/serverA' for the sake of consistency (bug#40121).
* lisp/erc/erc-join.el (erc-autojoin-channels): The logic is
simplified ensuring that when autojoining channels specified in
erc-autojoin-channels-alist, if there exists an erc buffer with the
same channel name but a different server, it will create a new buffer
to join the channel. The current logic is very weak that will skip
joining same channel on different servers altogether.
By the definition of erc-reuse-buffers, if non-nil it should create a
new buffer when joining channels with same names on different
servers. The current behavior of erc-reuse-buffers is:
1. when non-nil, it will always reuse the same channel buffer,
resulting in server A's channel gets reconnected to the channel with
the same name of server B.
2. when nil, the buffer-name of the joined channel is
'#channel/server'. However if one tries to '/join #channel' from the
server buffer, it creates a new empty buffer with buffer-name
'#channel', instead of opening the already-joined channel buffer.
* lisp/erc/erc.el (erc--unignore-user): Separate into own function
(bug#40137).
(erc-cmd-IGNORE): Ask if the user wants a timeout.
(erc--read-time-period): New function.
* lisp/erc/erc.el (erc-header-line): Inherit from header-line (the
old values were very similar in light mode, but very different
in dark mode) (bug#41095).
* lisp/format-spec.el: Use lexical-binding. Remove dependence on
subr-x.el.
(format-spec-make): Clarify docstring.
(format-spec--parse-modifiers): Rename to...
(format-spec--parse-flags): ...this and simplify. In particular,
don't bother parsing :space-pad which is redundant and unused.
(format-spec--pad): Remove, replacing with...
(format-spec--do-flags): ...this new helper function which performs
more of format-spec's supported text manipulation.
(format-spec): Autoload. Allow optional argument to take on special
values 'ignore' and 'delete' for more control over what happens when
a replacement for a format specification isn't provided. Bring back
proper support for a precision modifier similar to that of 'format'.
* lisp/battery.el (battery-format): Rewrite in terms of format-spec.
(battery-echo-area-format, battery-mode-line-format): Mention
support of format-spec syntax in docstrings.
* doc/lispref/strings.texi (Custom Format Strings):
* etc/NEWS: Document and announce these changes.
* lisp/dired-aux.el (dired-do-compress-to):
* lisp/erc/erc-match.el (erc-log-matches):
* lisp/erc/erc.el (erc-update-mode-line-buffer):
* lisp/gnus/gnus-sieve.el (gnus-sieve-update):
* lisp/gnus/gssapi.el (open-gssapi-stream):
* lisp/gnus/mail-source.el (mail-source-fetch-file)
(mail-source-fetch-directory, mail-source-fetch-pop)
(mail-source-fetch-imap):
* lisp/gnus/message.el (message-insert-formatted-citation-line):
* lisp/image-dired.el:
* lisp/net/eww.el:
* lisp/net/imap.el (imap-kerberos4-open, imap-gssapi-open)
(imap-shell-open):
* lisp/net/network-stream.el (network-stream-open-shell):
* lisp/obsolete/tls.el (open-tls-stream):
* lisp/textmodes/tex-mode.el:
Remove extraneous loads and autoloads of format-spec now that it is
autoloaded and simplify its uses where possible.
* test/lisp/battery-tests.el (battery-format): Test new format-spec
support.
* test/lisp/format-spec-tests.el (test-format-spec): Rename to...
(format-spec) ...this, extending test cases.
(test-format-unknown): Rename to...
(format-spec-unknown): ...this, extending test cases.
(test-format-modifiers): Rename to...
(format-spec-flags): ...this.
(format-spec-make, format-spec-parse-flags, format-spec-do-flags)
(format-spec-do-flags-truncate, format-spec-do-flags-pad)
(format-spec-do-flags-chop, format-spec-do-flags-case): New tests.
* lisp/erc/erc.el (erc-switch-to-buffer): Factor out the buffer choice
implementation from here ...
(erc--switch-to-buffer): ... to here.
(erc-switch-to-buffer-other-window): New function, like
`erc-switch-to-buffer', but uses `switch-to-buffer-other-window'
instead, to open the buffer in another window.
* lisp/erc/erc.el (erc-official-location): As part of bringing ERC
under the Emacs umbrella, erc-discuss has been renamed to emacs-erc,
and will be *the* mailing list for discussions and announcements about
ERC going forward. The other two lists, erc-announce and erc-commit,
are now retired. For more details, see the announcement at
<https://lists.gnu.org/archive/html/emacs-erc/2020-03/msg00001.html>.
* lisp/erc/erc.el (erc-hide-current-message-p): Make
erc-channel-hide-list work (bug#37879) by getting matching on the
channel name instead of the ERC client name.
* lisp/erc/erc-goodies.el (erc-possibly-scroll-to-bottom): New
function.
(scrolltobottom): Add to erc-insert-done-hook.
* lisp/erc/erc.el (erc-insert-done-hook): New hook (bug#11697).
(erc-display-line-1): Use it.