* lisp/erc/erc-nicks.el (erc-nicks-mode, erc-nicks-enable)
(erc-nicks-disable): Use correct name for `track' module hook.
(erc-nicks--check-normals): Remove falsity from doc string.
* lisp/erc/erc-track.el (erc-make-mode-line-buffer-name): Don't error
when optional COUNT is nil.
(erc-track-modified-channels): Use new name for preferred face-finding
function.
(erc-track--get-faces-in-current-message, erc-track--collect-faces-in):
Rename former to latter to better reflect expanded utility, which now
includes spanning gaps, including newlines and indentation that may be
lacking in face-related properties.
* test/lisp/erc/erc-track-tests.el (erc-track--collect-faces-in): New
test. (Bug#73443)
* lisp/erc/erc-stamp.el (erc-add-timestamp): Honor an overriding
`erc--ts' "msg prop".
(erc-stamp--defer-date-insertion-on-post-modify): Add `erc--skip'
for the `track' module.
* lisp/erc/erc-track.el (erc-track--skipped-msgs): Remove unused
variable. Originally added as part of bug#60936.
(erc-track-modified-channels): Rely on the `erc--skip' "msg prop"
instead of the now defunct `erc-track--skipped-msgs' variable for
detecting requests to omit `track' mode-line updates during
`erc-display-message'.
* lisp/erc/erc-track.el (erc-track--shortened-names): New variable to
stash both the latest inputs and most recent result of
`erc-track-shorten-function'.
(erc-track--shortened-names-current-hash,
erc-track--shortened-names-set, erc-track--shortened-names-get): New
pair of generalized-variable functions and helper variable for
accessing and mutating `erc-track--shorten-prefixes'.
(erc-modified-channels-display): Avoid redundant calls to
`erc-track-shorten-function'. Mainly for use during batch processing.
* test/lisp/erc/erc-track-tests.el (erc-track--shortened-names): New
test. (Bug#67767)
* etc/ERC-NEWS: Add entry for new behavior involving the option
`erc-track-faces-normal-list'.
* lisp/erc/erc-button.el (erc-button-nick-default-face): New face to
serve as default for `erc-button-nickname-face'.
(erc-button-nickname-face): Change default value to
`erc-button-nick-default-face'.
* lisp/erc/erc-track.el (erc-track--massage-nick-button-faces): New
function to serve as Custom :set function for priority and "normal"
face-list options.
(erc-track-faces-normal-list): Fix Custom :type by loading
`erc-button' during validation so Customize chooses the correct UI
instead of a generic form field with "(mismatch)" printed alongside
the "STATE" button.
(erc-track-faces-priority-list, erc-track-faces-normal-list): Remove
values for "buttonized" `match' module faces that, if retained, would
need updating to feature `erc-button-nick-default-face' instead of
`erc-nick-default-face'. However, as noted in the NEWS entry, this
ordering of button face atop match face is not possible. Use :set
function to massage saved user values.
(erc-track-ignore-normal-contenders-p): New compatibility switch to
access pre-5.6 behavior, in which faces in
`erc-track-faces-normal-list' were only considered for promotion to
the mode line if the current face occupying that pole position wasn't
present.
(erc-track-mode, erc-track-enable, erc-track-disable): Add comments
regarding perceived futility of hooking on `erc-server-001-functions'
and likely unneeded hook removal. Run common buffer-local setup and
teardown.
(erc-track--normal-faces): New local variable, a snapshot of
`erc-track-faces-normal-list'.
(erc-track--setup): New function to stash
`erc-track-faces-normal-list' on init.
(erc-track-select-mode-line-face): Offer alternate explanation of
certain particulars in doc string.
(erc-track--alt-normals-function): New function-valued variable to
allow other modules to intervene in deciding whether to pursue and
promote a "normal" contending face.
(erc-track--select-mode-line-face): New function similar to its public
namesake except that it considers other viable candidates among the
"normal" alternatives.
(erc-track-modified-channels): Only run face selection portion when
faces are actually found. Use `erc-track--select-mode-line-face'
instead of `erc-track-select-mode-line-face'.
* test/lisp/erc/erc-track-tests.el
(erc-track-select-mode-line-face): New test.
(erc-track-tests--select-mode-line-face): New fixture function.
(erc-track--select-mode-line-face): New test. (Bug#67767)
* etc/ERC-NEWS: Mention that date stamps no longer optionally affect
the mode line. Also mention but discourage new variable
'erc-stamp-prepend-date-stamps-p'.
* lisp/erc/erc-stamp.el (erc-stamp-prepend-date-stamps-p): New
variable, an escape hatch to allow date stamps to once again be
prepended to messages.
(erc-insert-timestamp-left-and-right): Don't insert stamps as
independent messages when legacy support flag
`erc-stamp-prepend-date-stamps-p' is non-nil.
* lisp/erc/erc-track.el (erc-track--skipped-msgs): New internal
variable.
(erc-track-modified-channels): In previous versions, a date stamp
attached to a message for an IRC command in `erc-track-exclude-types'
would have no effect on the mode line. That they were able to
otherwise was probably a bug. Regardless, this distinction was lost
for the worse after date stamps became independent messages with
c68dc7786f "Manage some text props for ERC insertion-hook members".
To sidestep this regression, the `track' module will ignore date
stamps completely from now on. Thanks to Corwin Brust for spotting
this.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--left/display-margin-mode): Remove redundant
binding.
(erc-scenarios-stamp--legacy-date-stamps): New test. (Bug#60936)
* lisp/erc/erc-log.el (erc-log-all-but-server-buffers): Use
`erc--server-buffer-p' instead of `erc-server-buffer-p'. This
replacement is presumed to be relatively "safe" because this function
is unused in the code base and only appears in the doc string for the
option `erc-enable-logging'.
* lisp/erc/erc-match.el (erc-match-message): Leave comment proposing
that `erc--server-buffer-p' should be preferred to
`erc-server-buffer-p'. Use preferred alias for `erc-server-buffer-p'.
* lisp/erc/erc-notify.el (erc-cmd-NOTIFY): Use preferred alias for
`erc-server-buffer-p', and leave FIXME comment.
* lisp/erc/erc-speedbar.el (erc-speedbar-buttons): Use
`erc--server-buffer-p' instead of `erc-server-buffer-p'. The logic
here seems simple enough to justify a change, however the absence of
related bug reports is perhaps an argument against this.
* lisp/erc/erc-track.el (erc-track-modified-channels): Use preferred
alias for `erc-server-buffer-p' and leave comment noting possible bug.
* lisp/erc/erc.el (erc-once-with-server-event): Use
`erc--server-buffer-p' instead of `erc-server-buffer-p'. This change
seems justified because the function sets local hooks that would
otherwise be ignored outside of a server buffer.
(erc-server-buffer-p, erc-server-or-unjoined-channel-buffer-p): Make
the former an obsolete alias for the latter.
(erc--server-buffer-p): New function to replace `erc-server-buffer-p'
internally in new code. Unlike its predecessor, it returns nil in
parted and kicked channels.
(erc-open-server-buffer-p): Use `erc--server-buffer-p' instead of
`erc-server-buffer-p'. Given the name and the doc string, breaking
the odd misuse of this function in parted buffers seems justified
because this is clearly a bug fix. Also, all uses in-tree conform to
the intended behavior as documented. And a cursory grep of all "erc-"
prefixed packages on MELPA reveals zero instances of this function.
Nor is it used in erbot.
(erc-get-buffer): Mention behavior in doc string regarding parted and
kicked-from channels.
(erc-cmd-GQUIT): Fix wrong-number-of-arguments bug in timer function.
(erc-default-target): Mention behavior regarding unjoined channels.
(erc-kill-query-buffers): Don't use `erc-server-buffer-p'. This
replacement may break third-party code expecting to leave parted
channels behind, but it seems sane when considering only the lone
internal use in `erc-cmd-QUIT'.
; * test/lisp/erc/resources/join/network-id/foonet.eld: Timeouts.
(Bug#66578)
* lisp/erc/erc-goodies.el (erc-scroll-to-bottom): Only `recenter' when
the selected window's buffer is current. Previously, the module
`scrolltobottom' signaled an "Error in `post-command-hook'" when a
user clicked a channel indicator in the mode line from a window
showing another ERC buffer.
* lisp/erc/erc-track.el (erc-track--switch-fallback-blockers): New
internal variable used by `erc-track--switch-buffer' in deciding
whether to set `erc-track-last-non-erc-buffer' to the current buffer.
(erc-track--switch-buffer): Consult list of `buffer-match-p'
conditions in `erc-track--switch-fallback-blockers' to decide whether
to set `erc-track-last-non-erc-buffer' to the current buffer.
(Bug#63595)
* etc/ERC-NEWS: Tell module authors that `erc-display-message' can now
combine faces.
* lisp/erc/erc-button.el (erc-button--display-error-notice-with-keys):
Ask `erc-display-message' to compose `erc-notice-face' and
`erc-error-face'.
* lisp/erc/erc-match.el (erc-hide-fools): Merge `invisible' prop
`erc-match' with existing, if present, and move body to helper for
hiding matched messages.
(erc-match--hide-message): New helper function to hide messages
regardless of match type.
* lisp/erc/erc-track.el: (erc-track-faces-priority-list): Note in doc
string that faces reserved for critical messages are always
prioritized. Wrap :type declaration in macro helper to ensure
`erc-button' is loaded beforehand. Otherwise calling `setopt' with
the option's default value fails.
(erc-track--attn-faces): Add new internal variable for faces that
should always appear in the mode line, at least in the default client.
(erc-track-modified-channels, erc-track-face-priority): Prepend
`erc-track--attn-faces' to `erc-track-faces-priority-list'.
* lisp/erc/erc.el (erc-send-action): Ask `erc-display-message' to
apply both `erc-input-face' and `erc-action-face' to messages.
(erc--compose-text-properties): New internal variable to act as flag
for altering behavior of `erc-put-text-property'.
(erc--merge-prop): New function copied from `erc-button-add-face' for
general internal use with any text property by all of ERC.
(erc-display-message-highlight): Set fallback face to
`erc-default-face' the symbol instead of the string. For this to
break third-party code, callers would have to supply erroneous types
for nonexistent or undefined handlers and then explicitly check for
and depend on such misuse, which seems unlikely and therefore not
worth mentioning in etc/ERC-NEWS.
(erc-display-message): Explain how `type' param works when it's a
list. Fix code in type-as-list branch so that it optionally combines
faces instead of clobbers them.
(erc-put-text-property): Unalias from `put-text-property', but fall
back to the latter unless caller wants to combine faces, in which case,
defer to `erc--merge-prop'.
* test/lisp/erc/erc-button-tests.el
(erc-button--display-error-notice-with-keys): Expect a combined "error
notice" face. (Bug#64301)
* lisp/erc/erc-track.el (erc-track--switch-buffer): If the chosen
buffer has been killed, remove it from `erc-modified-channels-alist'
and try again.
* test/lisp/erc/erc-scenarios-misc.el
(erc-scenarios-base-kill-server-track): New test. (Bug#60560.)
* lisp/erc/erc-networks.el
(erc-networks--copy-server-buffer-functions): New internal hook
through which modules can perform housekeeping when server buffers
belonging to the same network context are merged.
(erc-networks--copy-over-server-buffer-contents): Run new internal
hook `erc-networks--copy-server-buffer-functions'.
* lisp/erc/erc-track.el (erc-track-enable, erc-track-disable): Manage
membership in `erc-networks--copy-server-buffer-functions' hook.
(erc-track--replace-killed-buffer): New function to replace server
buffer being killed in `erc-modified-channels-alist'.
* test/lisp/erc/erc-scenarios-base-association.el
(erc-scenarios-networks-merge-server-track): New test.
* test/lisp/erc/resources/networks/merge-server/track.eld: New test
data. (Bug#60560.)
* lisp/erc/erc.el (erc-default-recipients, erc-default-target):
Explain that the variable has fallen out of favor and that the
function may have been used historically by third-party code for
detecting channel subscription status, even though that's never been
the case internally since at least the adoption of version control.
Recommend newer alternatives.
(erc--current-buffer-joined-p): Add possibly temporary predicate for
detecting whether a buffer's target is a joined channel. The existing
means are inconsistent, as discussed in bug#48598. The mere fact that
they are disparate is unfriendly to new contributors. For example, in
the function `erc-autojoin-channels', the `process-status' of the
`erc-server-process' is used to detect whether a buffer needs joining.
That's fine in that specific situation, but it won't work elsewhere.
And neither will checking whether `erc-default-target' is nil, so
long as `erc-delete-default-channel' and friends remain in play.
(erc-add-default-channel, erc-delete-default-channel, erc-add-query,
erc-delete-query): Deprecate these helpers, which rely on an unused
usage variant of `erc-default-recipients'.
* lisp/erc/erc-services.el: remove stray `erc-default-recipients'
declaration.
* lisp/erc/erc-backend.el (erc-server-NICK, erc-server-JOIN,
erc-server-KICK, erc-server-PART): wrap deprecated helpers to suppress
warnings.
* lisp/erc/erc-join.el (erc-autojoin-channels): Use helper to detect
whether a buffer needs joining. Prefer this to server liveliness, as
explained above.
* lisp/erc/erc-track.el (erc-track-modified-channels): Fix what is a
probable bug when a new insert event happens for a buffer that was not
tracked or for which no mode line face was selected: in this case,
stop treating the latest buffer's face (first in list) as the previous
one, which could be overridden with an older one (in FACES' rest), as
if it had happened after.
* lisp/erc/erc-track.el (erc-track-find-face): Declare obsolete and
rewrite as 'erc-track-select-mode-line-face', changing the function
arguments, so that it is very clear what the current algorithm is.
No functional changes. Performance improvements. Clarify the
documentation and remove the part on some faces being lists, which
clearly does not apply.
(erc-track-modified-channels): Replace calls to 'erc-track-find-face'
with calls to 'erc-track-select-mode-line-face', preserving the
existing behavior.
(erc-modified-channels-alist): Change the reference to
'erc-track-select-mode-line-face' in the documentation following the
rename.
* etc/NEWS: Announce the change.
Co-authored-by: Amin Bandali <bandali@gnu.org>
* lisp/erc/erc-track.el (erc-modified-channels-alist): Clarify what
the list contains. Add references to variables and functions involved
in displaying tracked buffers from this list.
(erc-make-mode-line-buffer-name): Describe exactly the algorithm, and
reference custom variables that influence it.
* lisp/erc/erc-track.el (erc-modified-channels-alist): Fix the
docstring: each element is a dotted list where the last cdr is
sometimes a proper list, making the element only sometimes a proper
list.
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.
* lisp/erc/erc-track.el (erc-track-switch-buffer): Factor out the
implementation from here ...
(erc-track--switch-buffer): ... to here.
(erc-track-switch-buffer-other-window): New function, like
`erc-track-switch-buffer', but uses `switch-to-buffer-other-window'
instead, to open the buffer in another window.