summaryrefslogtreecommitdiff
path: root/test/lisp/erc/resources
Commit message (Collapse)AuthorAgeFilesLines
* Merge from savannah/emacs-29Po Lu2024-01-027-7/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-027-7/+7
| |
* | Use advertised PREFIX when formatting nicks in ERCF. Jason Park2023-12-311-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-speedbar.el (erc-speedbar-insert-user): Run `erc-get-channel-membership-prefix' in associated buffer if possible. * lisp/erc/erc.el (erc-get-channel-membership-prefix): Use known prefix mappings when determining status chars. * test/lisp/erc/erc-tests.el (erc--parsed-prefix): Use common helpers for initializing buffers, and use a more realistic example for PREFIX value. (erc--update-channel-modes): Add current buffer to `erc-server-user' object to maintain essential invariant, even though this doesn't affect the test's outcome. (erc-tests--equal-including-properties): Move to `erc-tests-common' and rename `erc-tests-common-equal-with-props'. (erc--merge-prop, erc--remove-from-prop-value-list, erc--remove-from-prop-value-list/many): Use new name for `erc-tests-common-equal-with-props'. (erc-get-channel-membership-prefix): New test. (erc--determine-speaker-message-format-args, erc--determine-speaker-message-format-args/queries-as-channel, erc--determine-speaker-message-format-args/queries): Use new name for `erc-tests-common-equal-with-props'. * test/lisp/erc/resources/erc-tests-common.el (erc-tests-common-equal-with-props): New macro, originally `erc-tests--equal-including-properties' from erc-tests.el. (erc-tests-common-make-server-buf): Initialize tables and make NAME argument optional. (Bug#67677)
* | Fix regression in erc-keep-place-indicator-modeF. Jason Park2023-12-311-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-goodies.el (erc-keep-place): Revert portion of 65735efdca0 "Improve multi-window erc-keep-place-indicator-mode" that skipped modifying `window-prev-buffers' when the indicator's minor mode was enabled. * test/lisp/erc/erc-scenarios-keep-place-indicator.el: Modify test to assert that point's place is preserved after switching away from a buffer with the indicator enabled. * test/lisp/erc/resources/keep-place/follow.eld: Update. This feature was originally introduced by bug#59943.
* | Move ERC test utilities to common fileF. Jason Park2023-12-271-0/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-common.el (erc--define-catalog): Update name of reference to convenience command now located in `erc-tests-common'. * test/lisp/erc/erc-button-tests.el: Require common test-util library `erc-tests-common', located under test/lisp/erc/resources. ; (erc-button-alist--url, ; erc-button-tests--erc-button-alist--function-as-form, ; erc-button-tests--erc-button-alist--nil-form, ; erc-button--display-error-notice-with-keys): Use common helper ; `erc-tests-common-init-server-proc' from test-utils library. * test/lisp/erc/erc-fill-tests.el: Require `erc-tests-common'. (erc-fill-tests--wrap-populate): Use helper `erc-tests-common-init-server-proc'. (erc-fill-tests--save-p): Remove. See replacement `erc-tests-common-snapshot-save-p' in erc-tests-common. (erc-fill-tests--graphic-dir): Add trailing slash. (erc-fill-tests--compare): Move body to generalized utility `erc-tests-common-snapshot-compare' in erc-tests-common. * test/lisp/erc/erc-goodies-tests.el: Require `erc-tests-common'. (erc--get-inserted-msg-beg/readonly, erc--get-inserted-msg-end/readonly, erc--get-inserted-msg-bounds/readonly): Move here from erc-tests.el. * test/lisp/erc/erc-networks-tests.el: Load `erc-tests-common'. (erc-networks-tests--create-live-proc): Defer to `erc-tests-common-init-server-proc' and drop optional buffer param. (erc-networks-tests--clean-bufs): Defer to `erc-tests-common-kill-buffers'. (erc-networks--rename-server-buffer--existing--live): Call `erc-networks-tests--create-live-proc' in server buffer. * test/lisp/erc/erc-scenarios-internal.el: Load `erc-tests-common'. (erc-scenarios-internal--run-graphical-all): Use `erc-tests-common-create-subprocess' to create process. * test/lisp/erc/erc-scenarios-sasl.el (erc-scenarios-sasl--plain-fail): Silence error message. * test/lisp/erc/erc-stamp-tests.el: Require `erc-tests-common'. (erc-stamp-tests--insert-right, erc-timestamp-intangible--left): Use `erc-tests-common-init-server-proc'. (erc-tests--assert-get-inserted-msg/stamp, erc-stamp-tests--assert-get-inserted-msg/stamp): Move from erc-tests.el, renaming to latter. (erc--get-inserted-msg-beg/stamp, erc--get-inserted-msg-beg/readonly/stamp, erc--get-inserted-msg-end/stamp, erc--get-inserted-msg-end/readonly/stamp, erc--get-inserted-msg-bounds/stamp, erc--get-inserted-msg-bounds/readonly/stamp): Move here from erc-tests.el. * test/lisp/erc/erc-tests.el: Require `erc-tests-common'. (erc-with-server-buffer): Use renamed test-helper utility `erc-tests-common-init-server-proc'. (erc-tests--send-prep, erc-tests--set-fake-server-process): Move to `erc-tests-common' library and rename to `erc-tests-common-prep-for-insertion' and `erc-tests-common-init-server-proc', respectively. ; (erc-hide-prompt, erc--refresh-prompt, ; erc-setup-buffer--custom-action, erc--parsed-prefix, ; erc--update-channel-modes, erc--channel-modes, ; erc--channel-modes/graphic-p, erc-ring-previous-command): Use ; `erc-tests-common-prep-for-insertion' instead of ; `erc-tests--send-prep', and use `erc-tests-common-init-server-proc' ; instead of `erc-tests--set-fake-server-process'. (erc-tests--with-process-input-spy): Move to `erc-tests-common' and rename `erc-tests-common-with-process-input-spy'. ; (erc--check-prompt-input-functions, erc-send-current-line, ; erc--check-prompt-input-for-multiline-blanks, ; erc-send-whitespace-lines): Use renamed ; `erc-tests-common-with-process-input-spy' and ; `erc-tests-common-init-server-proc'. ; (erc-process-input-line): Use renamed ; `erc-tests-common-init-server-proc'. (erc-tests--get-inserted-msg-setup, erc-tests--assert-get-inserted-msg, erc-tests--assert-get-inserted-msg/basic, erc-tests--assert-get-inserted-msg-readonly-with): Move to `erc-tests-common' and rename with "common" prefix, using single instead of double hyphen. (erc-tests--assert-get-inserted-msg/stamp): Move to `erc-stamp-tests' and rename with "stamp" prefix. (erc--get-inserted-msg-beg/stamp, erc--get-inserted-msg-beg/readonly/stamp, erc--get-inserted-msg-end/stamp, erc--get-inserted-msg-end/readonly/stamp, erc--get-inserted-msg-bounds/stamp, erc--get-inserted-msg-bounds/readonly/stamp): Move to `erc-stamp-tests'. (erc--get-inserted-msg-beg/readonly, erc--get-inserted-msg-end/readonly, erc--get-inserted-msg-bounds/readonly): Move to `erc-goodies-tests'. ; (erc--get-inserted-msg-beg/basic, ; erc--get-inserted-msg-end/basic, ; erc--get-inserted-msg-bounds/basic): Use common helpers. ; (erc--route-insertion): Use renamed helper functions ; `erc-tests-common-with-process-input-spy' and ; `erc-tests-common-init-server-proc'. (erc-tests--make-server-buf): Move to `erc-common-tests' and rename with "common" prefix. (erc-tests--make-client-buf): Remove unused function without supplying replacement. ; (erc-handle-irc-url): Use renamed `erc-tests-common-make-server-buf' ; utility function. ; (erc-tests--assert-printed-in-subprocess): Use helper from common lib ; `erc-tests-common-create-subprocess code' to do the heavy lifting. (erc-tests--string-to-propertized-parts, erc-tests-pp-propertized-parts): Move to `erc-tests-common' and rename with "common" prefix. * test/lisp/erc/resources/erc-tests-common.el: New file containing helper utilities and fixtures used by multiple files in test/lisp/erc.
* | Allow selecting graphical ERC tests manuallyF. Jason Park2023-12-273-11/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/erc/erc-fill-tests.el (erc-fill-wrap--monospace, erc-fill-wrap--merge, erc-fill-wrap-tests--merge-action, erc-fill-wrap-tests--merge-action/indicator-pre, erc-fill-wrap-tests--merge-action/indicator-post, erc-fill-line-spacing, erc-fill-wrap-visual-keys--body, erc-fill-wrap-visual-keys--prompt, erc-fill--left-hand-stamps): Tag as :erc--graphcial. * test/lisp/erc/erc-scenarios-internal.el (erc-scenarios-internal--run-interactive-all): New test to assist ERC contributors in -jN parallel runs. * test/lisp/erc/erc-scenarios-scrolltobottom-relaxed.el (erc-scenarios-scrolltobottom--relaxed): Tag as :erc--graphical. * test/lisp/erc/erc-scenarios-scrolltobottom.el (erc-scenarios-scrolltobottom--normal, erc-scenarios-scrolltobottom--all): Tag as :erc--graphical. * test/lisp/erc/erc-scenarios-status-sidebar.el (erc-scenarios-status-sidebar--nickbar): Tag as :erc--graphical. * test/lisp/erc/erc-tests.el (erc--channel-modes/graphic-p): Tag as :erc--graphical. * test/lisp/erc/resources/base/local-modules/first.eld: Timeouts. * test/lisp/erc/resources/erc-scenarios-common.el (erc-scenarios-common--graphical-p): New variable. (erc-scenarios-common--make-bindings): Don't enable `inhibit-interaction' when interactive. Set `erc-scenarios-common--graphical-p' flag when `:erc--graphical' tag present and running interactively. (erc-scenarios-common-with-cleanup): Account for variable `erc-scenarios-common--graphical-p'. (erc-scenarios-common-scrolltobottom--normal): Turn off `erc-scrolltobottom-mode' when test finishes so as not to pollute when running multiple interactive tests. ; * test/lisp/erc/resources/join/network-id/barnet.eld: Timeouts.
* | Improve multi-window erc-keep-place-indicator-modeF. Jason Park2023-12-271-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-goodies.el (erc-keep-place-indicator-follow): Describe condition causing an indicator update. (erc--keep-place-indicator-on-window-configuration-change, erc--keep-place-indicator-on-window-buffer-change): Rename former to latter, add required WINDOW parameter, and don't move indicator if buffer appears in multiple windows. Also, don't bother checking whether either buffer is a mini because the manual says window change functions don't run for minibuffer replacements. (erc--keep-place-indicator-setup): Hook on `window-buffer-change-functions' instead of `window-configuration-change-hook'. (erc-keep-place-mode, erc-keep-place-disable): Remove member from `window-buffer-change-functions' instead of `window-configuration-change-hook'. (erc-keep-place): Use `visible' FRAME arg of `get-buffer-window'. Don't twiddle `window-prev-buffers' when `erc-keep-place-indicator-mode' is non-nil. This feature was originally introduced by bug#59943. * test/lisp/erc/erc-goodies-tests.el (erc-goodies-tests--assert-kp-indicator-on, erc-goodies-tests--assert-kp-indicator-off): Update hook name. * test/lisp/erc/erc-scenarios-keep-place-indicator.el: New file. * test/lisp/erc/resources/keep-place/follow.eld: New file.
* | Replace some uses of erc-errorF. Jason Park2023-12-231-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-button.el (erc-button--display-error-notice-with-keys-and-warn): Use `erc--lwarn' so the warnings buffer is overridable for testing. * lisp/erc/erc-sasl.el (erc-sasl-mode, erc-sasl-enable): Signal an `error' instead of calling `erc-error', which continues execution. In this special case, the session cannot continue initializing, since connection registration can't reasonably be expected to complete successfully. (erc-sasl--destroy): Don't run `erc-quit-hook', and issue a warning of level `:error' to get users' attention instead of calling `ding'. * lisp/erc/erc-speedbar.el (erc-speedbar--emulate-sidebar-set-window-preserve-size): Don't set window parameters. Doing this basically made `erc-speedbar-toggle-nicknames-window-lock' unusable. (erc-speedbar--toggle-nicknames-sidebar): Manually unlock the window after toggling. (erc-nickbar-mode, erc-nickbar-enable, erc-nickbar-disable): Don't `ding' when called in a non-ERC buffer, and make sure to call `erc-speedbar--ensure' from an ERC buffer. Also, don't disable minor-mode var when speedbar buffer doesn't exist because that doesn't ensure it'll be created the next time around, and users may count on the activation state remaining consistent. (erc-speedbar-toggle-nicknames-window-lock): Make usable from lisp with explicit numeric arg. * lisp/erc/erc-status-sidebar.el (erc-bufbar-mode, erc-bufbar-enable): Only create the side window from an erc-mode buffer to ensure the ratio is preserved when burying the current buffer, e.g., with `custom-buffer-done'. * lisp/erc/erc.el (erc--warnings-buffer-name, erc--lwarn): New function, an analog of `lwarn', that allows for overriding the warnings buffer with the new variable `erc--warnings-buffer-name'. (erc-cmd-SERVER): Add comment. * test/lisp/erc/erc-scenarios-sasl.el (erc-scenarios-sasl--plain-fail): Expect warning instead of error. * test/lisp/erc/erc-scenarios-status-sidebar.el (erc-scenarios-status-sidebar--bufbar): Refresh when interactive as well. * test/lisp/erc/resources/sasl/plain-failed.eld: Expect EOF instead of "CAP END". (Bug#63595)
* | Use templates for formatting chat messages in ERCF. Jason Park2023-12-174-3/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/erc.texi: Replace option `erc-format-nick-function' with `erc-show-speaker-membership-status'. * etc/ERC-NEWS: Mention shift to template-based speaker formatting. Also mention in-buffer STATUSMSG support and various name changes and new formatting-related options. * lisp/erc/erc-backend.el (erc-format-privmessage): Remove forward declaration. (erc--determine-speaker-message-format-args): Add forward declaration. (erc--statusmsg-target): New utility function for detecting whether the current target is status-prefixed. (erc-current-message-catalog): Move here from lisp/erc/erc.el. (erc--message-speaker-catalog): New variable. (erc--speaker-status-prefix-wanted-p): New variable specifically for the function `erc-format-@nick' to signal it wants status-prefixes prepended to the displayed nick. (erc-server-PRIVMSG): Initialize `let'-bound value of `erc--msg-prop-overrides' to a dummy `erc--tmp' property with a null value that `erc-display-message' will "strip" before calling its hooks. Move away from the rather blunt symbol `msg' as a useful value for `erc--msg'. Instead, allow `erc-display-message' to assign the most appropriate value based on context. Also, bind the variable `erc-current-message-catalog' to whatever the buffer's `erc--message-speaker-catalog' happens to be. Future internal modules can set this to alternative catalogs as needed. Additionally, detect STATUSMSG prefixes on targets and inform the formatting logic of the verdict. Lastly, and most importantly, use the function `erc--determine-speaker-message-format-args' instead of `erc-format-privmessage' for message formatting. Pass along the returned "catalog key" and spec parameters to `erc-display-message'. However, for NOTICEs, continue to render the string, as before, for the two "echo notice" hooks. * lisp/erc/erc-common.el (erc--ctcp-response): New "subsclass" of `erc-response' for smuggling extra information to CTCP query handlers in a mostly backwards-compatible way. The same approach could be taken with the "echo notice" hooks mentioned above. * lisp/erc/erc-dcc.el (erc-dcc-chat-filter): Add `erc--spkr' and `erc--speaker' properties even though these chat buffers are not `erc-mode' buffers. * lisp/erc/erc-fill.el (erc-fill--wrap-last-msg, erc-fill--wrap-max-lull): Add doc strings. (erc-fill--wrap-continued-message-p): Rework to look for `erc--spkr'- `erc--msg' combinations as indicators of speaker continuity. (erc-fill--wrap-rejigger-region): Remove reference to the no longer relevant `erc-stamp-type'. Instead, use the `erc--msg' property combined with the `erc-timestamp' field to detect date stamps because all are currently left-sided. * lisp/erc/erc-stamp.el (erc-stamp--propertize-left-date-stamp): Don't add superfluous `erc-stamp-type' property. * lisp/erc/erc.el (erc--msg-props): Revise purpose and meaning of `erc--msg' by removing possible value `msg', which was previously meant to indicate that a message had a "speaker". Instead, rely on the separate `erc--spkr' property to convey this information, with `erc--msg' now expressing a "type" or "role". (erc--use-language-catalog-for-ctcp-action-p): New variable, a compatibility switch to help transition from the `ACTION' entry of the language catalog to the `ctcp-action' family of entries in the new `-speaker' catalog. (erc--ensure-spkr-prop): Update to include any passed-in environmental overrides. (erc--send-action-display): Restore pre-5.6 behavior when compatibility flag enabled. Otherwise, use new `-speaker' catalog for formatting inserted message. (erc--send-message-external): Overhaul to behave more faithfully in mimicking a line submitted at the prompt of the current target buffer. (erc--own-property-names): Remove `erc-stamp-type'. (erc-ensure-target-buffer-on-privmsg): Add new choice variant for old default behavior and change meaning of default to mean "except for STATUSMSGs". This option is newly revived for ERC 5.6. (erc--message-speaker-statusmsg, erc--message-speaker-statusmsg-input, erc--message-speaker-input, erc--message-speaker-input-chan-privmsg, erc--message-speaker-input-chan-notice, erc--message-speaker-input-query-privmsg, erc--message-speaker-input-query-notice, erc--message-speaker-chan-privmsg, erc--message-speaker-query-privmsg, erc--message-speaker-chan-notice, erc--message-speaker-query-notice, erc--message-speaker-ctcp-action, erc--message-speaker-ctcp-action-input, erc--message-speaker-ctcp-action-statusmsg, erc--message-speaker-ctcp-action-statusmsg-input): New variables for new `speaker' format-template catalog. (erc--speakerize-nick): New helper function. (erc--determine-speaker-message-format-args): New function to find the appropriate format key from various contextual parameters. Could become the default of a function-valued variable for internal use. (erc-show-speaker-membership-status): New option. (erc-format-nick-function, erc-speaker-from-channel-member-function): Declare former as an obsolete alias for the latter, and redefine purpose slightly. (erc-format-nick-function, erc-determine-speaker-from-user): Rename former to latter and obsolete the old name. (erc-format-nick, erc-determine-speaker-from-user): Rename former to latter and obsolete old name. (erc-format-@nick): Deprecate and adapt for use with new template-based formatting paradigm. (erc-format-my-nick): Move `erc-speaker' text prop toward head of list, meaning it will end up beneath `font-lock-face' in the final output. (erc--format-speaker-input-message): New function to replace `erc-format-my-nick' in-tree. (erc-process-ctcp-query): Don't bind `erc--msg' to `msg'. Instead, rely on `erc-display-message' to set it to the current template key. (erc-ctcp-query-ACTION): Prefer using formatting template, but attempt to simulate pre-5.6 behavior when compatibility flag enabled. (erc-display-msg): Use `erc--format-speaker-input-message' instead of `erc-format-my-nick'. Ignore `erc--msg-prop-overrides' with null values. (erc-current-message-catalog): Move to erc-backend.el. * test/lisp/erc/erc-scenarios-base-statusmsg.el: New file. * test/lisp/erc/erc-scenarios-stamp.el (erc-scenarios-stamp--left/display-margin-mode): Expect format catalog key instead of unhelpful `msg' as value of `erc--msg' prop. * test/lisp/erc/erc-tests.el (erc-message): Render format template in mock function and expect string in assertions. (erc-tests--format-privmessage): New function, a helper for the following test. (erc-format-privmessage, erc--determine-speaker-message-format-args): Rename former to latter and suppress deprecation warning. (erc--determine-speaker-message-format-args/queries, erc--determine-speaker-message-format-args/queries-as-channel): New tests. (erc-tests--format-my-nick): New helper function for the following test. (erc--format-speaker-input-message): New test. * test/lisp/erc/resources/base/display-message/statusmsg.eld: New file. (Bug#67677) ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld: ; Update. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld: ; Update.
* | Add erc--spkr text property to chat messagesF. Jason Park2023-12-1711-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Mention combined face ordering for "/me" messages. * lisp/erc/erc-backend.el (erc-server-PRIVMSG): Bind `erc--msg-prop-overrides' for the extent of this function's execution, which means a large amount of code will see this variable as being non-nil. However, no calls to `erc-display-message' or `erc-display-msg' should occur other than the one handling the final insertion. Code needing to influence the current message's "msg props" can push new pairs onto this value, which will override any existing collisions. * lisp/erc/erc-fill.el (erc-fill): Switch to `erc--spkr' as sentinel property. (erc-fill--wrap-continued-message-p): Look for `erc--spkr' property instead of `erc-speaker'. * lisp/erc/erc.el (erc--msg-props): Mention `erc--spkr' in doc. (erc--send-action-perform-ctcp): Add `erc--spkr' property. Fix bug in which `erc-my-nick-face' appeared below `erc-input-face' in the speaker portion. (erc--ensure-spkr-prop): New helper function to propagate speaker metadata. (erc--ranked-properties): Add `erc--spkr', `erc--ctcp', and `erc--ephemeral'. (erc-display-message): Use default hash table size when initializing. Remove unnecessary assignment of `msg' to `erc--msg' for PRIVMSG and NOTICE commands. Bind `string' below `erc--msg-props' so that implementers of the function form of the `erc-format-message' templating interface can read and write the current context's "msg props". (erc--own-property-names): Add all `erc--msg-props' props by subsumation. (erc--get-speaker-bounds): Use `erc--spkr' instead of `erc--msg' as a sentinel to detect a chat message guaranteed to have an `erc--speaker' text-property interval. (erc-format-privmessage, erc-format-my-nick, erc-ctcp-query-ACTION): Add `erc--spkr' to `erc--msg-prop-overrides' when available. * test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--insert-privmsg): Bind `erc--msg-prop-overrides'. (erc-fill-tests--compare): Require environment variable value to match current test name exactly when saving snapshots. Add `erc--msg-props' individually to white list. * test/lisp/erc/erc-tests.el (erc--order-text-properties-from-hash): Include `erc--spkr'. (Bug#60936) (Bug#67677) ; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld: ; Update. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld: ; Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.
* | Add erc-server-396 response handlerF. Jason Park2023-12-171-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-backend.el (erc-server-396, erc-server-396-functions): Define response handler for 396 numeric. For now, always display the message in the active buffer rather than bother with something like `erc-once-with-server-event' to try and suss out when this is a response to something client-initiated, like a /VHOST. Do this despite most users probably wanting the message to appear in the server buffer alone when the response is server-initiated. The `labeled-response' extension will hopefully make dealing with such matters less of a crapshoot. * lisp/erc/erc.el (erc--parse-user-regexp-pedantic): Tweak slightly to allow null groups and favor host. (erc--parse-user-regexp-legacy, erc--parse-user-regexp): Remove the first variable but preserve its value as that of the second. (erc--parse-nuh): New function. The behavior is nuanced and complex and so not easily described in a doc string. (erc-message-english-396): Define format template for 396 response. * test/lisp/erc/erc-scenarios-misc-commands.el (erc-scenarios-misc-commands--VHOST): New test. * test/lisp/erc/erc-tests.el (erc-parse-user): Move "pedantic" section to new test. (erc--parse-nuh): New test. * test/lisp/erc/resources/commands/vhost.eld: New test data file. (Bug#67677)
* | Double hyphenate internal ERC 5.6 text propsF. Jason Park2023-12-1711-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-fill.el (erc-fill, erc-fill-static, erc-fill--wrap-continued-message-p, erc-fill-wrap, erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text properties. Rename `erc-speaker' to `erc--speaker'. * lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename `erc-msg' to `erc--msg'. * lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp, erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify, erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify, erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf): Rename "msg props" with second hyphen. * lisp/erc/erc-track.el (erc-track--skipped-msgs, erc-track-modified-channels): Rename "msg prop" text properties with second hyphen. * lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated "msg prop" names. (erc--send-action-display erc--get-inserted-msg-bounds, erc--traverse-inserted, erc-insert-line, erc-display-line, erc--ranked-properties, erc-display-message, erc--get-speaker-bounds, erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names to have two hyphens. (erc--send-action-display, erc--own-property-names, erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick, erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'. * test/lisp/erc/erc-scenarios-display-message.el (erc-scenarios-display-message--multibuf): Double hyphenate "msg prop" text properties. * test/lisp/erc/erc-scenarios-match.el (erc-scenarios-match--hide-fools/stamp-both/fill-wrap, erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak, erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg prop" names. * test/lisp/erc/erc-scenarios-stamp.el (erc-scenarios-stamp--on-post-modify, erc-scenarios-stamp--left/display-margin-mode, erc-scenarios-stamp--legacy-date-stamps, erc-scenarios-stamp--on-insert-modify, erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to all "msg props". Rename `erc-speaker' to `erc--speaker'. * test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg prop". * test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds, erc--delete-inserted-message, erc--order-text-properties-from-hash, erc--route-insertion): Rename "msg props" with second hyphen. (erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'. (Bug#60936) (Bug#67677) ; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: ; Add second hyphen to msg props. ; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: ; Add second hyphen to msg props.
* | Sequester some special-variable declarations in ERCF. Jason Park2023-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely. (erc-server-reconnect): Move declaration for `erc-reuse-buffers' here. (erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit' declaration here. (erc--conceal-prompt): Move `erc-prompt-hidden' declaration here. (erc-server-INVITE): Move `erc-invitation' declaration here. (erc-server-PART): Move `erc-kill-buffer-on-part' declaration here. (erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored', `erc-receive-query-display', `erc-receive-query-display-defer', `erc--cmem-from-nick-function', `erc-format-nick-function', and `erc-format-query-as-channel-p' here. (erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here. (erc-server-475): Move `erc--called-as-input-p' and `erc-prompt-for-channel-key' declarations here. * lisp/erc/erc-common.el (erc-log-p): Remove declaration for `erc-log-p' and replace with actual definition. (erc-log-aux): Move `erc-dbuf' declaration from top level into function body. * lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in the doc string that this function produces side effects. * lisp/erc/erc-networks.el (erc-determine-network, erc-networks--copy-server-buffer-functions): Move some variable declarations to function body. (erc-settings, erc-get): Deprecate for now and explain why in doc strings. We could deprecate them unconditionally, but they never provided usable code, and their names are short and valuable. * lisp/erc/erc.el (tabbar--local-hlf, motif-version-string, gtk-version-string): Prefer moving these single-serving declarations to function bodies, if only to make closures from this library less cluttered when debugging. This should also help avoid stray declarations. (erc-hooks, erc-timer-hook): Revise doc strings. (erc-log-p): Move definition to erc-common.el. (erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in combination with special-variable declarations, instead of `boundp' or similar. (erc-header-line-uses-tabbar-p): Explain that this has nothing to do with `tab-bar'. (erc-update-mode-line-buffer): Only assign when bound. This has been verified to work with version 2.0 on EmacsWiki. * test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts. * test/lisp/erc/erc-scenarios-base-renick.el: Timeouts. * test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.
* | Restore prompt correctly when reconnecting in ERCF. Jason Park2023-11-261-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--initialize-markers): Commit 0d6c8d41ab7 "Use overlay instead of text prop to hide ERC's prompt" introduced a bug that caused the prompt to remain hidden upon reconnecting because the stashed overlay would get clobbered by ERC's major-mode setup. Binding its old value while unhiding fixes the issue. * test/lisp/erc/erc-tests.el (erc-hide-prompt): Don't permanently set the default value of `erc-hide-prompt'. * test/lisp/erc/resources/erc-scenarios-common.el (erc-scenarios-common--join-network-id): Add assertions for prompt hiding and unhiding on reconnect. (Bug#51082)
* | ; Mark test for erc--update-channel-modes as :unstableF. Jason Park2023-11-252-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/erc/erc-scenarios-auth-source.el (erc-scenarios-common--auth-source): Extend timeout. * test/lisp/erc/erc-scenarios-base-buffer-display.el (erc-scenarios-base-buffer-display--count-reset-timeout): Await initial condition. * test/lisp/erc/erc-scenarios-base-renick.el (erc-scenarios-base-renick-queries-solo): Extend timeout. * test/lisp/erc/erc-scenarios-misc.el (erc-scenarios-base-flood): Extend timeout. * test/lisp/erc/erc-tests.el (erc--channel-modes): Mark test as :unstable pending further investigation. This test has been shown to be unreliable, possibly because it expects Emacs to report characters being a certain width in all environments. Thanks to Mattias Engdegård for reporting this failure. * test/lisp/erc/resources/base/reuse-buffers/server/barnet.eld: Extend timeouts. * test/lisp/erc/resources/base/reuse-buffers/server/foonet.eld: Extend timeouts.
* | Add merged-message indicator option for erc-fill-wrapF. Jason Park2023-11-242-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-fill.el (erc-fill): Use `when-let' instead of `when-let*'. (erc-fill-wrap-merge): Mention companion options in doc string. (erc-fill-wrap-merge-indicator): New option to display a distinguishing "indicator" in the form of a one-character string between messages from the same speaker. (erc-fill-wrap-mode, erc-fill-wrap-disable): Mention `erc-fill-wrap-merge-indicator' in doc string and kill related local variables. (erc-fill--wrap-merge-indicator-pre, erc-fill--wrap-merge-indicator-post): New internal variables for caching merge indicator. (erc-fill--wrap-insert-merged-post, erc-fill--wrap-insert-merged-pre): New functions for adding merge indicators either before or after a message. (erc-fill-wrap): Add logic for deferring to merge-indicator helpers when needed. * test/lisp/erc/erc-fill-tests.el (erc-fill-wrap-tests--merge-action, erc-fill-wrap--merge-action): Move body of latter test into former, a new fixture function. (erc-fill-wrap--merge-action/indicator-pre, erc-fill-wrap--merge-action/indicator-post): New tests. * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld: New test data file. * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld: New test data file. (Bug#60936)
* | Favor ISUPPORT params for MODE processing in ERCF. Jason Park2023-11-181-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for dictating MODE parsing behavior. * lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes, erc-set-modes, erc-update-modes): Forward declarations, the last two being removals. (erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of `erc-update-modes'. (erc-server-324): Use `erc--init-channel-modes' instead of `erc-set-modes'. * lisp/erc/erc-common.el (erc--channel-mode-types): New struct for stashing processed \"CHANMODES\" data for the current server. * lisp/erc/erc.el (erc-channel-modes): Fix doc string. (erc-set-initial-user-mode): Display a local notice when requesting redundant user MODE operations. (erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for reasons explained in associated ERC-NEWS entry. (erc--update-membership-prefix): New function, a helper for specifying arguments to the rather unruly `erc-update-current-channel-member'. (erc--channel-modes): New variable to record channel-mode state in a hash table. (erc--channel-mode-types): New variable and getter to stash and retrieve server-local instance of the struct of the same name. (erc--process-channel-modes): New function to parse channel-mode changes, dispatch handlers for unary modes, and update the local variables `erc-channel-modes' and `erc--channel-modes'. (erc--user-modes): New local variable for remembering user modes per server. New function of the same name, a "getter" for the variable. (erc--parse-user-modes): New function to parse user modes only. (erc--update-user-modes): New function to update and sort `erc--user-modes'. (erc--update-channel-modes): New function to replace much of `erc-update-modes', currently a thin wrapper around `erc--process-channel-modes' to ensure it updates status prefixes. (erc--update-modes): New function to call appropriate mode-updating function for the current buffer. (erc--init-channel-modes): New function to update channel mode letters without status prefixes. (erc--handle-channel-mode): New generic function, a placeholder for an eventual API to handle specific "unary" mode letters, meaning those that specify a single parameter for setting or unsetting. (erc-update-channel-limit): Update doc string and answer question posed by ancient comment. (erc-message-english-user-mode-redundant-add, erc-message-english-user-mode-redundant-drop): New English catalog messages. * test/lisp/erc/erc-scenarios-base-chan-modes.el: New file. * test/lisp/erc/erc-tests.el (erc-parse-modes, erc--update-channel-modes, erc--update-user-modes, erc--user-modes, erc--parse-user-modes): New tests. * test/lisp/erc/resources/base/modes/chan-changed.eld: New test data file. (Bug#67220)
* | Add test for erc-cmd-SQUERYF. Jason Park2023-11-182-0/+31
| | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-backend.el (erc-message): Revise doc string. * test/lisp/erc/erc-scenarios-base-misc-regressions.el (erc-cmd-MOTD): Move test to another file specifically for slash commands. * test/lisp/erc/erc-scenarios-misc-commands.el: New file. * test/lisp/erc/resources/base/commands/motd.eld: Move file elsewhere. * test/lisp/erc/resources/commands/motd.eld: "New" file, moved here reusing the same Git blob from now deleted subdir base/commands. * test/lisp/erc/resources/commands/squery.eld: New file. (Bug#67209)
* | ; Prepare for ERC 5.6 releaseF. Jason Park2023-11-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/erc.texi: Minor tweak in SASL section. * etc/ERC-NEWS: Revise various sections under 5.6. * lisp/erc/erc-button.el (erc-button-alist): Remove comment. (erc-nick-popup-alist): Remove comment. * lisp/erc/erc-fill.el (erc-fill-wrap-margin-width): Remove comment. (erc-fill-wrap-margin-side): Remove comment. (erc-fill-line-spacing): Remove comment. (erc-fill-wrap-use-pixels): Remove comment. (erc-fill-wrap-visual-keys): Remove comment. (erc-fill-wrap-force-screen-line-movement): Remove comment. (erc-fill-wrap-merge): Remove comment. * lisp/erc/erc-goodies.el (erc-scrolltobottom-all): Remove comment. (erc-keep-place-indicator-style): Remove comment. (erc-keep-place-indicator-buffer-type): Remove comment. (erc-keep-place-indicator-follow): Remove comment. * lisp/erc/erc-networks.el (erc-server-alist): Remove comment. * lisp/erc/erc-nicks.el (erc-nicks): Remove comment. * lisp/erc/erc-speedbar.el (erc-speedbar-nicknames-window-width): Remove comment. (erc-speedbar-hide-mode-topic): Remove comment. (erc-speedbar-my-nick-face): Remove comment. * lisp/erc/erc-stamp.el (erc-timestamp-format-right): Remove comment. (erc-echo-timestamp-zone): Remove comment. (erc-timestamp-use-align-to): Remove comment. * lisp/erc/erc-status-sidebar.el (erc-status-sidebar-highlight-active-buffer): Remove comment. (erc-status-sidebar-style): Remove comment. (erc-status-sidebar-click-display-action): Remove comment. * lisp/erc/erc.el: Bump required Compat version to 29.1.4.3 in Package-Requires header. (erc-notice-face): Remove comment. (erc-action-face): Remove comment. (erc-interactive-display): Remove comment. (erc-auto-reconnect-display-timeout): Remove comment. (erc-reconnect-display-server-buffers): Remove comment. (erc-modules): Remove comment. * test/lisp/erc/resources/base/display-message/multibuf.eld: Remove reference to specific ERC version in QUIT command reason. * test/lisp/erc/resources/base/assoc/reconplay/foonet.eld: Timeout.
* | Make nested input handling more robust in ERCF. Jason Park2023-11-121-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--send-action-function): New function-valued variable for locally advising `erc-send-action' so that built-in modules can elect to handle insertion and sending themselves. (erc-send-action): Defer to `erc--send-action-function'. (erc--send-action-perform-ctcp): Isolate the message-sending business for CTCP ACTIONs that used to reside in `erc-send-action'. (erc--send-action-display): Isolate the message-insertion business formerly residing in `erc-send-action' for more granular use. Fix a minor bug involving inserted representations of CTCP ACTIONs not having `erc-my-nick-face' applied to the speaker. (erc--send-action): Perform the same displaying and sending of CTCP ACTION messages formerly handled by `erc-send-action', but display messages before sending them. (erc--current-line-input-split): New variable bound to the post-review `erc--input-split' object for the extent of display processing. This mainly benefits slash-command handlers and the utility functions they employ, such as `erc-send-message'. (erc-cmd-SAY): Defer to `erc--send-message'. (erc--send-message-nested-function): New function-valued variable supporting an internal interface for influencing how `erc-send-message' inserts and sends prompt input. Some handlers for slash commands, like /SV, use `erc-send-message' to perform their own insertion and sending, which is normally the domain of `erc-send-current-line'. When this happens, modules can't easily leverage the normal hook-based API to do things like suppress insertion but allow sending or vice-versa. This variable provides an internal seam for modules to exert such influence. (erc-send-message): Behave specially when called by the default interactive client via `erc-send-current-line' and friends. (erc--send-message-external): New function to house the former body of `erc-send-message', for third-party code needing to apply the traditional behavior. (erc--send-message-nested): New function for turning arbitrary text, such as replacement prompt input, into outgoing message text by doing things like ensuring "send" hooks run and invariants for prompt markers are preserved. (erc--make-input-split): New helper function for creating a standard `erc--input-split' object from a string. This is arguably less confusing than adding another constructor to the struct definition. (erc-send-current-line): Bind `erc--current-line-input-split' when dispatching prompt-input handlers. Use helper `erc--make-input-split' to initialize working `erc--input-split' state object. (erc--run-send-hooks): Honor existing `refoldp' slot from `erc--input-split' object. (erc--send-input-lines): Convert to generic function to allow modules control over fundamental insertion and sending operations, which is necessary for next-generation features, like multiline messages. (erc-modes): Don't output non-modules. That is, only list actual modules created via `define-erc-module', and `quote' members of the resulting list. * test/lisp/erc/erc-scenarios-base-send-message.el: New test file. * test/lisp/erc/resources/base/send-message/noncommands.eld: New data file. (Bug#67031)
* | Align date stamps to whole days in ERCF. Jason Park2023-11-043-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-stamp.el (erc-stamp--current-time): Ditch overriding precedence of the `erc--ts' property in `:around' method because the variable `erc-stamp--current-time' fills that role well enough. (erc-stamp--current-datestamp-left): Remove unused variable. (erc-stamp--insert-date-stamp-as-phony-message): Assume `erc-timestamp-last-inserted-left' has already been assigned the updated rendered stamp for the current time. (erc-stamp--lr-date-on-pre-modify): Use the variable `erc-stamp--current-time' instead of the `erc-ts' property to convey an overriding time value for `erc-add-timestamp'. Set `erc-timestamp-last-inserted-left' instead of fiddling with another temporary variable to hack around these ill-fitting interfaces. Use day-aligned time value for the `erc-ts' property assigned to date stamps. (erc-stamp--date-mode): New internal minor mode. (erc-insert-timestamp-left-and-right): Defer to `erc-stamp--date-mode' for setting up date-stamp specific hooks. (erc-stamp--time-as-day): New function to "round" a date stamp to start of local day. (erc-stamp--setup): Defer to `erc-stamp--date-mode' for date-stamp specific teardown. (Bug#60936) * test/lisp/erc/erc-fill-tests.el (erc-fill-tests--current-time-value): Change default value to nil. (erc-stamp--current-time): New method for test cases. (erc-fill-tests--insert-privmsg): Use realistic value for `unparsed' slot. (erc-fill-tests--wrap-populate): Bind `erc-fill-tests--current-time-value' to 0. Don't mock the function `erc-stamp--current-time' because doing so inhibits normal polymorphic dispatch, which test cases rely on for delivering correct timestamp values in varied contexts. ; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
* | Really fix off-by-one in erc--get-inserted-msg-boundsF. Jason Park2023-11-042-2/+2
| | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--get-inserted-msg-bounds): Account for `previous-single-property-change' returning a position adjacent to that with an actual changed value. The prior attempt at addressing this was insufficient. * test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds): New test. ; * test/lisp/erc/resources/base/local-modules/second.eld: Timeout. ; * test/lisp/erc/resources/base/local-modules/third.eld: Timeout.
* | ; Attempt to fix race in erc-buffer-display testF. Jason Park2023-11-015-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/erc/erc-fill-tests.el (erc-fill-tests--time-vals, erc-fill-tests--current-time-value): Rename former to latter and change type from function to natnum. (erc-fill-tests--wrap-populate, erc-fill-wrap--merge, erc-fill-wrap--merge-action): Use `erc-fill-tests--current-time-value' instead of function `erc-fill-tests--time-vals'. * test/lisp/erc/erc-scenarios-base-association.el (erc-scenarios-common--base-association-multi-net): Extend timeout. * test/lisp/erc/erc-scenarios-base-buffer-display.el (erc-scenarios-base-buffer-display--reconnect-common): Move some common assertions here from callers. (erc-scenarios-base-buffer-display--defwin-recbury-intbuf, erc-scenarios-base-buffer-display--count-reset-timeout): Factor out a couple common assertions. Clarify some comments. (erc-scenarios-base-buffer-display--defwino-recbury-intbuf): Factor out a couple common assertions and clarify some comments. Account for possible concurrency bug leading to intermittent test failures. * test/lisp/erc/erc-scenarios-base-misc-regressions.el (erc-scenarios-base-gapless-connect, erc-scenarios-base-channel-buffer-revival): Extend timeouts. * test/lisp/erc/resources/dcc/chat/accept.eld: Extend timeout. * test/lisp/erc/resources/base/reconnect/options-again.eld: Extend timeouts. * test/lisp/erc/resources/erc-d/erc-d.el (erc-d--m): Prevent possible wrong-type error. * test/lisp/erc/resources/erc-d/resources/dynamic-foonet.eld: Extend timeouts. * test/lisp/erc/resources/erc-scenarios-common.el (erc-scenarios-common--base-network-id-bouncer): Extend timeout.
* | Tidy up ERC's internal text-property APIF. Jason Park2023-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-fill.el (erc-fill--spaced-commands): Remove unused internal variable originally intended for ERC 5.6. (erc-fill): Check for `erc-msg' being `msg', which carries the same meaning as `erc-cmd' being `PRIVMSG' or `NOTICE', except that inserted outgoing messages now no longer normally have an `erc-cmd' property. (erc-fill-wrap-mode, erc-fill-wrap-disable): Kill `erc-fill--wrap-last-msg'. (erc-fill--wrap-max-lull): Convert from buffer-local to normal variable. (erc-fill--wrap-continued-message-p): Rework slightly to guard against resetting the "last speaker" marker when the `erc-ephemeral' text property is present. This tells insert- and send-related hook members to pretend the current message doesn't exist when performing stateful operations. That is, modules should expect the message being inserted to possibly disappear or be replaced. Also, look for `erc-msg' being `msg' instead of `erc-cmd' being `PRIVMSG', and fix bug involving only checking `erc-ctcp' in the current message. * lisp/erc/erc-stamp.el (erc-add-timestamp): Don't insert timestamps when the `erc-ephemeral' text property is present. * lisp/erc/erc.el (erc--msg-props): Add doc string explaining the purpose of this variable and the various text properties most commonly present in its value. (erc--msg-prop-overrides): Add doc string. (erc-send-action): Don't set `erc-cmd' prop on outgoing CTCP ACTIONs. (erc-display-message): Reverse overrides to prefer items toward the front of the alist. (erc-process-ctcp-query): Include existing overrides from environs. (erc-send-current-line): Include existing overrides from environs. (erc-display-msg): Fix doc string and reverse overrides. * test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg): Remove stray comment. (erc-fill-tests--save-p): Set value from environment variable. (erc-fill-tests--compare): Limit writing snapshots to one test at a time. (erc-fill-wrap--merge-action): Fix expected output for non-action messages that follow action messages. These were previously merged but escaped detection. * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update. (Bug#60936)
* | Use marker for max pos in erc--traverse-insertedF. Jason Park2023-10-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-stamp.el (erc-stamp--propertize-left-date-stamp): Run `erc-stamp--insert-date-hook' separately here instead of via `erc-insert-modify-hook'. (erc-stamp--insert-date-stamp-as-phony-message): Don't include value of `erc-stamp--insert-date-hook' in let-bound `erc-insert-modify-hook' because its members can run twice if buffer-local. Remove `erc-send-modify-hook' because it only runs via `erc-display-msg'. Shadow "pre" and "done" hooks because they don't expect to run in a narrowed buffer. Call getter for `erc-stamp--current-time'. (erc-stamp--lr-date-on-pre-modify, erc-insert-timestamp-left-and-right): Use function form of `erc-stamp--current-time' for determining current time stamp. * lisp/erc/erc.el (erc--get-inserted-msg-bounds): Fix off-by-one like thinko. (erc--traverse-inserted): Create temporary marker when END is a buffer position so that insertions and deletions are accounted for in the terminating condition. (erc--delete-inserted-message): New function. * test/lisp/erc/erc-tests.el (erc--delete-inserted-message): New test. (erc--update-modules/unknown): Improve readability slightly. * test/lisp/erc/resources/erc-d/erc-d-t.el (erc-d-t-make-expecter): Indicate assertion flavor in error message. (Bug#60936)
* | Rename erc-server-buffer-pF. Jason Park2023-10-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* | Restore missing metadata props in erc-display-lineF. Jason Park2023-10-2010-9/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Designate `erc-display-message' as the favored means of inserting messages. * lisp/erc/erc-fill.el (erc-fill-wrap): Skip any `unknown' `erc-msg'. * lisp/erc/erc-stamp.el (erc-stamp--current-time): Use an existing `erc-ts' text property, when present, for the current message time. * lisp/erc/erc.el (erc-display-line-1, erc-insert-line): Update doc string and declare the former an obsolete alias for the latter, `erc-insert-line'. Have `erc-log' label say `erc-display-message' even though this function is actually `erc-insert-line'. (erc-display-line): Convert to a thin wrapper around `erc-display-message', and move its existing body to a new internal function, `erc--route-insertion'. (erc--route-insertion): Adopt former body of `erc-display-line', now a convenience wrapper around `erc-display-message'. Copy `erc--msg-props' hash table when inserting a message in multiple buffers. At present, only `erc-server-QUIT' uses this facility, so such a move shouldn't impact performance in any measurable way. Also, improve readability with at most one recursive call for the fall-through case. (erc--compose-text-properties, erc--merge-text-properties-p): Rename former to latter to avoid confusion with `composition' property. (erc-display-message): Update doc string. Attempt to adapt a non-nil TYPE parameter for use as the value of the `erc-msg' text property before resorting to a value of `unknown'. But only do this when PARSED is nil, and MSG is a string. Call `erc--route-insertion' instead of `erc-display-line'. Use new name for `erc--compose-text-properties'. (erc-put-text-property): Update name of variable `erc--compose-text-properties'. * test/lisp/erc/erc-networks-tests.el (erc-networks--set-name): Mock `erc--route-insertion' instead of `erc-display-line'. * test/lisp/erc/erc-scenarios-display-message.el: New file. * test/lisp/erc/erc-tests.el (erc--route-insertion): New test. * test/lisp/erc/resources/base/display-message/multibuf.eld: New test data. ; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update. ; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update. (Bug#60936)
* | ; Mark erc-log test as :unstableF. Jason Park2023-10-204-5/+5
| | | | | | | | | | | | | | | | | | * test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--truncate): Mark :unstable for now. * test/lisp/erc/resources/base/renick/queries/solo.eld: Timeouts. * test/lisp/erc/resources/base/reuse-buffers/channel/barnet.eld: Timeouts. * test/lisp/erc/resources/base/reuse-buffers/channel/foonet.eld: Timeouts. * test/lisp/erc/resources/erc-scenarios-common.el: Timeouts.
* | Manage some text props for ERC insertion-hook membersF. Jason Park2023-10-1310-9/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Mention that ERC only adds the text property `cursor-sensor-functions' when `erc-echo-timestamps' is enabled. Also mention that date stamps are now inserted as separate messages. * lisp/erc/erc-fill.el (erc-fill): Look for text prop `erc-cmd' instead of `erc-command' and use helper utility to do so. (erc-fill-static): Skip date stamps because this fill style leaves them flush left. (erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable): Don't hook on the soon-to-be-removed function interface `erc-stamp--insert-date-function' because date stamps are now separate messages. (erc-fill--wrap-continued-message-p): Restore accidentally discarded doc string. Derive context about current message from text props at `point-min', and use updated property names and utility functions. Abort when previous message is now hidden. (erc-fill--wrap-stamp-insert-prefixed-date): Remove unused function, originally meant to be new in ERC 5.6, and move logic for date-stamp measuring portion directly to `erc-fill-wrap' itself. (erc-fill--wrap-measure): New helper function. (erc-fill-wrap): Use helper `erc-fill--wrap-measure' and incorporate date-stamp detection and width measuring from removed helper. Don't dedent first word for messages of unknown origin, such as those inserted by `erc-display-line' alone without prior preparation from `erc-display-message'. * lisp/erc/erc-goodies.el (erc-readonly-mode, erc-readonly-enable): Set hook depth explicitly to 70. * lisp/erc/erc-stamp.el (erc-timestamp-format-left): Mention that a trailing newline is implicit if not provided and that users who don't want date stamps should use `erc-timestamp-format-right' instead. (erc-stamp-mode, erc-stamp-enable): Call `erc-stamp--setup' instead of `erc-munge-invisibility-spec', and bump hook depth for `erc-add-timestamp' to 70. (erc-stamp--current-time): Use `erc-ts' instead of `erc-timestamp' text property in doc string. (erc-stamp--skip): New internal variable. (erc-stamp--allow-unmanaged): New variable for legacy code to force `erc-add-timestamps' to run when `erc--msg-props' is nil. (erc-add-timestamp): Always run when `erc-stamp--allow-unmanaged' is non-nil unless `erc-stamp--skip' is as well because the latter takes precedence. Don't add `erc-ts' text prop directly unless `erc-stamp--allow-unmanaged is non-nil. Instead, use the new `erc--msg-props' facility to defer until after modification hooks. Likewise, don't add `cursor-senor-functions' directly either unless the same compatibility flag is enabled. Instead, expect the latter to be handled by a post-modify hook conditioned on the option `erc-echo-timestamps'. (erc-timestamp-last-inserted-left): Mention that the final trailing newline specified in the format string no longer appears in the recorded value. (erc-stamp-prefix-log-filter): Use updated name for timestamp property as well as helper utility for accessing it. (erc-stamp--inherited-props): Add doc string. (erc-insert-timestamp-right): Fix bug involving object cycle where the time-stamp string would appear in its own `display' property. (erc-stamp--insert-date-function, erc-stamp--insert-date-hook): Remove unused internal function-valued interface variable and replace with the latter, a normal hook. (erc-stamp--date-format-end, erc-stamp--propertize-left-date-stamp): New function and auxiliary variable to apply date stamp properties at the post-modify stage. Add text property `erc-stamp-type' to inserted date stamps to help folks distinguish between them and other left-sided stamps. (erc-stamp--current-datestamp-left, erc-stamp--format-date-stamp, erc-stamp--insert-date-stamp-as-phony-message, erc-stamp--lr-date-on-pre-modify): New functions and state variable to help ERC treat date stamps as separate messages while working within the established mechanism for processing inserted messages. Shadow `erc-stamp--invisible-property' when calling `erc-format-timestamp' in order to prevent date stamps from inheriting other `invisible' props. These date stamps are special in that they have no business being hidden along with the current message. (erc-insert-timestamp-left-and-right): On initial run in any buffer, remember whether the date stamp needed newline massaging on insertion. Move all business for inserting date stamps to post-modify hooks, but run them forcibly if this is the very first date stamp in the current buffer. Also mention some specifics related to relevant text props in the doc string. (erc-format-timestamp): Don't add `invisible' prop to stamp unless `erc-stamp--invisible-property' is non-nil. (erc-stamp--csf-props-updated-p): New local variable. (erc-munge-invisibility-spec): Restore `cursor-sensor-functions' text property for existing messages when a user enables the option mid-session. Add and remove hooks for use with automatic timestamp echoing. (erc-stamp--add-csf-on-post-modify): New function to add `cursor-sensor-functions' property on post-modify hooks. (erc-stamp--setup): Perform some additional teardown. (erc-stamp--on-clear-message): Look for text property `erc-ts' instead of `erc-timestamp'. (erc-echo-timestamp, erc--echo-ts-csf): Use utility to find time-stamp text prop in current message. (erc-stamp--update-saved-position, erc-stamp--reset-on-clear): Use hook `erc-stamp--insert-date-hook' instead of excised function-valued variable interface `erc-stamp--insert-date-function'. * lisp/erc/erc-truncate.el (erc-truncate-buffer-to-size): Use internal utility to find beginning of message. * lisp/erc/erc.el (erc--msg-props, erc--msg-props-overrides): New internal variables for initializing and conveying metadata-oriented text properties among insert and send hooks. (erc-insert-modify-hook): Mention reserved depth ranges for built-in members in doc string. (erc-send-action): Use convenience variable to modifying text props instead of awkwardly overriding `erc-insert-pre-hook'. (erc--check-msg-prop, erc--get-inserted-msg-bounds, erc--get-inserted-msg-prop, erc--with-inserted-msg, erc--traverse-inserted): New utility functions and macros to help modules find metadata and message-delimiting text props. (erc-display-line-1): Ensure the first character of every message in an ERC buffer has the `erc-msg' property, as well as any other props in `erc--msg-props', when populated. (erc--hide-message): Don't bother offsetting start of first message in a buffer. (erc--ranked-properties, erc--order-text-properties-from-hash): New variable and function to convert `erc--msg-props' into a plist suitable for `add-text-properties'. (erc-display-message): Make doc string more informative. Bind and initialize `erc--msg-props' for use by all hooks. Respect `erc--msg-prop-overrides' when non-nil. Don't add `erc-command' property. Instead, ensure `erc--msg-props' contains an `erc-cmd' item when the parameter PARSED is non-nil. (erc--own-property-names): Add `erc-stamp-type'. (erc--get-speaker-bounds): Use helper to find message start. (erc-process-ctcp-query, erc-send-current-line): Use convenience variable to leverage framework for manipulating message metadata instead of overriding `erc-insert-pre-hook'. (erc-display-msg): Bind `erc--msg-props' for use by all send-related hooks. Add text props from table after `erc-send-post-hook'. (erc-restore-text-properties): Improve doc string. (erc--get-eq-comparable-cmd): Use `if-let' instead of `if-let*'. * test/lisp/erc/erc-fill-tests.el (erc-fill-tests--insert-privmsg): Make phony message more realistic. (erc-fill-tests--wrap-populate): Shorten overlong line. (erc-fill-tests--wrap-check-prefixes): Make test utility more vigilant in asserting no gaps exist in `line-prefix' property interval. (erc-fill-tests--compare): Compare text props on text-prop values that are themselves strings. * test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--clear-stamp): Ensure `erc-stamp' is loaded. * test/lisp/erc/erc-scenarios-match.el (erc-scenarios-match--stamp-left-current-nick, erc-scenarios-match--invisible-stamp): Use `default-value' for `erc-insert-modify-hook' in ordering assertion. (erc-scenarios-match--find-bol, erc-scenarios-match--find-eol): Remove unused assertion helper functions. (erc-scenarios-match--stamp-right-fools-invisible): Remove misplaced ERT tag from function and use utility to find message bounds. (erc-scenarios-match--stamp-right-fools-invisible): Use real utility from main library to find message end. (erc-scenarios-match--fill-wrap-stamp-dedented-p): New assertion utility function. (erc-scenarios-match--hide-fools/stamp-both/fill-wrap) New test. (erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak): New test. (erc-scenarios-match--stamp-both-invisible-fill-static): Expect `erc-cmd' at beginning of inserted message's filled line, even if the line starts with white space. Also, add new function parameter `assert-ds', a callback to run when visiting the second date stamp, which is followed by a hidden message. In the test of the same name, expect the date stamp's invisibility interval to begin at the newline after the previous message and to not contain any existing invisibility props, namely, those belonging to the subsequent hidden "fools" message. Also use shortened "metadata" text prop names. (erc-scenarios-match--stamp-both-invisible-fill-static--nooffset): Expect the date stamp's invisibility interval to match its field's instead of starting and ending sooner. * test/lisp/erc/erc-stamp-tests.el: Put well-known metadata prop at the start of the message. * test/lisp/erc/erc-tests.el (erc--refresh-prompt): Prevent modules from mutating hooks. (erc--order-text-properties-from-hash, erc--check-msg-prop): New tests. * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update test data. * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update test data. * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update. * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update. * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update. * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update. * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update. * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update. * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update. * test/lisp/erc/resources/match/fools/fill-wrap.eld: New file. (Bug#60936)
* | Allow spoofing process marker in erc-display-line-1F. Jason Park2023-10-137-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--insert-marker): New internal variable for overriding `erc-insert-marker' when displaying messages at a non-default location in the buffer. (erc-display-line-1): Favor `erc--insert-marker' over `erc-insert-marker' when non-nil. ; * test/lisp/erc/resources/base/assoc/multi-net/barnet.eld: Timeouts. ; * test/lisp/erc/resources/base/assoc/multi-net/foonet.eld: Timeouts. ; * test/lisp/erc/resources/base/netid/bouncer/barnet-drop.eld: Timeouts. ; * test/lisp/erc/resources/base/netid/bouncer/foonet-drop.eld: Timeouts. ; * test/lisp/erc/resources/erc-d/resources/dynamic-foonet.eld: Timeouts. ; * test/lisp/erc/resources/sasl/scram-sha-1.eld: Timeouts. ; * test/lisp/erc/resources/sasl/scram-sha-256.eld: Timeouts.
* | ; Increase ERC test server queue sizeF. Jason Park2023-10-022-29/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/erc/erc-scenarios-scrolltobottom.el (erc-scenarios-scrolltobottom--normal, erc-scenarios-scrolltobottom--all): Use updated name for test fixture. * test/lisp/erc/resources/erc-d/erc-d.el (erc-d--initialize-client): For lengthy batches, `erc-d--filter' may run multiple times before `erc-d--on-request' can pull from the queue, which results in discarded incoming messages and match failures. (erc-d--m, erc-d--log): Convert to ordinary functions. * test/lisp/erc/resources/erc-scenarios-common.el (erc-scenarios-scrolltobottom--normal, erc-scenarios-common-scrolltobottom--normal): Rename test fixture from former to latter and attempt to fix intermittent failure re `count-screen-lines'.
* | Consider all windows in erc-scrolltobottom-modeF. Jason Park2023-09-102-0/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Add entry for option `erc-scrolltobottom-all', and mention explicit hook-depth intervals reserved by ERC. * lisp/erc/erc-backend.el (erc--hide-prompt): Change hook depth on `pre-command-hook' from 91 to 80. * lisp/erc/erc-goodies.el (erc-input-line-position): Mention secondary role when new option `erc-scroll-to-bottom-relaxed' is non-nil. (erc-scrolltobottom-all): New option that decides whether module `scrolltobottom' affects all windows or just the selected one, as it always has. (erc-scrolltobottom-relaxed): New option to leave the prompt stationary instead of forcing it to the bottom of the window. (erc-scrolltobottom-mode, erc-scrolltobottom-enable, erc-scrolltobottom-disable): Use `erc--scrolltobottom-setup' instead of `erc-add-scroll-to-bottom' for adding and removing local hooks and instead of ranging over buffers when removing them. Also add and remove new hook members when `erc-scrolltobottom-all' is non-nil. (erc--scrolltobottom-relaxed-commands, erc--scrolltobottom-window-info, erc--scrolltobottom-post-force-commands, erc--scrolltobottom-relaxed-skip-commands): New internal variables. (erc--scrolltobottom-on-pre-command erc--scrolltobottom-on-post-command): New functions resembling `erc-possibly-scroll-to-bottom' that try to avoid scrolling repeatedly for no reason. (erc--scrolltobottom-on-pre-command-relaxed, erc--scrolltobottom-on-post-command-relaxed): New commands to help implement `erc-scroll-to-bottom-relaxed'. (erc--scrolltobottom-at-prompt-minibuffer-active): New function to scroll to bottom on window configuration changes when using the minibuffer. (erc--scrolltobottom-all): New function to scroll all windows displaying the current buffer. (erc-add-scroll-to-bottom): Deprecate this function because it is now unused in the default client and trivial to implement otherwise. (erc--scrolltobottom-setup): New generic function to perform teardown as well as setup depending on the state of the module's mode variable. Also add an implementation specifically for `erc-scrolltobottom-all' that locally modifies different sets of hooks depending on `erc-scrolltobottom-relaxed'. (erc--scrolltobottom-on-pre-insert): New generic function that remembers the last `window-start' and maybe the current screen line before inserting a message, in order to restore it afterward. (erc--scrolltobottom-confirm): New function, a replacement for `erc-scroll-to-bottom' that returns non-nil when it's actually recentered the window. For now, used only when `erc-scrolltobottom-all' is enabled. (erc-move-to-prompt-setup): Add `erc-move-to-prompt' to `pre-command-hook' at a depth of 70 in the current buffer. (erc-keep-place-mode, erc-keep-place-enable): Change hook depth from 0 to 85. (erc--keep-place-indicator-setup): Add overlay arrow `after-string' in non-graphical settings in case users have time stamps or other content occupying the left margin. (erc-keep-place-indicator-mode, erc-keep-place-indicator-enable): Change hook depth from 90 to 85 locally so as not to conflict with a value of t, for append. (erc--keep-place-indicator-on-global-module): Change hook depth from 90 to 85 locally. * test/lisp/erc/erc-scenarios-scrolltobottom-relaxed.el: New file. * test/lisp/erc/erc-scenarios-scrolltobottom.el: New file. * test/lisp/erc/resources/erc-scenarios-common.el (erc-scenarios-common--term-size, erc-scenarios-common--run-in-term, erc-scenarios-common-interactive-debug-term-p, erc-scenarios-common-with-noninteractive-in-term): New test macro and supporting helper function and variables to facilitate running scenario-based tests in an inferior Emacs, in term-mode. (erc-scenarios-common--at-win-end-p, erc-scenarios-common--above-win-end-p, erc-scenarios-common--prompt-past-win-end-p, erc-scenarios-common--recenter-top-bottom-around, erc-scenarios-common--recenter-top-bottom, erc-scenarios-scrolltobottom--normal): New test fixture and assertion helper functions. * test/lisp/erc/resources/scrolltobottom/help.eld: New file. (Bug#64855)
* | ; Allow alternate ert-info text in ERC test utilityF. Jason Park2023-09-1019-34/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/erc/erc-tests.el (erc-tests--assert-printed-in-subprocess): Don't insist that arguments to the Emacs "-load" invocation option be actual disk files. * test/lisp/erc/resources/erc-d/erc-d-t.el (erc-d-t--wait-message-prefix, erc-d-t-wait-for, erc-d-t-ensure-for): Add and use new variable to make `ert-info' message prefix adjustable. The immediate use for this is to make it easier to distinguish between consecutive assertions in which the first waits for a condition and the second ensures it holds for some duration. * test/lisp/erc/resources/erc-d/erc-d-u.el (erc-d-u--read-exchange-default): Skip killed buffers. * test/lisp/erc/resources/erc-d/erc-d.el: Typo. * test/lisp/erc/resources/base/assoc/bouncer-history/barnet.eld: Timeouts. * test/lisp/erc/resources/base/assoc/bouncer-history/foonet.eld: Timeouts. * test/lisp/erc/resources/base/assoc/bumped/again.eld: Timeouts. * test/lisp/erc/resources/base/assoc/bumped/foisted.eld: Timeouts. * test/lisp/erc/resources/base/assoc/bumped/refoisted.eld: Timeouts. * test/lisp/erc/resources/base/flood/soju.eld: Timeouts. * test/lisp/erc/resources/base/netid/bouncer/barnet.eld: Timeouts. * test/lisp/erc/resources/base/netid/bouncer/foonet.eld: Timeouts. * test/lisp/erc/resources/base/reconnect/aborted-dupe.eld: Timeouts. * test/lisp/erc/resources/base/reconnect/aborted.eld: Timeouts. * test/lisp/erc/resources/base/renick/self/qual-chester.eld: Timeouts. * test/lisp/erc/resources/base/renick/self/qual-tester.eld: Timeouts. * test/lisp/erc/resources/erc-d/resources/dynamic-barnet.eld: Timeouts. * test/lisp/erc/resources/erc-d/resources/dynamic-foonet.eld: Timeouts. * test/lisp/erc/resources/erc-d/resources/linger.eld: Timeouts. * test/lisp/erc/resources/join/legacy/foonet.eld: Timeouts.
* | Prevent unwanted recursion in erc-nickbar-disableF. Jason Park2023-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-speedbar.el (erc-status-sidebar-mode--unhook): Remove forward declaration. (erc-speedbar--toggle-nicknames-sidebar): Inline `erc-speedbar-close-nicknames-window'. Don't call `erc-speedbar-browser' and thus avoid adding excess timers. (erc-speedbar--ensure): Inline `speedbar-enable-update' to avoid unneeded call to `speedbar-set-timer', and ensure it only runs in `speedbar-buffer'. (erc-speedbar--shutting-down-p): New flag variable to avoid recursive calls to `dframe-close-frame' and friends. (erc-nickbar-mode, erc-nickbar-enable, erc-nickbar-disable): Move logic formerly performed by `speedbar-disable-update' to `erc-speedbar--toggle-nicknames-sidebar'. When disabling, guard against recursive calls to `dframe-close-frame' and friends. (erc-speedbar--get-timers): New utility function, also for use in testing. (erc-speedbar--dframe-controlled): Bind `erc-speedbar--shutting-down-p' flag non-nil around call to `erc-nickbar-mode'. Remove excess timer left behind due to incompatible behavior from `dframe-close-frame'. Let caller kill buffer. (erc-speedbar-close-nicknames-window): Remove unused command, new in ERC 5.6 and Emacs 30. * test/lisp/erc/erc-scenarios-status-sidebar.el (erc-speedbar-close-nicknames-window): Remove forward declaration. (erc-speedbar--get-timers): Add forward declaration. (erc-scenarios-status-sidebar--nickbar): Fix faulty expectations of desired behavior when disabling module. Ensure timers canceled. * test/lisp/erc/resources/erc-scenarios-common.el (erc-scenarios-common--make-bindings): Shadow `timer-idle-list' to avoid polluting global test environment with stray timers. (Bug#63595)
* | ; Relax timeouts on some ERC testsF. Jason Park2023-08-157-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There have been three failures (all on native-comp-speed2-master) over the last three weeks pointing to these tests, which haven't changed in the year-plus they've existed in tree. No test appears in multiple failures, and all continue to pass daily on commercial GitLab (GCP) runners using the same EMBA container image. They also pass locally with "make check" and "make -j -C test SELECTOR=t check-lisp-erc". If these tweaks don't fix the problem, they can be branded :unstable. * test/lisp/erc/erc-scenarios-base-renick.el: Extend timeouts. * test/lisp/erc/resources/base/netid/bouncer/barnet.eld: Extend timeouts. * test/lisp/erc/resources/base/netid/bouncer/foonet.eld: Extend timeouts. * test/lisp/erc/resources/base/reconnect/options.eld: Extend timeouts. * test/lisp/erc/resources/base/renick/queries/bouncer-barnet.eld: Extend timeouts. * test/lisp/erc/resources/base/renick/queries/bouncer-foonet.eld: Extend timeouts. * test/lisp/erc/resources/erc-scenarios-common.el: Extend timeout. * test/lisp/erc/resources/services/auth-source/libera.eld: Extend timeouts.
* | Fix CTCP ACTION regression in erc-fill-wrapF. Jason Park2023-07-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Return nil when current message is a CTCP ACTION. This fixes a regression introduced by 63d8b2a59a4 "Make erc-fill-wrap work with left-sided stamps". * test/lisp/erc/erc-fill-tests.el: (erc-fill-wrap--merge-action): New test. * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: New test data file. (Bug#60936)
* | Make erc-fill-wrap work with left-sided stampsF. Jason Park2023-07-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Remove all mention of option `erc-timestamp-align-to' supporting a value of `margin', which has been abandoned. Do mention leading white space before stamps now having stamp-related properties. * lisp/erc/erc-backend.el (erc--reveal-prompt, erc--conceal-prompt): New generic functions with default implementations factored out from `erc--unhide-prompt' and `erc--hide-prompt'. (erc--prompt-hidden-p): New internal predicate function. (erc--unhide-prompt): Defer to `erc--reveal-prompt', and set `erc-prompt' text property to t. (erc--hide-prompt): Defer to `erc--conceal-prompt', and set `erc-prompt' text property to `hidden'. * lisp/erc/erc-compat.el (erc-compat--29-browse-url-irc): Don't use `function-equal'. * lisp/erc/erc-fill.el (erc-fill-wrap-margin-width, erc-fill-wrap-margin-side): New options to control side and initial width of `fill-wrap' margin. (erc-fill--wrap-beginning-of-line): Fix bug involving non-string valued `display' props. (erc-fill-wrap-toggle-truncate-lines): New command to re-enable `visual-line-mode' when toggling off `truncate-lines'. (erc-fill-wrap-mode-map): Remap `toggle-truncate-lines' to `erc-fill-wrap-toggle-truncate-lines'. (erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable): Update doc string, persist a few local vars, and conditionally set `erc-stamp--margin-left-p'. When deactivating, disable `visual-line-mode' first. (erc-fill--wrap-continued-message-p): Use `erc-speaker' instead of heuristics when comparing nicks between consecutive messages. (erc-fill-wrap-nudge): Update doc string and account for left-sided stamps. (erc-timestamp-offset): Add comment regarding conditional guard based on function-valued option. * lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Remove value variant `margin', which was originally intended to be new in ERC 5.6. This functionality was all but useless without the internal minor mode `erc-stamp--display-margin-mode' active. (erc-stamp-right-margin-width): Remove unused option new in 5.6. (erc-stamp--display-margin-force): Remove unused function. (erc-stamp--margin-width, erc-stamp--margin-left-p): New internal variables. (erc-stamp--init-margins-on-connect): New function for initializing mode-managed margin after connecting. (erc-stamp--adjust-right-margin, erc-stamp--adjust-margin): Rename function to latter and accommodate left-hand stamps. (erc-stamp--inherited-props): Move definition higher up in same file. (erc-stamp--display-margin-mode): Update function name, and adjust setup and teardown to accommodate left-handed stamps. Don't add advice around `erc-insert-timestamp-function'. (erc-stamp--last-prompt, erc-stamp--display-prompt-in-left-margin): New function and helper var to convert a normal inserted prompt so that it appears in the left margin. (erc-stamp--refresh-left-margin-prompt): Helper for other modules to quickly refresh prompt outside of insert hooks. (erc--reveal-prompt, erc--conceal-prompt): New implementations for when `erc-stamp--display-margin-mode' is active. (erc-insert-timestamp-left): Convert to generic function and provide implementation for `erc-stamp--display-margin-mode'. (erc-stamp--omit-properties-on-folded-lines): New variable, an escape hatch for propertizing white space before right-side stamps folded over onto another line. (erc-insert-timestamp-right): Don't expect `erc-timestamp-align-to' to ever be the symbol `margin'. Move handling for that case to one contingent on the internal minor mode `erc-stamp--display-margin-mode' being active. Add text properties preceding stamps that occupy a line by their lonesome. See related news entry for rationale. This is arguably a breaking change. * lisp/erc/erc.el (erc--refresh-prompt-hook): New hook variable for modules to adjust prompt properties whenever it's refreshed. (erc--refresh-prompt): Fix bug in which user-defined prompt functions failed to hide when quitting in server buffers. Run new hook `erc--refresh-prompt-hook'. (erc-display-prompt): Add comment noting that the text property `erc-prompt' now actually matters: it's t while a session is running and `hidden' when disconnected. * test/lisp/erc/erc-fill-tests.el (erc-fill--left-hand-stamps): New test. * test/lisp/erc/erc-stamp-tests.el (erc-stamp-tests--use-align-to--nil, erc-stamp-tests--use-align-to--t): New functions forged from old test bodies to allow optionally asserting pre-5.6 behavior regarding leading white space on right-hand stamps that exist on their own line. (erc-timestamp-use-align-to--nil, erc-timestamp-use-align-to--t): Parameterize with compatibility flag. (erc-timestamp-use-align-to--margin, erc-stamp--display-margin-mode--right): Rename test to latter. * test/lisp/erc/erc-tests.el (erc-hide-prompt): Add some assertions for new possible value of `erc-prompt' text property. * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: New test data file. (Bug#60936)
* | Add preset styles to erc-status-sidebarF. Jason Park2023-07-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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)
* | Allow custom display-buffer actions in ERCF. Jason Park2023-07-131-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/erc.texi: Add new section under "Integrations" chapter describing `display-buffer' Custom function choice for ERC's many buffer-display options. * etc/ERC-NEWS: Mention new function variant for all buffer-display options. * lisp/erc/erc-backend.el: Add forward declaration for `erc--called-as-input-p' and `erc--display-context'. (erc--server-reconnect-display-timer, erc--server-last-reconnect-display-reset): Use new name for option `erc-reconnect-display', now `erc-auto-reconnect-display'. (erc--server-determine-join-display-context): New generic function to determine value of `erc--display-context' during JOINs. (erc-server-JOIN, erc-server-PRIVMSG): Set `erc--display-context' to a symbol for the handler's IRC command, like `JOIN', for the benefit of custom `display-buffer'-like functions running in `erc-setup-buffer'. (erc-server-471, erc-server-471-functions, erc-server-473, erc-server-473-functions): New handlers for JOIN rejections. Also remove 471 and 473 from comment at bottom of file. (erc-server-475): Bind `erc--called-as-input-p' so that `erc-cmd-JOIN' sets `erc-interactive-display' context. * lisp/erc/erc-join.el (erc-autojoin-mode, erc-autojoin-enable, erc-autojoin-disable): Kill local variable `erc-join--requested-channels'. Add and remove `erc-join--remove-requested-channels' to/from various server-handler hooks for JOIN rejection numerics. (erc-join--requested-channels): New local variable to remember channels we've attempted to JOIN this session that haven't yet been confirmed by the server. (erc-join--remove-requested-channel): New JOIN rejection handler to stop tracking channel in `erc-join--requested-channels'. (erc--server-determine-join-display-context): module-specific implementation of generic function for `erc-autojoin-mode'. (erc-autojoin--join): Remember channels slated for JOIN'ing. * lisp/erc/erc.el (erc--buffer-display-choices): New helper constant for defining common `:type' for all buffer-display options. (erc-buffer-display, erc-interactive-display, erc-auto-reconnect-display, erc-receive-query-display): Use helper `erc--buffer-display-choices' for defining `:type', which includes a new choice for a `display-buffer'-like function. (erc-reconnect-display, erc-auto-reconnect-display): Alias former to latter, now the preferred name. (erc-reconnect-timeout, erc-auto-reconnect-timeout): Change name from former to latter. This option is new in ERC 5.6. (erc-reconnect-display-server-buffers): New option. (erc-buffer-do): Revise doc string. (erc--display-context): New variable, an alist of "context tokens" to be forwarded as the "action alist" to `erc-buffer-display' functions. (erc-skip-displaying-selected-window-buffer): New variable, deprecated at birth, to act as an escape hatch for folks who don't want to skip the displaying of buffers already showing in the selected window. (erc--display-buffer-overriding-action): Local variable allowing modules to influence the displaying of new ERC buffers independently of user options. (erc-setup-buffer): Do nothing when the selected window already shows current buffer unless user has provided a custom display function. Accommodate new Custom choice function values, like `display-buffer' and `pop-to-buffer'. (erc-open): Run `erc-setup-buffer' when option `erc-reconnect-display-server-buffers' is non-nil, even for existing server buffers. Bind `display-buffer-overriding-action' to the value of `erc--display-buffer-overriding-action' around calls to `erc-setup-buffer'. (erc-select-read-args): Add `erc--display-context' to environment. (erc, erc-tls): Bind `erc--display-context' around calls to `erc-select-read-args' and main body. (erc-cmd-JOIN, erc-cmd-QUERY, erc--cmd-reconnect, erc-handle-irc-url): Add item for `erc-interactive-display' to `erc--display-context'. (erc-connection-established): Update name of `erc-reconnect-display-timeout' to `erc-auto-reconnect-display-timeout'. (erc-message-english-s471, erc-message-english-s473): New variables, format templates for JOIN rejection messages. * test/lisp/erc/erc-scenarios-base-buffer-display.el (erc-scenarios-base-buffer-display--defwin-recbury-intbuf, erc-scenarios-base-buffer-display--defwino-recbury-intbuf, erc-scenarios-base-buffer-display--count-reset-timeout): Use preferred name `erc-auto-reconnect-display' for `erc-reconnect-display'. * test/lisp/erc/erc-scenarios-join-display-context.el: New file. * test/lisp/erc/erc-tests.el (erc--initialize-markers): Fix unrealistic call to `erc-open'. (erc-setup-buffer--custom-action): New test. (erc-select-read-args, erc-tls, erc--interactive, erc-server-select): Expect new environment binding for `erc--display-context'. * test/lisp/erc/resources/join/buffer-display/mode-context.eld: New file. (Bug#62833)
* | Redo erc-nickname-in-use-functions as a local moduleF. Jason Park2023-07-014-0/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Mention new module `services-regain'. * lisp/erc/erc-backend.el: Rename option. * lisp/erc/erc-services.el (erc-services-regain-alist): Strategies for regaining a lost nickname on reconnect. This option, in addition to the rest of these changes, is a redo of `erc-nickname-in-use-functions' from commit 8c0c9826 "Add hook to regain nickname in ERC", which originally stemmed from bug#62044. (erc-services-retry-nick-on-connect, erc-services-issue-regain, erc-services-issue-ghost-and-retry-nick): New function variants for `erc-services-regain-alist. (erc-services-regain-mode, erc-services-regain-enable, erc-services-regain-disable): New local module to activate nick-regaining behavior. (erc--nickname-in-use-make-request): New method, a services-specific implementation. * lisp/erc/erc.el (erc--nickname-in-use-make-request): New generic function to request alternate nick when first choice is rejected. (erc-nickname-in-use): Call `erc--nickname-in-use-make-request' to request alternate nick. * test/lisp/erc/erc-scenarios-services-misc.el (erc-scenarios-services-misc--reconnect-retry-nick): Adopt renamed version of `erc-scenarios-base-renick-auto-regain'. (erc-scenarios-services-misc--regain-command, erc-scenarios-services-misc--ghost-and-retry-nick): New tests. * test/lisp/erc/resources/services/regain/reconnect-retry-again.eld: New test data file reusing existing blob c0529052 that once lived at resources/base/renick/regain/normal-again.eld. * test/lisp/erc/resources/services/regain/reconnect-retry.eld: New test data file reusing existing blob 9f4df70e5 that once lived at resources/base/renick/regain/normal.eld. * test/lisp/erc/resources/services/regain/taken-ghost.eld: New test data file. * test/lisp/erc/resources/services/regain/taken-regain.eld New test data file.
* | Revert "Add hook to regain nickname in ERC"F. Jason Park2023-06-112-109/+0
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 8c0c98268440b27a77faf30738dfd72c909bb33f. The functionality it introduced is likely being migrated to a "regain"-specific local module to live in the library erc-services.el alongside the existing `services' module. Its scope will be expanded to address common "regain" cases requiring NickServ. This commit is being reverted to prevent any confusion that might arise from users encountering the old interface while the new one is being hashed out on the tracker.
* | Measure stamps pixel-wise with erc-fill-wrapF. Jason Park2023-06-117-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-fill.el (erc-fill-wrap-mode, erc-fill-wrap-enable): Change "how" for advice applied to `erc-stamp--insert-date-function' from `:filter-args' to `:after'. (erc-fill--wrap-stamp-insert-prefixed-date): Change signature to conform to `:after'-style advice. Use `buffer-text-pixel-size' when desired and available for generating display spec. (erc-fill-wrap): Remove confusing comment. Don't apply text props to newlines because there's no obvious use case for inheriting these. * lisp/erc/erc.el (erc-send-action, erc-display-msg): Add `erc-command' property (as "PRIVMSG") to inserted message, sans newline, so that all inserted messages in an ERC buffer contain this property. * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update data. * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update data. * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update. * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update. * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update. * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update. * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update. (Bug#60936)
* | ; Silence byte compiler in erc-netsplit-JOINF. Jason Park2023-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Partially revert edit from c9f1ad2a870 "Revive option erc-query-on-unjoined-chan-privmsg". * lisp/erc/erc-netsplit.el (erc-netsplit-JOIN): Silence byte compiler warning re ignored return value from `delete' when removing nicks. Could probably suppress rather than reconstitute since the CAR of an `erc-netsplit-list' entry originates from the trailing "reason" param of the instigating "QUIT" command and should look something like "irc.example.org chat.example.org", which cannot be confused for a nickname. * test/lisp/erc/resources/erc-scenarios-common.el: Fix wording in Commentary.
* | Optionally add spacing between ERC messagesF. Jason Park2023-05-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Mention option `erc-fill-line-spacing'. * lisp/erc/erc-fill.el (erc-fill-line-spacing, erc-fill-spaced-commands): Add options to allow for extra spacing between messages. (erc-fill--function): Internal var allowing modules to override user option `erc-fill-function'. (erc-fill): Add extra line-spacing on certain types of messages. Prefer `erc-fill--function', when set, over `erc-fill-function'. (erc-fill--make-module-dependency-msg, erc-fill--wrap-ensure-dependencies): Rename former to latter and make more useful. (erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable): Refactor. (erc-fill--wrap-fix): Remove unused function. (erc-fill-wrap-nudge): Remove reference to nonexistent function in doc string. * test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--graphic-dir): New variable. (erc-fill-tests--compare): Look in `erc-fill-tests--graphic-dir' for graphical snapshots ignored by Git. (erc-fill-line-spacing): New test. * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: New file. (Bug#60936)
* | Redo line splitting for outgoing messages in ERCF. Jason Park2023-05-054-1/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-backend.el (erc--reject-unbreakable-lines): New variable, an escape hatch for somewhat regaining pre-5.6 line-splitting behavior. (erc--split-line): New utility function that doesn't rely on column-oriented filling. * lisp/erc/erc.el (erc--pre-send-split-functions): Append `erc--split-lines' to value. (erc--split-lines): New function to re-split current selection of lines. (erc-send-input): Hard-code line preparation instead of calling `erc--pre-send-split-functions', in order to bake in traditional behavior before move to "pre-splitting". * test/lisp/erc/erc-scenarios-base-split-line.el: New file. * test/lisp/erc/erc-tests.el (erc--split-line): New test. (erc-send-current-line): Don't expect a flood argument when interpreting a command because it's not passed along to the command's handler. This was previously misleading because it assigned undue significance to something that had no bearing on the fate of a command. * test/lisp/erc/resources/base/flood/ascii.eld: New file. * test/lisp/erc/resources/base/flood/koi8-r.eld: New file. * test/lisp/erc/resources/base/flood/utf-8.eld: New file. * test/lisp/erc/resources/erc-d/erc-d.el: Don't decode input. (Bug#62947)
* | Move ERC's buffer-display tests to separate fileF. Jason Park2023-05-052-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/erc/erc-scenarios-base-buffer-display.el: New file. * test/lisp/erc/erc-scenarios-base-reconnect.el (erc-scenarios-common--base-reconnect-options, erc-scenarios-base-reconnect-options--buffer, erc-scenarios-base-reconnect-options--default): Move to new file and rename. (Bug#62833) * test/lisp/erc/resources/erc-d/erc-d-tests.el (erc-d-run-linger): Lengthen timeout. * test/lisp/erc/resources/erc-d/erc-d.el (erc-d--m): Ensure buffer is live before inserting.
* | Revive option erc-query-on-unjoined-chan-privmsgF. Jason Park2023-05-051-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * etc/ERC-NEWS: Mention reinstated and renamed legacy option `erc-query-on-unjoined-chan-privmsg' as well as a change in behavior for `erc-auto-query', when nil. Also fix erroneous ChangeLog reference in 5.5 section. * lisp/erc/erc-backend.el (erc-server-PRIVMSG): Consider flag `erc-receive-query-display-defer' and revived option `erc-query-unjoined-chan-privmsg' when deciding whether to create a new query buffer. And only "open" a buffer for an unknown target when the latter option is non-nil. * lisp/erc/erc.el (erc-cmd-QUERY): Make error more informative. (erc-query): Revise deprecation message. (erc-auto-query, erc-receive-query-display): Swap alias and aliased and add option to `erc-buffers' group. Mention the nonstandard meaning of nil and update package-version to signify a behavioral change, even though the default value remains untouched. (erc-receive-query-display-defer): Add new variable, a compatibility switch to access legacy behavior for `erc-auto-query'. (erc-query-on-unjoined-chan-privmsg, erc-ensure-target-buffer-on-privmsg): Revise doc string and add alias. Change package-version to ERC 5.6 due to slightly refined meaning. * test/lisp/erc/erc-scenarios-base-attach.el: New file. * test/lisp/erc/resources/base/channel-buffer-revival/reattach.eld: New file. (Bug#62833)
* | Compare case-folded nicks with erc-fill-wrap-mergeF. Jason Park2023-04-302-2/+2
| | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Downcase both current and previous speaker when comparing nicks. * test/lisp/erc/erc-fill-tests.el (erc-fill-wrap--merge): Add title-case nick to test. * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update snapshot. * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update snapshot. (Bug#60936)
* | Add erc-button helper for substituting command keysF. Jason Park2023-04-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.)
* | Add erc-fill style based on visual-line-modeF. Jason Park2023-04-086-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-fill.el (erc-fill-function): Add new value `erc-fill-wrap'. (erc-fill-static-center): Extend meaning of option to also affect `erc-wrap-mode'. (erc-fill--wrap-value, erc-fill--wrap-visual-keys): New variables to support new local module. (erc-fill-wrap-visual-keys): New option to control how and where `visual-line-mode' keys are active. (erc-fill-wrap-merge): Add option for omitting a speaker's name if they just now spoke. Enabled by default. (erc-fill--wrap-move): New helper function for fill-wrap movement commands. (erc-fill--wrap-kill-line, erc-fill--wrap-beginning-of-line, erc-fill--wrap-end-of-line): New movement commands. (erc-fill-wrap-cycle-visual-movement): New command to cycle local copy of `erc-fill-wrap-visual-keys'. (erc-fill-wrap-mode-map): New keymap based on `visual-line-mode-map'. (erc-fill--make-module-dependency-msg): Helper for `erc-fill-wrap-enable'. (erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable): New local module. (erc-fill--wrap-length-function): Internal interface in the form of a function variable for other modules to control the fill-wrap overhang. (erc-fill--wrap-last-msg, erc-fill--wrap-max-lull, erc-fill--wrap-continued-message-p): Add items to support hiding of redundant speaker names in consecutive messages. (erc-fill--wrap-stamp-insert-prefixed-date): New function to add `line-prefix' property to inserted date stamp. (erc-fill-wrap): New function implementing the `erc-fill-function' (behavioral) interface. (erc-fill--wrap-fix): New, possibly temporary function for other modules to fix misalignment caused by fill-wrap. (erc-fill-wrap-nudge, erc-fill--wrap-nudge): New command and helper for growing and shrinking visual fill prefix. * test/lisp/erc/erc-fill-tests.el: New file. (Bug#60936.) * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: New file. * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: New file. * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: New file. * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: New file. * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: New file. * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: New file.