summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
* Merge from origin/emacs-29Eli Zaretskii2023-04-15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 864a4dc2363 Fix compilation of w32.c with old MinGW system headers a22eb9ae0f9 ruby-add-log-current-method: Reduce the use of 'nreverse' 17d803d0a75 Fix detection of WebP images by their signature 43290391ce2 ; Eglot: make version parseable by version-to-list 6e6e8b5c974 Add more documentation for the keys of `package-vc-select... 7972b76c2c7 ; vc-checkout: Wrap var lookup in 'bound-and-true-p' e9fef1d70ff vc-checkout: Try to use the vc-dir's backend first 372e024accd ; Fix wallpaper-tests on XFCE 7055fd8e43e Improve documentation related to 'ispell-complete-word' 61fd017abde * configure.ac: Add -lbsd on Haiku. 05971c4d9a4 Add menu to 'c-ts-mode' and 'c++-ts-mode' # Conflicts: # lisp/progmodes/eglot.el # lisp/progmodes/ruby-mode.el
| * ruby-add-log-current-method: Reduce the use of 'nreverse'Dmitry Gutov2023-04-13
| | | | | | | | | | | | | | | | | | * lisp/progmodes/ruby-mode.el (ruby-add-log-current-method): Reduce the use of 'nreverse' (bug#62761). * test/lisp/progmodes/ruby-mode-tests.el (ruby-add-log-current-method-singleton-referencing-outer): New test.
| * ; Fix wallpaper-tests on XFCEEli Zaretskii2023-04-11
| | | | | | | | | | | | * test/lisp/image/wallpaper-tests.el (wallpaper--find-command-args/return-list): Account for command-args being a function. (Bug#62673)
* | Merge from origin/emacs-29Eli Zaretskii2023-04-15
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | c62afb10cf0 Fix wallpaper-tests on MS-Windows f2d212c6966 Fix a couple of eglot-tests 338b3718b6c Fix visiting RPM files b4afee03193 Fix ff-quiet-mode doc 2445100d7d6 ; Improve documentation of 'match-buffers' d4d0da96f0b ; Update make-tarball.txt for Emacs 29. 9b0bf694da4 ; Fix ldefs-boot.el. 0cb86a348c7 ; Update ChangeLog.4. # Conflicts: # ChangeLog.4
| * Fix wallpaper-tests on MS-WindowsEli Zaretskii2023-04-11
| | | | | | | | | | | | | | | | | | | | | | * test/lisp/image/wallpaper-tests.el (wallpaper--find-setter) (wallpaper--find-setter/call-predicate) (wallpaper--find-setter/set-current-setter) (wallpaper-set/calls-init-action) (wallpaper-set/calls-wallpaper-set-function) (wallpaper-set/runs-command, wallpaper-set/runs-command/detach): Skip these tests if native functions are used for changing wallpaper. These tests are irrelevant in that case.
| * Fix a couple of eglot-testsBasil L. Contovounesios2023-04-11
| | | | | | | | | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot-test-rust-analyzer-watches-files): Bump timeout. (eglot-test-json-basic): Check for yas-minor-mode before using it, like other tests do (bug#61637).
* | Merge from origin/emacs-29Eli Zaretskii2023-04-15
|\| | | | | | | | | db8f207e52f Fix some cases of incomplete code's indentation [c/c++-ts... 589959fb09d project-search: Pipe the list of files through 'file-regu...
| * Fix some cases of incomplete code's indentation [c/c++-ts-mode]Dmitry Gutov2023-04-10
| | | | | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-base--before-indent): Try to guess when the parse tree is incomplete, and provide a better node to indent against (bug#62717). (c-ts-base-mode): Set up advice for local treesit-indent-function.
| * ; Backport: Eglot: fix misplaced parenthesis in last commit to eglot-tests.elJoão Távora2023-04-09
| | | | | | | | | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot-test-eldoc-after-completions): Fix misplaced parenthesis. (cherry picked from commit 3aedd5c920560fe6456a860a900be40a35e850d2)
| * Backport: Eglot: no more tests based on Pylsp (bug#62694)João Távora2023-04-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. (cherry picked from commit fc8230f3362b12955152f48565a6c670b4c4cc88)
* | Make use of the new pred shapes in treesit.elYuan Fu2023-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | treesit-search-forward and friends now accept more shapes for PRED, make use of it in navigation functions. * lisp/treesit.el (treesit-node-top-level): Use treesit-node-match-p. (treesit--thing-unpack-pattern): Remove function. (treesit-beginning-of-thing) (treesit-end-of-thing): Remove PRED argument. (treesit--things-around): Remove PRED argument, use treesit-node-match-p. (treesit--top-level-thing): Remove function. (treesit--navigate-thing): Remove PRED argument. (treesit-thing-at-point): Update docstring, don't unpack PATTERN. * test/src/treesit-tests.el: (treesit--ert-test-defun-navigation): Don't unpack pattern.
* | Disallow creation of circular variable alias chainsMattias Engdegård2023-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `defvaralias` signal an error upon attempts to create variable alias cycles. This detects errors earlier and makes the alias traversal during execution simpler and faster since no cycle detection is needed elsewhere. Now variable and function aliases are handled identically in these respects. * src/lisp.h (indirect_variable): Remove declaration. * src/data.c (indirect_variable): Remove. (Findirect_variable): Update doc string. Simplify alias resolution. (Fboundp, find_symbol_value, set_internal, default_value) (set_default_internal, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p) (Flocal_variable_if_set_p, Fvariable_binding_locus): * src/buffer.c (buffer_local_value): * src/eval.c (specbind): Simplify variable alias resolution. (Fdefvaralias): Update doc string. Check for cycles. * doc/lispref/variables.texi (Variable Aliases): Mention that `defvaralias` can signal `cyclic-variable-indirection` but `indirect-variable` cannot. * etc/NEWS: Announce the change. * test/src/eval-tests.el (eval-tests-defvaralias): New test.
* | Fix tree-sitter testYuan Fu2023-04-13
| | | | | | | | | | * test/src/treesit-tests.el: (treesit-search-forward-predicate-invalid-predicate): Fix test.
* | Fix previous commit on tree-sitterYuan Fu2023-04-13
| | | | | | | | | | | | | | | | | | | | * src/treesit.c: (treesit_traverse_validate_predicate): Don't accept symbols. (treesit_traverse_match_predicate): Don't accept symbols, and use correct variable for the regexp and pred check. * test/src/treesit-tests.el: (treesit-search-forward-predicate): Fix the test.
* | Support more predicates in tree-sitter search functionsYuan Fu2023-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now we support regexp strings and predicate functions for the PRED argument. This change adds support for (not ...) (or ...) and (regexp . pred) predicates. I still need to find a place to document the supported shapes of a predicate. * src/treesit.c (treesit_traverse_validate_predicate): New function. (treesit_traverse_match_predicate): Support more predicate shapes. (treesit_search_dfs): (treesit_search_forward) (treesit_build_sparse_tree): Fix docstring (unrelated to this change). (Ftreesit_search_subtree) (Ftreesit_search_forward) (Ftreesit_induce_sparse_tree): Use the new function to validate predicate shape. (syms_of_treesit): New error Qtreesit_invalid_predicate. * test/src/treesit-tests.el: (treesit--ert-search-setup): Add edebug declaration. (treesit-search-forward-predicate) (treesit-search-forward-predicate-invalid-predicate): New tests.
* | Fix tree-sitter testsYuan Fu2023-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | After 2ce27563ecc, treesit--navigate-things takes a TACTIC argument instead of using treesit-defun-tactic, so the tests need to change from binding treesit-defun-tactic to passing the tactic argument, which is what this change does. * test/src/treesit-tests.el: (treesit--ert-insert-and-parse-marker): New argument TACTIC. (treesit-defun-navigation-nested-1) (treesit-defun-navigation-nested-2) (treesit-defun-navigation-nested-3) (treesit-defun-navigation-top-level): Pass TACTIC argument.
* | Eglot: fix LSP "languageId" detectionJoão Távora2023-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This sweeping fix has been planned for a while, but a user recently hit this bug as described in https://github.com/joaotavora/eglot/discussions/1206. More and more servers today are "multi-language", meaning can handle more than one file type. This relies on the ':languageId' string being set to the correct value for every buffer managed by Eglot (TextDocumentItem in LSP parlance). Previously this string was calculated based on an imperfect heuristic and was wrong quite often. Many servers don't even care but some others do, so we have to fix it. * lisp/progmodes/eglot.el (eglot-lsp-server): Remove slots 'major-modes' and 'language-id'. Add slot 'languages'. (eglot--major-modes, eglot--language-ids): New helpers. (eglot--lookup-mode): Simplify or maybe complicate. (eglot--guess-contact): Use new eglot--looup-mode. Change return value. (eglot): Rework docstring. (eglot-reconnect): Use eglot--language-ids, not id. (eglot--connect): Setup eglot--languages slot in server. (eglot--TextDocumentItem): Finally, get correct language id. * test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact): Enhance macro. (eglot-test-server-programs-guess-lang): Update test.
* | Stronger checking in line-number-at-pos testsMattias Engdegård2023-04-13
| | | | | | | | | | * test/lisp/simple-tests.el (line-number-at-pos-keeps-restriction) (line-number-at-pos-keeps-point): Check all return values.
* | Clarify process-environment in eglot-testsBasil L. Contovounesios2023-04-10
| | | | | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture): Clarify commentary (bug#61637). Use null-device and briefer syntax.
* | End default-directory with slash in eglot-testsBasil L. Contovounesios2023-04-10
| | | | | | | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture): Separate prefix from random part of temporary file name. Ensure default-directory ends with a directory separator (bug#61637).
* | Tweak file/dir creation in eglot-testsBasil L. Contovounesios2023-04-10
| | | | | | | | | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot--make-file-or-dir): Expand file name only once, under default-directory, avoiding duplicate dir separators. Ensure default-directory ends with a dir separator. Use with-temp-file. (Bug#61637)
* | Simplify let-bindings in eglot-testsBasil L. Contovounesios2023-04-10
| | | | | | | | | | | | | | | | | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture): Don't allow fixture elements to be symbol-value pairs (bug#61637). This feature was used in only one test. The same effect can be achieved in a simpler way, and closer to the body, with plain let-bindings. (eglot--with-fixture): Adapt docstring accordingly. (eglot-test-ensure): Adapt c-mode-hook binding accordingly. (eglot--cleanup-after-test): Remove symbol restoring logic.
* | Minor eglot-tests cosmeticsBasil L. Contovounesios2023-04-10
| | | | | | | | | | | | | | | | * test/lisp/progmodes/eglot-tests.el: (eglot--eldoc-on-demand, eglot--tests-force-full-eldoc) (eglot-test-multiline-eldoc, eglot-test-rust-on-type-formatting) (eglot-test-path-to-uri-windows): Fix headings, commentary, and indentation (bug#61637).
* | Avoid Git project in eglot-test-eclipse-connectBasil L. Contovounesios2023-04-09
| | | | | | | | | | | | * test/lisp/progmodes/eglot-tests.el (eglot-test-eclipse-connect): Avoid creating a Git project, which subsequently confuses project-files (bug#62741).
* | Pacify byte-compiler warnings in nadvice-testsBasil L. Contovounesios2023-04-09
| | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/nadvice-tests.el (advice-test-called-interactively-p) (advice-test-called-interactively-p-around) (advice-test-called-interactively-p-filter-args) (advice-test-call-interactively): Heed advertised-calling-convention of called-interactively-p to pacify byte-compiler warnings.
* | Adapt Tramp testMichael Albinus2023-04-09
| | | | | | | | | | * test/lisp/net/tramp-tests.el (tramp-test09-insert-file-contents): Adapt test.
* | ; * test/src/fns-tests.el: Strengthen tests of `nreverse`.Mattias Engdegård2023-04-09
| |
* | Allow erc-reuse-frames to favor connectionsF. Jason Park2023-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc-reuse-frames): Add alternate value to favor existing frames already displaying buffers from the same connection. (erc--setup-buffer-first-window, erc--display-buffer-use-some-frame): Add helpers to support 'display' variant of `erc-resuse-frames' * test/lisp/erc/erc-tests.el (erc-tests--run-in-term, erc-tests--servars, erc-reuse-frames, erc-tests--erc-reuse-frames, erc-tests--erc-reuse-frames--t, erc-resuse-frames--t, erc-tests--erc-reuse-frames--displayed-single, erc-reuse-frames--displayed-single, erc-tests--assert-server-split, erc-tests--erc-reuse-frames--displayed-double, erc-reuse-frames--displayed-double, erc-tests--erc-reuse-frames--displayed-full, erc-reuse-frames--displayed-full): Add test case and supporting fixtures. (Bug#55540.)
* | Make auth-source erc-services tests more readableF. Jason Park2023-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Put display properties to better use in erc-stampF. Jason Park2023-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.)
* | Expose insertion time as text prop in erc-stampF. Jason Park2023-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.)
* | Refactor marker initialization in erc-openF. Jason Park2023-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.)
* | Leverage loaddefs for migrating ERC modulesF. Jason Park2023-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.)
* | Honor arbitrary CHANTYPES in ERCF. Jason Park2023-04-08
| | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.)