summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Make auth-source erc-services tests more readableF. Jason Park2023-04-083-113/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-common.el: (erc-with-server-buffer): Modify slightly to use `buffer-local-value' when possible. * test/lisp/erc/erc-services-tests.el (erc-services-tests--auth-source-plstore-standard-entries, erc-services-tests--auth-source-plstore-standard-secrets): Remove unused variables. (erc-services-tests--auth-source-plstore-standard-announced): Add new var to hold common plstore document. (erc--auth-source-search--plstore-standard, erc--auth-source-search--plstore-announced, erc--auth-source-search--plstore-overrides): Use string literals for text-document content. (erc-services-tests--auth-source-json-standard-entries): Remove unused variable. (erc-services-tests--auth-source-json-standard-announced): Add new variable. (erc--auth-source-search--json-standard, erc--auth-source-search--json-announced, erc--auth-source-search--json-overrides): Use string literals for text-document content. (erc-services-tests--secrets-search-items): Add new helper function. (erc--auth-source-search--secrets-standard, erc--auth-source-search--secrets-announced, erc--auth-source-search--secrets-overrides): Use helper to mock `secrets-search-items' instead of misleading lambda. * lisp/erc/erc-tests.el (erc-with-server-buffer): Add test.
* Add erc-button helper for substituting command keysF. Jason Park2023-04-084-20/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.)
* Replace Info-goto-node with info in erc-button-alistF. Jason Park2023-04-082-3/+1
| | | | | | | | * lisp/erc/erc-button.el (erc-button-alist): Replace `Info-goto-node' with plain `info', which is autoloaded. Expand regexp to recognize inline `info' function calls. * lisp/erc/erc-networks.el (erc-networks--set-name, erc-networks--warn-on-connect): Don't require `info'. (Bug#60933.)
* Add erc-fill style based on visual-line-modeF. Jason Park2023-04-088-5/+660
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Add variant for erc-match invisibility specF. Jason Park2023-04-081-4/+23
| | | | | | | | | | | | | * lisp/erc/erc-match.el (erc-match-mode, erc-match-enable, erc-match-disable): Arrange for possibly adding or removing `erc-match' from `buffer-invisibility-spec'. (erc-match--hide-fools-offset-bounds): Add new variable to serve as switch for activating invisibility on a modified interval that's offset toward `point-min' by one character. (erc-hide-fools): Optionally offset start and end of invisible region by minus one. (erc-match--modify-invisibility-spec): New housekeeping function to set up and tear down offset spec. (Bug#60936.)
* Convert erc-fill minor mode into a proper moduleF. Jason Park2023-04-081-23/+11
| | | | | | | * lisp/erc/erc-fill.el (erc-fill-mode, erc-fill-enable, erc-fill-disable): Use API to create these. (erc-fill-static): Save restriction instead of caller's match data. (Bug#60936.)
* Put display properties to better use in erc-stampF. Jason Park2023-04-083-16/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-log.el (erc-log-filter-function): Add new value `erc-stamp-prefix-log-filter'. * lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): Enhance meaning of option to accept numeric value for dynamically aligned right-hand stamps. Use `graphic-display-p' to determine default value even though, as stated in the manual, terminal Emacs also supports the "space" display spec. (erc-stamp-right-margin-width): New option to determine width of right margin when `erc-stamp--display-margin-mode' is active or `erc-timestamp-use-align-to' is set to `margin'. (erc-stamp--display-margin-force): Add new helper function for `erc-stamp--display-margin-mode'. (erc-stamp--adjust-right-margin): New function to adjust width of right margin. (erc-stamp-prefix-log-filter): New value for `erc-log-filter-function' compatible with modules that activate `erc-stamp--display-margin-mode'. (erc-stamp--display-margin-mode): Add internal minor mode to help other modules quickly ensure left-right, display-prop-oriented stamps are showing correctly. Does not support left-hand-only stamps. (erc-insert-aligned): Deprecate function and remove from primary client code path. (erc-stamp--inherited-props): Add internal constant to hold properties that should be inherited from any stamp-bearing message being inserted. (erc-insert-timestamp-right): Account for new display-related values of `erc-timestamp-use-align-to'. * test/lisp/erc/erc-stamp-tests.el (erc-timestamp-use-align-to--nil, erc-timestamp-use-align-to--t): Adjust spacing for new default right-hand stamp, `erc-format-timestamp', which lacks a leading space. (erc-timestamp-use-align-to--integer, erc-timestamp-use-align-to--margin): New tests. (Bug#60936.)
* Make some erc-stamp functions more limberF. Jason Park2023-04-081-19/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-stamp.el (erc-timestamp-format-right): Deprecate option and change meaning of its nil value to fall through to `erc-timestamp-format'. Do this to allow modules to predict what the right-hand stamp's final width will be. This also saves `erc-insert-timestamp-left-and-right' from calling `erc-format-timestamp' again for every inserted message. (erc-stamp-mode, erc-stamp-enable, erc-stamp-disable): Add `erc-stamp--recover-on-reconnect' to `erc-mode-hook'. (erc-stamp--recover-on-reconnect): Add function to reuse last values of `erc-timestamp-last-inserted' and friends to avoid reprinting stamps when reconnecting. (erc-stamp--current-time): Add new generic function and method to return current time. Default to calling `erc-current-time'. Also add new internal variable of the same name to hold time value used to construct formatted stamps passed to `erc-insert-timestamp-function'. (erc-add-timestamp): Bind `erc-stamp--current-time' when calling `erc-insert-timestamp-function'. (erc-stamp--insert-date-function): New variable for modules to tweak date-insertion. (erc-insert-timestamp-left-and-right): Use STRING parameter and favor it over the now deprecated `erc-timestamp-format-right' to avoid formatting twice. Also extract current time from the variable `erc-stamp--current-time' for similar reasons. And defer to `erc-stamp--insert-date-function' to insert left stamp. (Bug#60936.) (erc-stamp--tz): New internal variable. (erc-format-timestamp): Pass `erc-stamp--tz' as time-zone to `format-time-string'.
* Expose insertion time as text prop in erc-stampF. Jason Park2023-04-082-5/+217
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-stamp.el (erc-add-timestamp): Add new text property `erc-timestamp' to store lisp time object formerly ensconced in a closure. Instead of creating a new lambda for the cursor-sensor function of each message in a buffer, leave a gap between messages to trip the sensor function. The motivation behind this change is to allow third parties access to valuable timestamp data already stored by ERC anyway. Of secondary importance is discouraging the reliance on those lambdas as a means of detecting message bounds. The gap now serves a similar purpose. Basically, the final character in a message, a newline, will not have a timestamp or a sensor function. In the rare instance the stamps module isn't loaded, the new `erc-command' property can be used for this purpose instead. Also, instead of looking for the `invisible' text property at point, which is normally `point-max' and thus outside the accessible portion of the buffer, look at the beginning of the inserted message. This allows hook members running before this function to opt out of timestamps by marking a message as invisible. (erc-echo-timestamp): Make interactive and show timestamps even when the variable `erc-echo-timestamps' is nil. (erc--echo-ts-csf): Add new function to serve as value of cursor-sensor function text properties. * test/lisp/erc/erc-stamp-tests.el: New file. (Bug#60936.)
* Adjust some old text properties in ERC buffersF. Jason Park2023-04-081-14/+43
| | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc-display-message): Replace `rear-sticky' text property, which has been around since 2002, with a more useful `erc-command' property. It records the current IRC command as a symbol or a number, in the case of numerics. (erc--own-property-names, erc--remove-text-properties) Add variable and internal helper function for filtering values returned by `filter-buffer-substring-function'. (erc-display-prompt): Make the `field' text property more meaningful to aid in searching, although this makes the `erc-prompt' property somewhat redundant. (erc-put-text-property, erc-list): Alias these to subr functions. (erc-restore-text-properties): Don't forget tags when restoring. (erc--get-eq-comparable-cmd): New function to extract commands for use as more easily searchable text-property values. (Bug#60936.)
* Refactor marker initialization in erc-openF. Jason Park2023-04-084-137/+322
| | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--initialize-markers): New helper to ensure prompt and its associated markers are set up correctly. (erc-open): When determining whether a session is a logical continuation, leverage the work already performed by the `erc-networks' library to that effect. Its verdicts are based on network context and thus reliable even when a user dials anew from an entry-point, which is not a simple reconnection because the user expects a clean slate for everything except an existing buffer's messages, meaning `erc--server-reconnecting' will be nil and local-module state variables need resetting. Also remove the check for `erc-reuse-buffers' and instead trust that `erc-get-buffer-create' always does the right thing. Replace all code involving marker and prompt setup by deferring to a new helper, `erc--initialize markers'. * test/lisp/erc/erc-scenarios-base-local-module-modes.el: New file. * test/lisp/erc/erc-scenarios-base-local-modules.el (erc-scenarios-base-local-modules--mode-persistence): Move test to separate file to help with parallel "-j" runs. * test/lisp/erc/erc-tests.el (erc-tests--send-prep): Replace redundant prompt-setup code. (erc--initialize-markers): New test. (Bug#60936.)
* Preserve ERC prompt and its bounding markersF. Jason Park2023-04-084-26/+39
| | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--assert-input-bounds): Add possibly temporary helper function to sync `process-mark' to `erc-insert-marker' in server buffer. (erc-display-line-1): Expect `erc-insert-marker' to always be initialized. Assert some essential invariants regarding insert markers. (erc-send-current-line): Delete typed input but not the prompt. (erc-display-msg): Rework slightly to respect existing markers. * test/lisp/erc/erc-dcc-tests.el (erc-dcc-tests--dcc-handle-ctcp-send): Set insert marker. * test/lisp/erc/erc-networks-tests.el (erc-networks--rename-server-buffer--existing-live): Initialize markers to appease `erc--assert-input-bounds'. * test/lisp/erc/erc-tests.el (erc-ring-previous-command): Fix sloppy mock. (Bug#60936.)
* Add option to show visual erc-keep-place indicatorF. Jason Park2023-04-082-0/+238
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-goodies.el (erc-keep-place-indicator-style, erc-keep-place-indicator-buffer-type, erc-keep-place-indicator-follow): New options for anchoring kept place visually. (erc-keep-place-indicator-line, erc-keep-place-indicator-arrow): New faces. (erc--keep-place-indicator-overlay): New internal variable. (erc--keep-place-indicator-on-window-configuration-change): New function to subscribe to `window-configuration-change-hook' and maybe update kept-place indicator. (erc--keep-place-indicator-setup): New function to initialize buffer for local module `keep-place-indicator'. (erc-keep-place-indicator-mode, erc-keep-place-indicator-enable, erc-keep-place-indicator-disable): New local ERC module. Depends on "parent" module `keep-place'. Like `fill-wrap', this is (for now) also deliberately left out of the widget menu for `erc-modules'. (erc-keep-place-move, erc-keep-place-goto): Add new commands for manually updating and jumping to keep-place indicator. (erc-keep-place): Move `erc--keep-place-overlay' when applicable. * test/lisp/erc/erc-goodies-tests.el (erc-keep-place-indicator-mode): Add test. (Bug#59943.)
* Optionally prompt for more ERC entry-point paramsF. Jason Park2023-04-084-10/+36
| | | | | | | | | | | | | | | * doc/misc/erc.texi: Update statement about availability of `:user' keyword param when entry points called interactively. * lisp/erc/erc/compat.el: Don't require `url-parse' when compiling. Add forward declaration for `url-type'. * lisp/erc/erc.el: Don't require `url-parse' when compiling. Add forward declarations for accessors of `url' struct from `url-parse' library. (erc-select-read-args): Allow optionally calling entry points with a prefix arg to access params `user' and `:full-name'. (erc-tls): Update doc string. * test/lisp/erc/erc-tests.el (erc-select-read-args): Add test for extra args. (Bug#60428.)
* Add display option for interactive ERC invocationsF. Jason Park2023-04-082-18/+49
| | | | | | | | | | | | | * lisp/erc/erc.el (erc-buffer-display, erc-receive-query-display): Add aliases for `erc-join-buffer' and `erc-auto-query'. (erc-interactive-display): Add new option to control display of server buffers during interactive entry-point invocations. (erc-select-read-args): Pass `erc-interactive-display' to entry points. * test/lisp/erc/erc-tests.el (erc-select-read-args): Expect buffer-display values from `erc-interactive-display'. (erc-tls, erc--interactive): Also check `erc-join-buffer' in environment when `erc-open' called. (Bug#60428.)
* Be smarter about switching to TLS from M-x ercF. Jason Park2023-04-082-54/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--warn-unencrypted): Remove unused internal function. (erc-select-read-args): Offer to use TLS when user runs M-x erc and opts for default server and port or provides the well-known IANA TLS port or enters an ircs:// URL at the server prompt. For the last two, do this immediately instead of calling `erc-tls' interactively and imposing a review of just-chosen values. Also remove error warnings and ensure `erc-tls' still works by setting `erc-server-connect-function' to `erc-open-tls-stream' when appropriate. Include the word "URL" in server prompt. (erc--with-entrypoint-environment): Add new macro for empowering an entry point's interactive form to bind special variables in their command's body without shadowing them in the lambda list. (erc, erc-tls): Add internal keyword argument for interactive use, but don't make it `keywordp' or advertise its presence. Also use new helper macro, `erc--with-entrypoint-environment', to temporarily bind special vars given by interactive helper `erc-select-read-args'. * test/lisp/erc/erc-tests.el (erc--with-entrypoint-environment): Add new test. (erc-select-read-args): Modify return values to expect additional internal keyword argument where appropriate. (erc-tls): Make assertions about environment. (erc--interactive): New test. (Bug#60428.)
* Ignore killed buffers when switching in erc-trackF. Jason Park2023-04-082-1/+39
| | | | | | | | * lisp/erc/erc-track.el (erc-track--switch-buffer): If the chosen buffer has been killed, remove it from `erc-modified-channels-alist' and try again. * test/lisp/erc/erc-scenarios-misc.el (erc-scenarios-base-kill-server-track): New test. (Bug#60560.)
* Fill doc strings for ERC modulesF. Jason Park2023-04-082-15/+33
| | | | | | | | | | * lisp/erc/erc-common.el (erc--fill-module-docstring): Add helper to fill doc strings. (erc--assemble-toggle, define-erc-module): Use helper to fill doc string. * test/lisp/erc/erc-tests.el (define-minor-mode--global, define-minor-mode--local): Adjust expected output for generated doc strings. (Bug#60935.)
* Warn when customizing minor-mode vars for ERC modulesF. Jason Park2023-04-083-9/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-common.el: (erc--inside-mode-toggle-p): Add global var to inhibit mode toggles from being run by `erc-update-modules'. It must be non-nil inside custom-set functions for mode toggles created by `define-erc-module'. (erc--favor-changed-reverted-modules-state): Add new helper to show a "SET" Custom state for `erc-modules' except when reverting to the default value because \"STANDARD\" always takes precedence, as explained somewhat in bug#12864. (erc--assemble-toggle): Don't modify `erc-modules' when run from custom-set function. (erc--neuter-custom-variable-state): Add new function to serve as a phony getter that deceives Customize into thinking the variable is always set to its standard value. The justification for this is that toggling a module's minor mode in Customize has never worked and has only sewn confusion in new users. Without this hack, mode widgets show a state of "CHANGED outside Customize", which alone is probably preferable, except that they all end up toggled open, bringing them unwanted attention and distracting the user. (erc--tick-module-checkbox): Add helper to toggle the appropriate checkbox in the `erc-modules' widget when a user interactively toggles a minor-mode state variable. (erc--prepare-custom-module-type): Create spec for minor-mode Custom `:type', deferring various aspects until module-definition time. (define-erc-module): Add `:get' and `:type' keywords to be passed to `defcustom' definition for global modules. * lisp/erc/erc.el (erc-modules): Inhibit `erc-update-modules' when run from a minor-mode toggle's custom-set function. * test/lisp/erc/erc-tests.el (define-erc-module--global, define-erc-module--local): Update `erc-modules' mutations with `erc--inside-mode-toggle-p' guard conditions. (Bug#60935.)
* Don't associate ERC modules with undefined groupsF. Jason Park2023-04-083-7/+69
| | | | | | | | | | | | | | | | | | * lisp/erc/erc-capab.el: Add property crutch to help ERC find module's Custom group. * lisp/erc/erc-common.el (erc--find-group): Add new function, a helper for finding an existing ERC module's Custom group based on `define-erc-module' params. Prefer `group-documentation' as a sentinel over symbol properties owned by Customize because they might not be present if the group isn't yet associated with any custom variables. (define-erc-module): Set `:group' keyword value more accurately, falling back to `erc' when no associated group has been defined. * test/lisp/erc/erc-tests.el (erc--find-group, erc--find-group--real): New tests. (define-erc-module--global, define-erc-module--local): Expect the `:group' keyword to be the unevaluated `erc--find-group' form. (Bug#60935.)
* Convert ERC's Imenu integration into proper moduleF. Jason Park2023-04-084-9/+26
| | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-goodies.el: Don't add Imenu hooks to `erc-mode-hook' at top level. Remove autoload for `erc-create-imenu-index' because it already exists in the `erc-imenu' library. (erc-imenu-setup): Move to the erc-imenu library. * lisp/erc/erc-imenu.el (erc-unfill-notice): Allow modifications to read-only text. Thanks to Yusef Aslam for reporting this bug. (erc-imenu-setup): Move here from goodies. (erc-imenu--create-index-function): New helper var to hold previous local value of `imenu-create-index-function'. Perhaps advice should be used instead, but a cursory search of the Emacs code base reveals no such usage. (erc-imenu-mode, erc-imenu-enable, erc-imenu-disable): Create "new" ERC module for Imenu integration. * lisp/erc/erc.el (erc-modules): Add `imenu' to default value and create widget menu item. Update package-version. * test/lisp/erc/erc-tests.el (erc-tests--modules): Add `imenu'. (Bug#60954)
* Add missing colors to erc-irccontrols-modeF. Jason Park2023-04-082-18/+312
| | | | | | | | | | | | * lisp/erc/erc-goodies.el (erc-spoiler-face): Add new face. (erc--controls-additional-colors): Add remaining 16-99 colors. (erc-get-bg-color-face, erc-get-fg-color-face): Look up extended colors in table. (erc-controls-remove-regexp, erc-controls-highlight-regexp): Convert to `rx' forms and move above first use to eliminate intra-file forward declarations. (erc-controls-propertize): Support spoilers. * test/lisp/erc/erc-goodies-tests.el: New file. (Bug#60954.)
* Modify erc-mode-map in module definitionsF. Jason Park2023-04-086-13/+73
| | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-button.el (erc-button-mode, erc-button-enable, erc-button-disable): Replace call to `erc-button-setup' with one to `erc--modify-local-map'. This means `erc-button-setup' is now dead code from a client perspective. * lisp/erc/erc-goodies.el (erc-irccontrols-enable, erc-irccontrols-disable, erc-irccontrols-mode): Bind `erc-toggle-interpret-controls' in module definition so it's only available when the module is active. * lisp/erc/erc-log.el (erc-log-mode, erc-log-enable, erc-log-disable): Move top-level `define-key' into module definition. * lisp/erc/erc-match.el (erc-match-mode, erc-match-enable, erc-match-disable): Move top-level `define-key' into module definition. * lisp/erc/erc.el (erc-mode-map): Remove C-c C-c binding for `erc-toggle-interpret-controls'. (erc--modify-local-map): Add helper for global modules to use when modifying `erc-mode-map'. * test/lisp/erc/erc-tests.el (erc--modify-local-map): Add test. Ensure modifications to `erc-mode-map' on loading `erc' and via `erc-mode-hook' still work. (Bug#60954.)
* Don't require erc-goodies in erc.elF. Jason Park2023-04-085-23/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-goodies.el: Obviate the need for forward declarations by requiring `erc'. Add minor-mode autoloads for `scrolltobottom', `readonly', `move-to-prompt', `keep-place', `noncommands', `irccontrols', `smiley', and `unmorse'. Add Local variables footer with `generated-autoload-file'. (erc-controls-strip): Autoload this function. * lisp/erc/erc-ibuffer.el: Require `erc-goodies' for `erc-control-interpret'. The justification for the blanket `require' is this module isn't a member of `erc-modules' by default. * lisp/erc/erc-page.el: (erc-ctcp-query-PAGE): Require `erc-goodies' and put forward declaration for `erc-control-interpret' atop file. * lisp/erc/erc-speedbar.el: Require `erc-goodies' for the same reason as erc-ibuffer.el. * lisp/erc/erc.el: Remove `require' for `erc-goodies' at end of file and `pp' at top of file because `pp-to-string' is autoloaded on Emacs 27. Also remove `require's for `thingatpt', `time-date', and `iso8601'. They're all used sparingly and the latter two have only been around for one major release, so their removal likely won't cause much churn. And `thingatpt' already has a call-site `require', so the top-level one is redundant, but autoload `word-at-point' anyway for the benefit of third-party libraries like `hl-nicks'. Also wrap local loaddefs `require' call in `eval-and-compile'. (erc--read-time-period): Require dependencies. (Bug#60954.)
* Leverage loaddefs for migrating ERC modulesF. Jason Park2023-04-088-68/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-common.el (erc--features-to-modules, erc--modules-to-features, erc--module-name-migrations): Remove unused internal functions. (erc--normalize-module-symbol): Make aware of new migration scheme based on symbol properties. * lisp/erc/erc-page.el: Add autoload cookie for module migration. * lisp/erc/erc-pcomplete.el: Add autoload cookies for module migration. * lisp/erc/erc-services.el: Add autoload cookie for module migration. * lisp/erc/erc-sound.el: Add autoload cookie for module migration. * lisp/erc/erc-stamp.el: Add autoload cookie for module migration. * lisp/erc/erc.el (erc-modules): Reorder default value, sorted by `string<' so that Customize does not consider the value to have been edited. Remove non-existent module `hecomplete' from lineup and swap a couple more to maintain sorted order. Change `:initialize' function to tag all symbols for built-in modules with an `erc--module' property. In the `:set' function, ensure third-party modules appear after the sorted and normalized built-ins, but in user-defined order. Do this to prevent all modules, built-ins included, from ending up as populated form fields for the "other" checkbox in the Customize interface. (erc--find-mode): Add helper function for `erc--update-modules'. (erc--update-modules): Always resolve module names and only conditionally attempt to require corresponding features. * test/lisp/erc/erc-tests.el (erc-tests--modules): Add manifest for asserting built-in modules and features. This is easier to verify visually than looking at the custom-type set for `erc-modules'. (erc-modules--initialize): New test. (erc-modules--internal-property): Add test. (erc--normalize-module-symbol): New test. (erc--find-mode): New test. (erc--update-modules) Adapt to new paradigm and make more comprehensive. (Bug#60954.)
* Copy over upstream Compat macros to erc-compatF. Jason Park2023-04-082-10/+44
| | | | | | | | | * lisp/erc/erc-backend: (erc--get-isupport-entry): Replace call to `erc-compat--with-memoization' with the built-in `with-memoization'. * lisp/erc/erc-compat.el: (erc-compat-function, erc-compat-call): Add new macros from Compat 29.1.2.0. (erc-compat--with-memoization): Remove because it's now provided by Compat. (Bug#60954.)
* Honor arbitrary CHANTYPES in ERCF. Jason Park2023-04-082-4/+29
| | | | | | | * lisp/erc/erc.el (erc-channel-p): Favor "CHANTYPES" ISUPPORT item before falling back to well known prefixes. * test/lisp/erc/erc-tests.el (erc-channel-p): Add test. Arbitrarily bundled with bug#60954.
* Add hook to regain nickname in ERCF. Jason Park2023-04-085-1/+202
| | | | | | | | | | | | | | * lisp/erc/erc-backend.el (erc-server-reconnect-timeout): Mention `erc-nickname-in-use-functions' in doc string. * lisp/erc/erc.el (erc-nickname-in-use-functions, erc-regain-nick-on-connect): Add abnormal hook and possible value to handle stale connections preventing a desired nick from being reissued by the server. Follows directly from bug#62044. (erc-nickname-in-use): Call `erc-nickname-in-use-functions'. * test/lisp/erc/erc-scenarios-base-renick.el (erc-scenarios-base-renick-auto-regain): New test. * test/lisp/erc/resources/base/renick/regain/normal-again.eld: New file. * test/lisp/erc/resources/base/renick/regain/normal.eld: New file.
* Add probing erc-server-reconnect-function variantF. Jason Park2023-04-087-5/+290
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-backend.el (erc-server-reconnect-timeout): Replace questionable claim with recommendation for alternate value when experiencing nick rejections. (erc-server-reconnect-function): Add new, somewhat experimental value `erc-server-delayed-check-reconnect'. (erc--server-connect-function): Add variable for process-dialing monitor, a function. (erc--server-propagate-failed-connection): Add function to serve as default monitor to run on process creation and maybe execute failure handlers. (erc-server-connect): Run `erc--server-connect-function' for async processes one second after creation. (erc--server-reconnect-timeout, erc--server-reconnect-timeout-check, erc--server-reconnect-timeout-scale-function, erc--server-reconnect-timeout-double): Add supporting variables and functions for `erc-server-delayed-check-reconnect'. (erc-server-delayed-check-reconnect): Add possible alternate value for option `erc-server-reconnect-function' that only attempts to reconnect after hearing back from the server. (erc-schedule-reconnect): Ensure previous `erc-server-process' is deleted. * test/lisp/erc/erc-scenarios-base-auto-recon.el: New file. * test/lisp/erc/resources/base/reconnect/just-eof.eld: New file. * test/lisp/erc/resources/base/reconnect/just-ping.eld: New file. * test/lisp/erc/resources/base/reconnect/ping-pong.eld: New file. * test/lisp/erc/resources/base/reconnect/unexpected-disconnect.eld: New file. * test/lisp/erc/resources/erc-scenarios-common.el (erc-scenarios-common--make-bindings): Shadow `timer-list'. (Bug#62044.)
* Add MOTD command to ERCF. Jason Park2023-04-084-1/+115
| | | | | | | | | | | | * lisp/erc/erc-backend.el (erc-server-402, erc-server-402-functions): Add new response handler and hook. * lisp/erc/erc.el (erc-cmd-MOTD): New function to shield erc-network from handling post-connection MOTD replies. Thanks to Emanuel Berg for reporting this (bug#62151). (erc-message-english-s402): Define new ERR_NOSUCHSERVER message template. * test/lisp/erc/erc-scenarios-base-misc-regressions.el: New file. * test/lisp/erc/resources/base/commands/motd.eld: New file.
* Split overlong outgoing messages in erc-saslF. Jason Park2023-04-084-3/+148
| | | | | | | | | | * lisp/erc/erc-sasl.el: (erc-server-AUTHENTICATE): Account for client messages exceeding 400 bytes. (Bug#62421.) * test/lisp/erc/erc-scenarios-sasl.el (erc-scenarios-sasl--plain-overlong-split, erc-scenarios-sasl--plain-overlong-aligned): Add tests. * test/lisp/erc/resources/sasl/plain-overlong-aligned.eld: New file. * test/lisp/erc/resources/sasl/plain-overlong-split.eld: New file.
* Fix DCC GET flag parsing in erc-dccDaniel Pettersson2023-04-082-28/+95
| | | | | | | | | | | | | | | | * lisp/erc/erc-dcc.el (erc-cmd-DCC): Tokenize raw input line but also accommodate legacy invocation. (pcomplete/erc-mode/DCC): Quote file names when suggesting. Account for double-hyphen "end-of-options"-like separator. (erc-dcc-do-GET-command): Simplify signature, subsuming NICK in variadic args, now ARGS instead of FILE, which changes the arity from (2 . many) to (1 . many). Explain usage in doc string. Honor an optional separator, "--", if present. (Bug#62444.) * test/lisp/erc/erc-dcc-tests.el (erc-dcc-do-GET-command): Call new parameterized helper with various flag/file combinations. (erc-dcc-tests--erc-dcc-do-GET-command): New fixture function. (pcomplete/erc-mode/DCC--get-quoted, pcomplete/erc-mode/DCC--get-sep): New tests.
* Add subcommand erc-cmd-HELP handler to erc-dccF. Jason Park2023-04-082-0/+30
| | | | | | | | * lisp/erc/erc-compat.el (erc-compat--28-split-string-shell-command, erc-compat--split-string-shell-command): New functions introduced in Emacs 28 for splitting pcomplete input. * lisp/erc/erc-dcc.el (erc-cmd-DCC): Elect to tokenize line specially. (erc-dcc--cmd-help): Add help handler. (Bug#62444.)
* Add subcommand dispatch facility to erc-cmd-HELPF. Jason Park2023-04-081-1/+5
| | | | | | | * lisp/erc/erc.el (erc-cmd-HELP): Change signature by adding &rest parameter. Look for symbol property `erc--cmd-help' and, if found, assume it's a function and call it with &rest args after attempting to autoload the primary command symbol. (Bug#62444.)
* Change ERC version to 5.6-gitF. Jason Park2023-04-081-4/+5
| | | | | | | | * lisp/erc/erc.el: Update main Version header and bump required Compat to latest release in Package-Requires header. Also update entry in `customize-package-emacs-version-alist', mapping ERC 5.6 to Emacs 30.1. (erc-version): Move to 5.6-git.
* Eglot: simplify eglot--sig-info and fix edge cases (bug#62687)João Távora2023-04-081-24/+16
| | | | | | | | | | | | | | The documentation of each signature was rarely rendered because of obsolete logic that skipped MarkupContent objects. The new function follows the principle that echo are gets as little as possible, while the *eldoc* buffer gets as much as possible (except, for the individual parameter documentation, as I couldn't find a single server that uses it). Tested with clangd, pylsp, jdtls, gopls, rust-analyzer, zls. * lisp/progmodes/eglot.el (eglot--sig-info): Simplify.
* Consolidate existing warnings about unused return valuesMattias Engdegård2023-04-084-22/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Move the warning about unused return values from calls to side-effect-free functions from the source-level optimiser to the code generator, where it can be unified with the special-purpose warning about unused values from `mapcar`. This change also cures spurious duplicate warnings about the same code, makes the warnings amenable to suppression through `with-suppressed-warnings`, and now warns about some unused values that weren't caught before. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Move warning away from here. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings): Doc string updates. (byte-compile-form): Put the new warnings here. (byte-compile-normal-call): Move mapcar warning away from here. * lisp/emacs-lisp/bytecomp.el (byte-compile-ignore): Compile args to `ignore` for value to avoid unused-value warnings, and then discard the generated values immediately thereafter. Mostly this does not affect the generated code but in rare cases it might result in slightly worse code. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Adapt test.
* Improve ibuffer-diff-with-fileBasil L. Contovounesios2023-04-081-47/+46
| | | | | | | | | | | | | | | | | * lisp/ibuf-ext.el (ibuffer-diff-with-file): Link to diff-command in docstring. Make Diff buffer read-only from outset and inhibit as needed to avoid surprises. Check whether diff-command supports --label. Leave point at BOB and clean up any excess newline inserted by ibuffer-diff-buffer-with-file-1. Prefer pop-to-buffer-same-window over switch-to-buffer. (ibuffer-diff-buffer-with-file-1): Add docstring. Remove unused unwind-protect and copypasta from diff-no-select (bug#62599). Use diff-file-local-copy, string-join, and redisplay in place of analogues. Condition --label use on availability, and label buffers consistently with diff-no-select. Leave empty line between runs. Let diff-sentinel delete temporary files. Leave point at EOB for next run.
* Eglot: fix problems after changes to eglot-imenu (bug#62718)João Távora2023-04-071-5/+7
| | | | | * lisp/progmodes/eglot.el (eglot--imenu-SymbolInformation) (eglot--imenu-DocumentSymbol): Fix.
* Eglot: version strings must start with numbers (bug#62718)João Távora2023-04-071-10/+10
| | | | | | | | | | | | | | | | | Even though Eglot is a :core ELPA package and as such is on a different release cycle than Emacs proper, the version strings used in 'defcustom' and 'make-obsolete' must still follow the numeric format. * lisp/progmodes/eglot.el (eglot-report-progress): Adjust :version. (eglot-lsp-abiding-column) (eglot-current-column) (eglot-current-column-function) (eglot-move-to-current-column) (eglot-move-to-lsp-abiding-column) (eglot-move-to-column-function) (eglot-ignored-server-capabilites) (eglot-manual) (eglot--managed-mode-hook): Update "obsolete" spec.
* Eglot: use Eglot versions, not Emacs's in obsolete specsJoão Távora2023-04-071-11/+11
| | | | | | | | | | | | | * lisp/progmodes/eglot.el (eglot-report-progress): Adjust :version. (eglot-lsp-abiding-column) (eglot-current-column) (eglot-current-column-function) (eglot-move-to-current-column) (eglot-move-to-lsp-abiding-column) (eglot-move-to-column-function) (eglot-ignored-server-capabilites) (eglot-manual) (eglot--managed-mode-hook): Update "obsolete" spec.
* Eglot: require optional text-property-search.elJoão Távora2023-04-071-3/+5
| | | | | | | | | | | | Originally reported in https://github.com/joaotavora/eglot/discussions/1201. Also check for text-property-search-forward before using it, so we won't break on Emacs 26.3. At this point, better start relying on compat.el, I guess. * lisp/progmodes/eglot.el (eglot--format-markup): Check for text-property-search-forward.
* Eglot: be careful about gfm-view-mode read-only buffersJoão Távora2023-04-071-3/+4
| | | | | | | | | | | | Although in most situations this doesn't error, it's only because of the very wide binding of inhibit-read-only in jsonrpc--process-filter. That binding will soon be narrowed, so better not rely on it. Originally reported in https://github.com/joaotavora/eglot/discussions/1202. * lisp/progmodes/eglot.el (eglot--format-markup): Inhibit read-only before touching buffer potentially in gfm-view-mode.
* ; Eglot: fix misplaced parenthesis in last commit to eglot-tests.elJoão Távora2023-04-071-1/+1
| | | | | * test/lisp/progmodes/eglot-tests.el (eglot-test-eldoc-after-completions): Fix misplaced parenthesis.
* ; * test/src/comp-tests.el (61917-1): Underscore unused parameter.Mattias Engdegård2023-04-071-1/+1
|
* Remove useless unwind-protect forms, or make them useful as intendedMattias Engdegård2023-04-0721-482/+457
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/imenu.el (imenu--generic-function): * lisp/mail/yenc.el (yenc-decode-region): * lisp/textmodes/table.el (table-recognize-region): * test/lisp/dired-tests.el (dired-test-directory-files): * test/lisp/hl-line-tests.el (hl-line-tests-sticky): Fix unwind-protect bracketing mistakes that caused the unwind code to be misplaced. * lisp/strokes.el (strokes-read-stroke): Fix a bracketing mistake that misplaced the unwind code, and another one that misplaced the else-clause of an `if` form. * test/lisp/gnus/mml-sec-tests.el (mml-secure-test-fixture): Fix a bracketing mistake that misplaced the unwind code, and remove superfluous condition-case. * lisp/mwheel.el (mouse-wheel-global-text-scale): * lisp/speedbar.el (speedbar-stealthy-updates) (speedbar-fetch-dynamic-etags): * lisp/emacs-lisp/edebug.el (edebug--recursive-edit): * lisp/emacs-lisp/package.el (package--read-pkg-desc): * lisp/cedet/semantic.el (semantic-refresh-tags-safe): * lisp/emulation/viper-cmd.el (viper-escape-to-state): * lisp/emulation/viper-cmd.el (viper-file-add-suffix): * lisp/gnus/mail-source.el (mail-source-movemail): * lisp/mail/feedmail.el (feedmail-send-it-immediately) (feedmail-deduce-address-list): * lisp/mail/mailclient.el (mailclient-send-it): * lisp/mail/smtpmail.el (smtpmail-deduce-address-list): * lisp/mh-e/mh-print.el (mh-ps-print-range): * lisp/textmodes/reftex-index.el (reftex-index-this-phrase): * test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch): (ert-test-run-tests-batch-expensive): Remove unwind-protect forms that are apparently useless, some since a prior edit that removed their purpose, some since their first appearance. * test/lisp/subr-tests.el (subr-test--frames-2): Insert dummy unwind form in backtrace test code.
* * test/infra/Dockerfile.emba (emacs-eglot): Adapt software selection.Michael Albinus2023-04-071-2/+2
|
* Eglot: no more tests based on Pylsp (bug#62694)João Távora2023-04-071-112/+85
| | | | | | | | | | | | | | | | | | | | | The functionality under test in eglot.el is exactly the same, but use the clangd server only, as that is used in more tests, and it is much easier to check if it misbehaves or not. Tests pass with clangd version 15. * test/lisp/progmodes/eglot-tests.el (python): Don't require it. (eglot--call-with-fixture): Simplify. (eglot--wait-for-clangd): New helper. (eglot-test-basic-completions) (eglot-test-non-unique-completions, eglot-test-basic-xref) (eglot-test-snippet-completions) (eglot-test-snippet-completions-with-company) (eglot-test-eldoc-after-completions, eglot-test-multiline-eldoc): Use clangd, not pylsp. (eglot-test-formatting): Renamed from eglot-test-python-autopep-formatting. (eglot-test-python-yapf-formatting): Remove.
* Eglot: rework eglot-imenuJoão Távora2023-04-072-43/+43
| | | | | | | | | | | | | | Most newer servers return a vector of 'DocumentSymbol' as a response to 'textDocument/documentSymbol'. It's not worth trying to dumb this down to imenu format of 'SymbolInformation' vectors. This lays groundwork for the forthcoming "breadcrumb" feature of bug#58431. * lisp/progmodes/eglot.el (eglot--imenu-SymbolInformation, eglot--imenu-DocumentSymbol): New helpers. (eglot-imenu): Rework.
* Avoid failing the build when org-version.el is updatedEli Zaretskii2023-04-061-0/+8
| | | | | * lisp/Makefile.in: Force recompilation of all Org files when org-version.el is updated with a new Org version.