]> git.eshelyaron.com Git - emacs.git/log
emacs.git
20 months ago; * lisp/treesit.el (treesit-node-top-level): Fix typo.
Eli Zaretskii [Sat, 15 Apr 2023 10:02:25 +0000 (13:02 +0300)]
; * lisp/treesit.el (treesit-node-top-level): Fix typo.

20 months ago; * doc/misc/gnus.texi (Finding the Parent): Fix whitespace.
Eli Zaretskii [Sat, 15 Apr 2023 09:55:35 +0000 (12:55 +0300)]
; * doc/misc/gnus.texi (Finding the Parent): Fix whitespace.

20 months agoFix errors when nnselect-always-regenerate is t (bug#61539)
Andrew G Cohen [Thu, 30 Mar 2023 02:11:06 +0000 (10:11 +0800)]
Fix errors when nnselect-always-regenerate is t (bug#61539)

The group parameter nnselect-always-regenerate causes the list of
articles in the group to be generated each time it is needed. For this
to work reliably the list of articles has to be generated at the
appropriate time and to have a reproducible ordering.

* lisp/gnus/gnus-search.el (gnus-search-run-search): For nnselect
groups if the article list has not been stored, regenerate it.
* lisp/gnus/nnselect.el (nnselect-generate-artlist): Sort the
generated list of articles by RSV, group, and number.  Store the
artlist after generation. When the new optional argument INFO is
non-nil, update the group info.
(nnselect-compress-artlist, nnselect-uncompress-artlist): Preserve the
article list ordering.
(nnselect-get-artlist): Return nil when nnselect-always-regenerate is t.
(nnselect-store-artlist): Store the group active range along with the
artlist. Don't keep the artlist if nnselect-always-regenerate is t.
(nnselect-request-group): The full article list isn't needed at this
stage, only the active range.
(nnselect-retrieve-headers): Regenerate the article list if there
is no stored value. Inhibit gnus-demon while retrieving headers.
(nnselect-request-group-scan): Don't generate the article list when
nnselect-always-regenerate is t since it will be generated again later
on.
(nnselect-request-create-group): Allow the artlist to be passed as an
argument to the function. Update the group info and store the artlist.

20 months agoImprove gnus thread-referral
Andrew G Cohen [Tue, 22 Nov 2022 07:39:01 +0000 (15:39 +0800)]
Improve gnus thread-referral

Allow thread referral to use search whenever possible, displaying the
results in the current summary buffer if possible and a new nnselect
buffer if not.

* lisp/gnus/nnimap.el (nnimap-request-thread): Obsolete function.
* lisp/gnus/gnus-search.el (gnus-search-thread): Allow detailed
specification of how/where to search. Add found articles to the
current summary buffer if possible, or create a new ephemeral nnselect
group if not.
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-search): Allow a list
of servers and groups to search.
(gnus-summary-refer-thread): Find thread-related articles by using a
backend-specific method, gnus-search, or retrieving nearby headers in
the current group.
* lisp/gnus/nnselect.el (nnselect-search-thread): Obsolete function.
(nnselect-request-thread): Allow thread referral from nnselect groups.
* doc/misc/gnus.texi (Finding the Parent): Document changes to thread
referral.

20 months agoSupport treesit-thing-settings in search functions
Yuan Fu [Fri, 14 Apr 2023 22:13:11 +0000 (15:13 -0700)]
Support treesit-thing-settings in search functions

* src/treesit.c (safe_assq)
(treesit_traverse_get_predicate): New functions.
(treesit_traverse_validate_predicate)
(treesit_traverse_match_predicate): Support symbols.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree)
(Ftreesit_node_match_p): Move validation down so we can pass LANGUAGE
to it.

20 months agoAdd a recursion level limit for tree-sitter search predicates
Yuan Fu [Fri, 14 Apr 2023 20:32:55 +0000 (13:32 -0700)]
Add a recursion level limit for tree-sitter search predicates

* src/treesit.c:
(treesit_traverse_validate_predicate): Check for recursion level.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree)
(Ftreesit_node_match_p): Update uses of
treesit_traverse_validate_predicate.

20 months ago; Minor fixes in treesit.c
Yuan Fu [Fri, 14 Apr 2023 18:19:25 +0000 (11:19 -0700)]
; Minor fixes in treesit.c

* src/treesit.c:
(treesit_initialized): Make static.
(treesit_find_override_name): Add check for XCAR (tail).
(Ftreesit_parser_set_included_ranges): Fix comment.

(treesit_recursion_limit): Change to a compile time
constant.
(treesit_symbol_to_c_name): Precompute the length.
(Ftreesit_pattern_expand): Use predefined symbols.
(treesit_cursor_helper)
(Ftreesit_search_subtree)
(Ftreesit_induce_sparse_tree): Update treesit_recursion_limit.
(syms_of_treesit): New symbols.

20 months agoAdd treesit-thing-settings
Yuan Fu [Fri, 14 Apr 2023 17:37:10 +0000 (10:37 -0700)]
Add treesit-thing-settings

* lisp/treesit.el (treesit--things-around)
(treesit--navigate-thing)
(treesit-thing-at-point): Update docstring.
* src/treesit.c (treesit_traverse_validate_predicate): Refer to
treesit-thing-settings.
(syms_of_treesit): Add Vtreesit_thing_settings.

20 months agoConvert PATTERN and REGEXP to PRED in tree-sitter functions
Yuan Fu [Fri, 14 Apr 2023 04:58:52 +0000 (21:58 -0700)]
Convert PATTERN and REGEXP to PRED in tree-sitter functions

Just changing names.

* lisp/treesit.el (treesit-beginning-of-thing):
(treesit-end-of-thing)
(treesit--things-around)
(treesit--navigate-thing)
(treesit-thing-at-point): Change REGEXP and PATTERN to PRED.

20 months agoMake use of the new pred shapes in treesit.el
Yuan Fu [Fri, 14 Apr 2023 02:48:57 +0000 (19:48 -0700)]
Make use of the new pred shapes in treesit.el

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.

20 months agoAdd treesit-node-match-p
Yuan Fu [Fri, 14 Apr 2023 02:20:53 +0000 (19:20 -0700)]
Add treesit-node-match-p

* src/treesit.c (Ftreesit_node_match_p): New function.

20 months agoDisallow creation of circular variable alias chains
Mattias Engdegård [Fri, 14 Apr 2023 16:26:27 +0000 (18:26 +0200)]
Disallow creation of circular variable alias chains

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.

20 months agoImprove C++ concept indentation.
Alan Mackenzie [Fri, 14 Apr 2023 16:37:33 +0000 (16:37 +0000)]
Improve C++ concept indentation.

This fixes bug #62386.

* lisp/progmodes/cc-engine.el (c-forward-over-compound-identifier): Don't
move forward over whitespace following the identifier.
(c-forward-primary-expression): Add parameter stop-at-end meaning don't move
forward over whitespace after the construct when non-nil.  Don't recognise a
primary expression when an open brace follows a parenthesized expression.
(c-forward-constraint-clause): Extracted from c-forward-c++-requires-clause.
Add parameter stop-at-end as above.
(c-forward-c++-requires-clause): New stop-at-end parameter as above.  Call the
new function c-forward-constraint-clause.
(c-forward-concept-fragment, c-looking-at-concept)
(c-in-requires-or-at-end-of-clause, c-c++-vsemi-p): New functions.
(c-guess-basic-syntax): New CASE 5A.7: "defun" open in a requires expression.
CASE 5F: Close of a non-class declaration level block: Move to earlier in the
function.
CASE 5D: Also check for being in or at end of a constraint.
New CASE 20: A C++ requires sub-clause.
New CASE 16G: The closing brace of a requires clause.
New CASE 17J: First "statement" inside a requires "function".
(c-forward-primary-expression, c-forward-declarator, c-forward-decl-or-cast-1)
(c-looking-at-or-maybe-in-bracelist): Amend the method of detecting end of
symbol "requires" (aka c-fun-name-substitute-key).

* lisp/progmodes/cc-fonts.el (c-get-fontification-context): Amend the method
of detecting end of symbol "requires".

* lisp/progmodes/cc-langs.el (c-at-vsemi-p-fn): Change the C++ entry to
c-c++-vsemi-p.
(c-fun-name-substitute-key): Change to an unadorned regexp.

* lisp/progmodes/cc-vars.el (c-offsets-alist): Add new syntactic symbol
constraint-cont.

* doc/misc/cc-mode.texi (Syntactic Symbols): Add an entry for contraint-cont.
(Constraint Symbols): New node under Syntactic Symbols.

20 months ago* src/nsterm.m (check_native_fs): Add missing void arg.
Robert Pluim [Thu, 13 Apr 2023 08:05:17 +0000 (10:05 +0200)]
* src/nsterm.m (check_native_fs): Add missing void arg.

20 months ago; Fix typos
Michael Albinus [Fri, 14 Apr 2023 12:36:29 +0000 (14:36 +0200)]
; Fix typos

* etc/NEWS: Fix typos.

* lisp/progmodes/flymake.el (flymake-error-echo)
(flymake-warning-echo, flymake-note-echo)
(flymake-show-diagnostics-at-end-of-line): Fix :package-version.

20 months agoUse BASE_EQ in treesit.c
Mattias Engdegård [Fri, 14 Apr 2023 10:15:13 +0000 (12:15 +0200)]
Use BASE_EQ in treesit.c

* src/treesit.c (Ftreesit_node_check, Ftreesit_pattern_expand)
(Ftreesit_query_capture, treesit_traverse_validate_predicate)
(treesit_traverse_match_predicate):
Use BASE_EQ instead of EQ where this is obviously correct.

20 months agoMake c-emacs-features use the proper binding of parse-sexp-lookup-properties
Alan Mackenzie [Fri, 14 Apr 2023 10:33:03 +0000 (10:33 +0000)]
Make c-emacs-features use the proper binding of parse-sexp-lookup-properties

This is relevant for bug #58558, although it does not fix it.  Due to a wrong
ordering of with-current-buffer and a let form, the function overwrote the
global value of parse-sexp-lookup-properties and two other variables.

* lisp/progmodes/cc-defs.el (c-emacs-features): Change the nesting of
with-current-buffer and let so that the let bindings get used.

20 months agoFix tree-sitter test
Yuan Fu [Fri, 14 Apr 2023 02:18:52 +0000 (19:18 -0700)]
Fix tree-sitter test

* test/src/treesit-tests.el:
(treesit-search-forward-predicate-invalid-predicate): Fix test.

20 months agoFix previous commit on tree-sitter
Yuan Fu [Fri, 14 Apr 2023 01:45:07 +0000 (18:45 -0700)]
Fix previous commit on tree-sitter

* 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.

20 months agoFix and cleanup nnselect-push-info
Andrew G Cohen [Fri, 14 Apr 2023 00:42:29 +0000 (08:42 +0800)]
Fix and cleanup nnselect-push-info

* lisp/gnus/nnselect.el (nnselect-push-info): Don't update backend
marks when quit-config is not nil since gnus-update-marks has already
been called.  Move checking for unread articles outside the
gnus-atomic block so it may be interrupted.  Replace let* with let.
Cleanup code.

20 months agoFix bugs in treesit.o
Po Lu [Fri, 14 Apr 2023 00:01:12 +0000 (08:01 +0800)]
Fix bugs in treesit.o

* src/treesit.c (treesit_traverse_match_predicate): Remove
redundant cast.
(treesit_search_forward, treesit_traverse_cleanup_cursor)
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Fix coding style and specpdl
unwinding.

20 months agoSupport more predicates in tree-sitter search functions
Yuan Fu [Thu, 13 Apr 2023 22:03:05 +0000 (15:03 -0700)]
Support more predicates in tree-sitter search functions

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.

20 months agoCatch signals produced by PRED in tree-sitter search functions
Yuan Fu [Thu, 13 Apr 2023 21:36:46 +0000 (14:36 -0700)]
Catch signals produced by PRED in tree-sitter search functions

Earlier we switched to using cursors rather than nodes to traverse the
parse tree.  Because cursors need cleanup, we have to catch signals
thrown by the predicate functions and free the cursor. Failing to do
this will result in leaking the cursor whenever the predicate function
signals in a search function.

This change fixes the leak.

* src/treesit.c (treesit_traverse_cleanup_cursor): New function.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Catch signals.

20 months agoFix tree-sitter tests
Yuan Fu [Thu, 13 Apr 2023 07:52:17 +0000 (00:52 -0700)]
Fix tree-sitter tests

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.

20 months ago; * doc/misc/flymake.texi (Customizable variables): fix broken list
Mattias Engdegård [Thu, 13 Apr 2023 19:38:47 +0000 (21:38 +0200)]
; * doc/misc/flymake.texi (Customizable variables): fix broken list

20 months agoFaster and less wrong cl-defsubst inlining
Mattias Engdegård [Thu, 13 Apr 2023 18:21:11 +0000 (20:21 +0200)]
Faster and less wrong cl-defsubst inlining

Always have inlining of functions defined by `cl-defsubst` let-bind
arguments instead of making incorrect guesses when it might be safe to
substitute them and then botching the substitution.

This change generally results in better and safer code for all
callers, in particular `cl-defstruct` constructors, accessors and
mutators.

* lisp/emacs-lisp/cl-macs.el (cl-defsubst): Remove outdated comment.
(cl--defsubst-expand): Simplify: always let-bind.
(cl--sublis): Remove.
(cl-defstruct): Simplify: remove old hack that is no longer needed.

20 months agoEldoc: don't overdisplay if using eldoc-documentation-compose
João Távora [Thu, 13 Apr 2023 10:46:12 +0000 (11:46 +0100)]
Eldoc: don't overdisplay if using eldoc-documentation-compose

bug#62816

This is about a particular value for 'eldoc-documentation-strategy',
'eldoc-documentation-compose'.  Its helper
'eldoc--documentation-compose-1' was buggy.  It created the callback
for all the backends in 'eldoc-documentation-functions', but arranged
so that it could potentially be invoked immediately and trigger
display, half-defeating the purpose of the "patience" and causing
blinking in the echo area.

Now it creates all the callbacks beforehand and only then passes them
to the corresponding members of eldoc-documentation-functions.  This
sets up the correct state in eldoc--invoke-strategy.

* lisp/emacs-lisp/eldoc.el (eldoc--documentation-compose-1):
Delete.
(eldoc-documentation-compose)
(eldoc-documentation-compose-eagerly): Rework.

20 months agoEglot: fix LSP "languageId" detection
João Távora [Thu, 13 Apr 2023 09:01:27 +0000 (10:01 +0100)]
Eglot: fix LSP "languageId" detection

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.

20 months agoFlymake: add new flymake-show-diagnostics-at-end-of-line option
João Távora [Thu, 2 Mar 2023 22:55:31 +0000 (22:55 +0000)]
Flymake: add new flymake-show-diagnostics-at-end-of-line option

Some editors have this.  Depending on your preference, this can either
be wildly distracting and easily confused with actual code, or a
significant early aid that relieves you from moving around or reaching
for the mouse to consult an error message.  To be safe, hide this
behind a customization variable and keep it disabled.

Personally, I find it less obstrusive and more helpful than expected.

* lisp/progmodes/flymake.el (flymake--delete-overlay): New helper.
(flymake--highlight-line): Handle flymake-show-diagnostics-at-end-of-line.
(flymake--clear-foreign-diags): Use flymake--delete-overlay.
(flymake--publish-diagnostics): Use flymake--delete-overlay.
(flymake-mode): Use flymake--delete-overlay.
(flymake-error-echo)
(flymake-warning-echo, flymake-note-echo): New faces.
(flymake-show-diagnostics-at-end-of-line): New option.
(Version): Bump to 1.3.4

* doc/misc/flymake.texi:
(Finding diagnostics): Mention flymake-show-diagnostics-at-end-of-line.
(Customizable variables): Mention
flymake-show-diagnostics-at-end-of-line and a few more relevant faces.

* etc/NEWS (Flymake): Mention flymake-show-diagnostics-at-end-of-line.

20 months agoStronger checking in line-number-at-pos tests
Mattias Engdegård [Thu, 13 Apr 2023 15:35:45 +0000 (17:35 +0200)]
Stronger checking in line-number-at-pos tests

* test/lisp/simple-tests.el (line-number-at-pos-keeps-restriction)
(line-number-at-pos-keeps-point): Check all return values.

20 months agoStop pretending that specpdl overflow can ever occur
Mattias Engdegård [Thu, 13 Apr 2023 15:25:25 +0000 (17:25 +0200)]
Stop pretending that specpdl overflow can ever occur

* src/eval.c (grow_specpdl_allocation): Remove impossible error.
* src/data.c (syms_of_data): Note obsolence of
`excessive-variable-binding`.

20 months ago; reorder function effect-declaration lists
Mattias Engdegård [Thu, 13 Apr 2023 12:08:28 +0000 (14:08 +0200)]
; reorder function effect-declaration lists

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns)
(side-effect-and-error-free-fns, pure-fns): Group by file.

20 months agoUpdate effect declarations for many built-in functions
Mattias Engdegård [Wed, 12 Apr 2023 10:20:12 +0000 (12:20 +0200)]
Update effect declarations for many built-in functions

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns)
(side-effect-and-error-free-fns, pure-fns): Add many functions.
* lisp/subr.el (copy-tree): Declare error-free.

20 months ago(RE_SETUP_SYNTAX_TABLE_FOR_OBJECT): Simplify
Stefan Monnier [Wed, 12 Apr 2023 20:32:39 +0000 (16:32 -0400)]
(RE_SETUP_SYNTAX_TABLE_FOR_OBJECT): Simplify

It turns out all calls to this function pass the same value
for the `count` argument, and they're all in `regexp.c`.

* src/syntax.c (RE_SETUP_SYNTAX_TABLE_FOR_OBJECT):
Rename from `SETUP_SYNTAX_TABLE_FOR_OBJECT`.  Remove `count` argument.
Move call to `RE_SYNTAX_TABLE_BYTE_TO_CHAR` to where its result is
actually used.
* src/regex-emacs.c (re_search_2, re_match_2): Adjust accordingly.

* src/syntax.h (RE_SYNTAX_TABLE_BYTE_TO_CHAR): Rename from
`SYNTAX_TABLE_BYTE_TO_CHAR` to clarify that it takes a byteoffset as
used in the regexp engine and not a "bytepos".  Adjust all callers.

20 months ago(SETUP_SYNTAX_TABLE_FOR_OBJECT): Take a byteoffset
Stefan Monnier [Wed, 12 Apr 2023 19:50:49 +0000 (15:50 -0400)]
(SETUP_SYNTAX_TABLE_FOR_OBJECT): Take a byteoffset

* src/syntax.c (SETUP_SYNTAX_TABLE_FOR_OBJECT): Take a byteoffset.
* src/regex-emacs.c (re_search_2, re_match_2): Simplify accordingly.

20 months agosrc/regex-emacs.c (POS_AS_IN_BUFFER): Delete macro
Stefan Monnier [Wed, 12 Apr 2023 19:44:58 +0000 (15:44 -0400)]
src/regex-emacs.c (POS_AS_IN_BUFFER): Delete macro

That macro added 1 to buffer positions because:

    Strings are 0-indexed, buffers are 1-indexed

but the reality is that this 1 was added to the regexp engine's "byte
offsets" which are not 1-based byte positions as used throughout
the rest of Emacs, but they are BEGV_BYTE-relative offsets, so the two
did not cancel out.

* src/regex-emacs.c (PTR_TO_OFFSET, POS_AS_IN_BUFFER): Delete macros;
use `POINTER_TO_OFFSET` instead.
(re_search_2, re_match_2, re_match_2_internal): Adjust accordingly.
* src/syntax.h (SYNTAX_TABLE_BYTE_TO_CHAR): Don't remove 1 from buffer
byteoffsets now that `POS_AS_IN_BUFFER` doesn't add it any more.

20 months ago(struct gl_state_s): Delete `offset` field
Stefan Monnier [Wed, 12 Apr 2023 19:14:39 +0000 (15:14 -0400)]
(struct gl_state_s): Delete `offset` field

`gl_state` had an `offset` field because:

    For buffers, regex-emacs.c passes arguments to the
    UPDATE_SYNTAX_TABLE functions which are relative to BEGV

but the reality is that these arguments are byte offsets relative to
BEGV_BYTE whereas `offset` was counted in chars, so the two didn't
cancel each other out.

* src/syntax.h (struct gl_state_s): Delete `offset` field.
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SYNTAX_TABLE_BYTE_TO_CHAR):
* src/syntax.c (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT)
(update_syntax_table, skip_syntaxes): Simplify accordingly.

20 months agoFlymake: futher enhance echo-area appearance of diagnostics
João Távora [Wed, 12 Apr 2023 13:41:13 +0000 (14:41 +0100)]
Flymake: futher enhance echo-area appearance of diagnostics

Also describe new 'echo-face' property in the Flymake manual, and fix
it's mistaken mention of a non-existing 'flymake-severity' property.

* doc/misc/flymake.texi:
(Flymake error types): Describe new properties and correct mention
of 'severity' property.

* lisp/progmodes/flymake.el:
(flymake-diagnostic-oneliner): Rework.
(flymake-error, flymake-warning, flymake-note): Add new 'echo-face' property.
(flymake--highlight-line)
(flymake-eldoc-function)
(flymake--tabulated-entries-1): Use flymake-diagnostic-oneliner
(Version): Bump to 1.3.3

20 months ago`byte-code-function-p` is error-free
Mattias Engdegård [Wed, 12 Apr 2023 08:42:57 +0000 (10:42 +0200)]
`byte-code-function-p` is error-free

* lisp/emacs-lisp/byte-opt.el
(side-effect-free-fns, side-effect-and-error-free-fns):
Upgrade `byte-code-function-p` to error-free status.

20 months agoBetter compilation of arguments to `ignore`
Mattias Engdegård [Wed, 12 Apr 2023 08:17:01 +0000 (10:17 +0200)]
Better compilation of arguments to `ignore`

* lisp/emacs-lisp/bytecomp.el (byte-compile-form)
(byte-compile-ignore):
Instead of compiling each `ignore` argument for value which is then
immediately discarded, compile it for effect but suppress
ignore-return-value warnings by passing the special value
`for-effect-no-warn` as for-effect parameter.
Proposed by Stefan Monnier.

20 months agoPrompt target dir in treesit-install-language-grammar (bug#62704)
Yuan Fu [Wed, 12 Apr 2023 07:00:26 +0000 (00:00 -0700)]
Prompt target dir in treesit-install-language-grammar (bug#62704)

* lisp/treesit.el (treesit--check-repo-url): New variable.
(treesit-install-language-grammar): Prompt for target directory.

20 months agoDefine sexp in c-ts-mode more broadly (bug#62302)
Yuan Fu [Thu, 6 Apr 2023 21:47:51 +0000 (14:47 -0700)]
Define sexp in c-ts-mode more broadly (bug#62302)

* lisp/progmodes/c-ts-mode.el: Define sexp in c/c++-ts-mode as
anything but delimiters.

20 months agoAdd 'restricted' tactic in tree-sitter navigation functions
Yuan Fu [Thu, 6 Apr 2023 21:38:00 +0000 (14:38 -0700)]
Add 'restricted' tactic in tree-sitter navigation functions

* lisp/treesit.el (treesit-forward-sexp): Add docstring.  Use
'restricted' tactic.
(treesit-transpose-sexps): Fix docstring.
(treesit-beginning-of-thing)
(treesit-end-of-thing): Add support for TACTIC.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Supply treesit-defun-tactic as TACTIC.
(treesit--navigate-thing): Add support for TACTIC.  Wrap the old form
in a new (if (eq tactic 'restricted) (new-code) (old-form)), and
supply the TACTIC parameter when recursing.

20 months agoExpunge immediately when moving articles from nnimap groups
Andrew G Cohen [Wed, 12 Apr 2023 00:13:23 +0000 (08:13 +0800)]
Expunge immediately when moving articles from nnimap groups

* lisp/gnus/nnselect.el (nnselect-request-move-article): Set
nnimap-expunge to immediately.

20 months agoruby-ts-mode: Do not treat parenless calls' args as separate sexp
Dmitry Gutov [Tue, 11 Apr 2023 23:27:51 +0000 (02:27 +0300)]
ruby-ts-mode: Do not treat parenless calls' args as separate sexp

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--sexp-p): New function.
(ruby-ts-mode): Use it in treesit-sexp-type-regexp (bug#62086).

20 months agoFlymake: take advantage of new Eldoc options
João Távora [Tue, 11 Apr 2023 12:35:43 +0000 (13:35 +0100)]
Flymake: take advantage of new Eldoc options

Only echo the first line of a potentially very large error message.

* lisp/progmodes/flymake.el:
(flymake-diagnostic-oneliner): New helper.
(flymake--tabulated-entries-1)
(flymake-eldoc-function): Use it.
(Version): Bump to 1.3.2.
(Package-Requires): Use Eldoc 1.14.0.

20 months agonndiary.el: fix dodgy schedule code
Mattias Engdegård [Tue, 11 Apr 2023 09:57:07 +0000 (11:57 +0200)]
nndiary.el: fix dodgy schedule code

* lisp/gnus/nndiary.el (nndiary-last-occurrence):
Don't sort a list and throw away the result because that leaves the
list variable in an undefined state.  Just take the largest element
because that was obviously what the author meant.

20 months agoallout.el: fix subtree expose numbering bug
Mattias Engdegård [Tue, 11 Apr 2023 09:50:17 +0000 (11:50 +0200)]
allout.el: fix subtree expose numbering bug

* lisp/allout.el (allout-process-exposed): Reverse the list of indices
properly so that the correct numbering for nodes in a subtree is used.
Avoid destructive reversing; the list may be a constant (literal).
This flaw was revealed by an ignored-return-value warning.

20 months agoeshell: Add 'rgrep' builtin
Antero Mejr [Fri, 24 Mar 2023 20:41:41 +0000 (20:41 +0000)]
eshell: Add 'rgrep' builtin

* lisp/eshell/em-unix.el (eshell/rgrep): New function.
(eshell-unix-initialize): Add "rgrep" to 'eshell-complex-commands'.

* etc/NEWS: Add NEWS entry for rgrep.

* doc/misc/eshell.texi (Built-ins): Add documentation for rgrep.

20 months ago* lisp/gnus/nnselect.el (nnselect-push-info): Sort artlist
Andrew G Cohen [Mon, 10 Apr 2023 03:34:43 +0000 (11:34 +0800)]
* lisp/gnus/nnselect.el (nnselect-push-info): Sort artlist

20 months ago(org-table-make-reference): Fix compiler warning
Stefan Monnier [Tue, 11 Apr 2023 01:33:56 +0000 (21:33 -0400)]
(org-table-make-reference): Fix compiler warning

* lisp/org/org-table.el (org-table-make-reference): Don't use `eq` to
compare against literal strings.

20 months agoAdd support for prompting for projects by name
Spencer Baugh [Mon, 10 Apr 2023 19:11:06 +0000 (15:11 -0400)]
Add support for prompting for projects by name

* lisp/progmodes/project.el (project-prompter):
New user option (bug#62759).
(project-prompt-project-name): New function.

20 months agohtml-ts-mode--indent-rules: Use 'column-0' instead of 'point-min'
Dmitry Gutov [Mon, 10 Apr 2023 21:24:19 +0000 (00:24 +0300)]
html-ts-mode--indent-rules: Use 'column-0' instead of 'point-min'

* lisp/textmodes/html-ts-mode.el (html-ts-mode--indent-rules):
Use 'column-0' instead of 'point-min' (bug#62752).

20 months agoTake better care when setting margins in erc-stamp
F. Jason Park [Mon, 10 Apr 2023 07:08:37 +0000 (00:08 -0700)]
Take better care when setting margins in erc-stamp

* lisp/erc/erc-stamp.el (erc-stamp--adjust-right-margin,
erc-stamp--display-margin-mode): Prefer setting
`fringes-outside-margins' to hiding right margin, and check whether
current buffer is showing before adjusting anything.  (Bug#60936.)

20 months agoDon't use `mapconcat` for effect
Mattias Engdegård [Mon, 10 Apr 2023 13:20:27 +0000 (15:20 +0200)]
Don't use `mapconcat` for effect

* lisp/progmodes/make-mode.el (makefile-browser-fill):
* lisp/url/url-mailto.el (url-mailto):
Use `mapc` instead of `mapconcat`.

20 months agoebnf2ps: eliminate double nreverse
Mattias Engdegård [Mon, 10 Apr 2023 13:07:24 +0000 (15:07 +0200)]
ebnf2ps: eliminate double nreverse

* lisp/progmodes/ebnf-otz.el (ebnf-split-suffix): Simplify code that
relied on a rather inobvious in-place reversal of a list twice for
correctness, silencing a byte-compiler warning.

20 months agoClarify process-environment in eglot-tests
Basil L. Contovounesios [Mon, 10 Apr 2023 09:58:49 +0000 (10:58 +0100)]
Clarify process-environment in eglot-tests

* test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture):
Clarify commentary (bug#61637).  Use null-device and briefer syntax.

20 months agoEnd default-directory with slash in eglot-tests
Basil L. Contovounesios [Mon, 10 Apr 2023 09:42:09 +0000 (10:42 +0100)]
End default-directory with slash in eglot-tests

* 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).

20 months ago; Eliminate warning when `dired-map-over-marks` value is unused
Mattias Engdegård [Mon, 10 Apr 2023 09:15:57 +0000 (11:15 +0200)]
; Eliminate warning when `dired-map-over-marks` value is unused

* lisp/dired.el (dired-map-over-marks): Reformulate.

20 months agoUpdate manual about `sort`
Mattias Engdegård [Mon, 10 Apr 2023 08:25:11 +0000 (10:25 +0200)]
Update manual about `sort`

* doc/lispref/sequences.texi (Sequence Functions):
Remove inaccurate and over-specific claims about how `sort` works for
lists: there is no guarantee that it doesn't modify the `car` fields
of the input list (which is precisely what it does at this time).

20 months agoTweak file/dir creation in eglot-tests
Basil L. Contovounesios [Mon, 10 Apr 2023 09:23:06 +0000 (10:23 +0100)]
Tweak file/dir creation in eglot-tests

* 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)

20 months agoSimplify let-bindings in eglot-tests
Basil L. Contovounesios [Sun, 9 Apr 2023 23:33:13 +0000 (00:33 +0100)]
Simplify let-bindings in eglot-tests

* 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.

20 months agoMinor eglot-tests cosmetics
Basil L. Contovounesios [Sun, 9 Apr 2023 23:18:15 +0000 (00:18 +0100)]
Minor eglot-tests cosmetics

* 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).

20 months agoAvoid Git project in eglot-test-eclipse-connect
Basil L. Contovounesios [Sun, 9 Apr 2023 22:32:14 +0000 (23:32 +0100)]
Avoid Git project in eglot-test-eclipse-connect

* test/lisp/progmodes/eglot-tests.el (eglot-test-eclipse-connect):
Avoid creating a Git project, which subsequently confuses
project-files (bug#62741).

20 months agoTweak ert-remote-temporary-file-directory in tests
Basil L. Contovounesios [Sun, 9 Apr 2023 19:28:32 +0000 (20:28 +0100)]
Tweak ert-remote-temporary-file-directory in tests

* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory):
Don't add trailing slash to HOME (bug#61637).  Reindent docstring.

20 months agoPacify byte-compiler warnings in nadvice-tests
Basil L. Contovounesios [Sat, 8 Apr 2023 16:18:06 +0000 (17:18 +0100)]
Pacify byte-compiler warnings in nadvice-tests

* 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.

20 months agoAdapt Tramp test
Michael Albinus [Sun, 9 Apr 2023 16:51:21 +0000 (18:51 +0200)]
Adapt Tramp test

* test/lisp/net/tramp-tests.el (tramp-test09-insert-file-contents):
Adapt test.

20 months agoExtend ignored-return-value warning to more functions (bug#61730)
Mattias Engdegård [Sun, 9 Apr 2023 13:57:31 +0000 (15:57 +0200)]
Extend ignored-return-value warning to more functions (bug#61730)

Warn when the return value of certain functions is unused.  Previously
this was only done for side-effect-free functions, and for `mapcar`.

These are functions where the return value is important for correct
usage or where ignoring it is likely to indicate a mistake.  The exact
set of functions is tentative and will be modified as we gain a better
understanding of which ones to include.

The current set comprises higher order functions such as `mapcar`
which are not primarily called for the effects of their function
arguments, and list-mutating functions like `nreverse` whose return
value is essential.

* lisp/emacs-lisp/bytecomp.el (byte-compile-form): Add list of
functions to warn about when their value is ignored.
* etc/NEWS: Announce.

20 months agoRemove unused values in effect context
Mattias Engdegård [Sun, 9 Apr 2023 13:27:28 +0000 (15:27 +0200)]
Remove unused values in effect context

* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/org/ob-core.el (org-babel-insert-result):
* lisp/progmodes/prolog.el (prolog-smie-forward-token)
(prolog-smie-backward-token):
Silence ignored-return-value warnings about calls to side-effect-free
functions in the last clause of `cond` statements whose values are
unused.

20 months agoAdjust side-effect-free declarations
Mattias Engdegård [Sun, 9 Apr 2023 11:54:17 +0000 (13:54 +0200)]
Adjust side-effect-free declarations

* lisp/emacs-lisp/byte-opt.el (side-effect-and-error-free-fns):
Add `eql` here.
* lisp/emacs-lisp/cl-macs.el (eql, cl-subst, cl-sublis):
Don't set the `side-effect-free` property here.
`cl-subst` and `cl-sublis` are not side-effect-free.
* lisp/emacs-lisp/cl-extra.el (cl-revappend):
Declare side-effect-free.
* lisp/emacs-lisp/cl-lib.el (cl-copy-list):
Declare side-effect-free and error-free.

20 months agoFix scoping error in Tramp
Michael Albinus [Sun, 9 Apr 2023 14:18:41 +0000 (16:18 +0200)]
Fix scoping error in Tramp

* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-insert-file-contents):
Move result out of unwindform.

20 months ago; * test/src/fns-tests.el: Strengthen tests of `nreverse`.
Mattias Engdegård [Sun, 9 Apr 2023 08:57:43 +0000 (10:57 +0200)]
; * test/src/fns-tests.el: Strengthen tests of `nreverse`.

20 months ago* lisp/emacs-lisp/cl-extra.el (cl-parse-integer): side-effect-free.
Mattias Engdegård [Sun, 9 Apr 2023 08:45:43 +0000 (10:45 +0200)]
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer): side-effect-free.

20 months agoUpdate gnus/nnselect marks only for current articles
Andrew G Cohen [Wed, 29 Mar 2023 06:05:59 +0000 (14:05 +0800)]
Update gnus/nnselect marks only for current articles

* lisp/gnus/nnselect.el (nnselect-push-info): Restrict updating of
marked articles to those whose headers have been retrieved, taking
care to handle 'tuples.

20 months agoCompute gnus/nnselect read articles from summary variables
Andrew G Cohen [Wed, 29 Mar 2023 02:23:06 +0000 (10:23 +0800)]
Compute gnus/nnselect read articles from summary variables

* lisp/gnus/nnselect.el (nnselect-push-info): The current list of read
articles should be computed from the summary buffer local variables,
not from the group info.

20 months agoDon't modify gnus group info when gnus-newsgroup-selection is nil
Andrew G Cohen [Tue, 28 Mar 2023 12:23:34 +0000 (20:23 +0800)]
Don't modify gnus group info when gnus-newsgroup-selection is nil

* lisp/gnus/nnselect.el (nnselect-push-info): Don't try to propagate
info to component groups if gnus-newsgroup-selection is nil.
* lisp/gnus/nnselect.el (nnselect-request-update-info): Don't update
the nnselect group info if gnus-newsgroup-selection is nil.

20 months agoKeep the gnus active range current while getting articles
Andrew G Cohen [Mon, 27 Mar 2023 01:37:55 +0000 (09:37 +0800)]
Keep the gnus active range current while getting articles

* lisp/gnus/gnus-group.el (gnus-group-get-new-news-this-group):
* lisp/gnus/gnus-group.el (gnus-get-unread-articles-in-group): Update
the current value of the active range since it might have changed.

20 months ago* lisp/gnus/nnselect.el (nnselect-request-article): Check car of thread
Andrew G Cohen [Tue, 28 Mar 2023 12:21:13 +0000 (20:21 +0800)]
* lisp/gnus/nnselect.el (nnselect-request-article): Check car of thread

20 months agoproject.el: Use project-name to calculate prefixed buffer name
Spencer Baugh [Sun, 9 Apr 2023 01:50:20 +0000 (04:50 +0300)]
project.el: Use project-name to calculate prefixed buffer name

* lisp/progmodes/project.el (project-prefixed-buffer-name):
Use project-name to calculate prefixed buffer name (bug#62548).
(project-compilation-buffer-name-function): Update doc.

20 months agoEglot: more work on eglot--sig-info (bug#62687)
João Távora [Sat, 8 Apr 2023 22:26:43 +0000 (23:26 +0100)]
Eglot: more work on eglot--sig-info (bug#62687)

Simplify function and now also consider individual parameter
documentation strings, which typescript-language-server seems to
provide.

* lisp/progmodes/eglot.el (eglot--sig-info): Rework.

20 months ago* etc/ERC-NEWS: Add section for ERC 5.6.
F. Jason Park [Sat, 10 Dec 2022 06:00:59 +0000 (22:00 -0800)]
* etc/ERC-NEWS: Add section for ERC 5.6.

20 months agoAllow erc-reuse-frames to favor connections
F. Jason Park [Sat, 21 May 2022 10:04:04 +0000 (03:04 -0700)]
Allow erc-reuse-frames to favor connections

* 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.)

20 months agoMake auth-source erc-services tests more readable
F. Jason Park [Fri, 25 Nov 2022 05:03:03 +0000 (21:03 -0800)]
Make auth-source erc-services tests more readable

* 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.

20 months agoAdd erc-button helper for substituting command keys
F. Jason Park [Mon, 19 Dec 2022 03:01:40 +0000 (19:01 -0800)]
Add erc-button helper for substituting command keys

* 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.)

20 months agoReplace Info-goto-node with info in erc-button-alist
F. Jason Park [Mon, 19 Dec 2022 03:01:40 +0000 (19:01 -0800)]
Replace Info-goto-node with info in erc-button-alist

* 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.)

20 months agoAdd erc-fill style based on visual-line-mode
F. Jason Park [Fri, 13 Jan 2023 08:00:56 +0000 (00:00 -0800)]
Add erc-fill style based on visual-line-mode

* 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.

20 months agoAdd variant for erc-match invisibility spec
F. Jason Park [Fri, 27 Jan 2023 13:34:56 +0000 (05:34 -0800)]
Add variant for erc-match invisibility spec

* 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.)

20 months agoConvert erc-fill minor mode into a proper module
F. Jason Park [Sun, 24 Apr 2022 09:38:12 +0000 (02:38 -0700)]
Convert erc-fill minor mode into a proper module

* 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.)

20 months agoPut display properties to better use in erc-stamp
F. Jason Park [Wed, 24 Nov 2021 13:35:35 +0000 (05:35 -0800)]
Put display properties to better use in erc-stamp

* 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.)

20 months agoMake some erc-stamp functions more limber
F. Jason Park [Wed, 24 Nov 2021 13:35:35 +0000 (05:35 -0800)]
Make some erc-stamp functions more limber

* 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'.

20 months agoExpose insertion time as text prop in erc-stamp
F. Jason Park [Wed, 24 Nov 2021 11:10:20 +0000 (03:10 -0800)]
Expose insertion time as text prop in erc-stamp

* 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.)

20 months agoAdjust some old text properties in ERC buffers
F. Jason Park [Thu, 16 Jun 2022 08:20:49 +0000 (01:20 -0700)]
Adjust some old text properties in ERC buffers

* 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.)

20 months agoRefactor marker initialization in erc-open
F. Jason Park [Tue, 24 Jan 2023 04:48:24 +0000 (20:48 -0800)]
Refactor marker initialization in erc-open

* 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.)

20 months agoPreserve ERC prompt and its bounding markers
F. Jason Park [Mon, 20 Feb 2023 05:33:36 +0000 (21:33 -0800)]
Preserve ERC prompt and its bounding markers

* 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.)

20 months agoAdd option to show visual erc-keep-place indicator
F. Jason Park [Sat, 10 Dec 2022 06:00:59 +0000 (22:00 -0800)]
Add option to show visual erc-keep-place indicator

* 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.)

20 months agoOptionally prompt for more ERC entry-point params
F. Jason Park [Thu, 29 Dec 2022 14:43:19 +0000 (06:43 -0800)]
Optionally prompt for more ERC entry-point params

* 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.)

20 months agoAdd display option for interactive ERC invocations
F. Jason Park [Thu, 29 Dec 2022 14:43:19 +0000 (06:43 -0800)]
Add display option for interactive ERC invocations

* 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.)

20 months agoBe smarter about switching to TLS from M-x erc
F. Jason Park [Thu, 29 Dec 2022 14:43:19 +0000 (06:43 -0800)]
Be smarter about switching to TLS from M-x erc

* 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.)

20 months agoIgnore killed buffers when switching in erc-track
F. Jason Park [Wed, 4 Jan 2023 07:10:53 +0000 (23:10 -0800)]
Ignore killed buffers when switching in erc-track

* 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.)

20 months agoFill doc strings for ERC modules
F. Jason Park [Tue, 17 Jan 2023 04:18:32 +0000 (20:18 -0800)]
Fill doc strings for ERC modules

* 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.)