In 03ac16ece4 I fixed a bug with the
PCM implementation of substring completion, relating to the handling
of PCM wildcards.
However, this fix was incomplete. This change completes the fix by
also including a fixed string if it appears before a 'prefix'
wildcard, even if 'try-completion' doesn't discover that fixed
string grows to a unique completion.
I discovered this bug while working on enhancements to PCM
completion related to 'completion-pcm-leading-wildcard'.
* lisp/minibuffer.el (completion-pcm--merge-completions): Include
fixed strings before 'prefix wildcard. (Bug#72819)
* test/lisp/minibuffer-tests.el (completion-substring-test-5): Add a
test for this behavior.
* doc/lispref/keymaps.texi (Easy Menu):
* lisp/emacs-lisp/easymenu.el (easy-menu-define): Document that
SYMBOL is also defined as a variable. (Bug#73108)
For buffers with multiple parsers, it's important to set this variable
so font-lock invalidation works smoothly.
* lisp/progmodes/c-ts-mode.el (c-ts-mode): Set treesit-primary-parser.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): Set
treesit-primary-parser.
Here by multibyte buffer I mean buffer that includes non-ASCII
characters.
The problem is illustrated by this comment, which I copied from the
source:
======================================================================
(ref:bytepos-range-pitfall) Suppose we have the following buffer
content ([ ] is a unibyte char, [ ] is a multibyte char):
[a][b][c][d][e][ f ]
and the following ranges (denoted by braces):
[a][b][c][d][e][ f ]
{ }{ }
So far so good, now user deletes a unibyte char at the beginning:
[b][c][d][e][ f ]
{ }{ }
Oops, now our range cuts into the multibyte char, bad!
======================================================================
* src/treesit.c (treesit_debug_print_parser_list): Minor fix.
(treesit_sync_visible_region): Change the way we fixup ranges, instead
of using the bytepos ranges from tree-sitter, we use the cached lisp
charpos ranges.
(treesit_make_ts_ranges): New function.
(Ftreesit_parser_set_included_ranges): Refactor out the new function
treesit_make_ts_ranges.
(Ftreesit_parser_included_ranges): Rather than getting the ranges from
tree-sitter, just return the cached lisp ranges.
* src/treesit.h (Lisp_TS_Parser): Add some comment.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): New test.
This reverts commit bf23382f1f.
We move around the gap, narrow regions, ralloc, etc, and don't have a
way to invalidate previously given range. So tree-sitter can't be given
the full range.
After the previous fix in elixir-ts-mode (0fd259d166), embedded heex
code are indented like this:
1 defmodule Foo do
2 def foo(assigns) do
3 ~H"""
4 <span>
5 text
6 </span>
7 """
8 end
9 end
The indent rule finds the beginning of the parent heex node, and uses
the indentation of that line as anchor with an offset of 0. Previously
the parent heex node (fragment) starts at EOL of line 3; after the
previous commit, it now starts at BOL of line 4. To fix the
indentation, I changed the anchor to the beginning of the elixir
(rather than heex) node at point, which is at EOL at line 3.
* lisp/progmodes/heex-ts-mode.el (heex-ts--indent-rules): Use the elixir
node that contains the heex code as the anchor, instead of the heex root
node.
This was inadvertently broken when Windows 9X support was
fixed in June 2024.
* src/w32uniscribe.c (syms_of_w32uniscribe_for_pdumper): Set
'uniscribe_available' non-zero in non-Cygwin builds. (Bug#73159)
* test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture):
Check for buffer liveness (https://debbugs.gnu.org/72765#29).
(eglot-test-rust-completion-exit-function): Don't expect snippet
expansion to happen (no yasnippet in batch mode).
1. In treesit_sync_visible_region, reduce the ranges for a parser so it
doesn't go beyond the visible range.
2. To avoid possible infinite recursion, add a within_reparse field to
parsers. Previously we were using the need_reparse field to avoid
infinite recursion, but lisp programs in a parser's after change hook
might make some buffer edit which turns need_reparse to true. To avoid
that, we now use an explicit field. If a parser's after change function
makes a buffer edit, lisp program ends up with a desynced parse tree,
but that's better than possible infinite recursion. Also after change
function shouldn't edit the buffer.
3. In treesit_make_ranges, use parser's visible_beg instead of buffer's
BEGV. I mean technically whenever we make ranges, buffer's BEGV should
be equal to parser's visible_beg, but better not take that uncertainty,
also makes the code more readable.
4. In Ftreesit_parser_included_ranges, move visible region sync code
before the body of the function.
* src/treesit.c (treesit_sync_visible_region): Minimally fix ranges so
it doesn't exceed parser's visible range.
(treesit_call_after_change_functions): Update calling sigature to
treesit_make_ranges.
(treesit_ensure_parsed, make_treesit_parser): Use the new field
within_reparse.
(treesit_make_ranges): Use parser's visible_beg instead of buffer's
BEGV.
(Ftreesit_parser_included_ranges): Move visible region check before
function body.
* src/treesit.h (Lisp_TS_Parser): Add new field within_reparse.
* lisp/progmodes/elixir-ts-mode.el:
(elixir-ts--treesit-range-rules): Add underscore in front of the name
capture, so Emacs won't put heex parser on it.
The JSON format is defined as a byte sequence and will always be used as
such, so returning a multibyte string makes little sense.
* src/json.c (json_out_to_string): Remove.
(Fjson_serialize): Return unibyte string.
* test/src/json-tests.el (json-serialize/roundtrip)
(json-serialize/roundtrip-scalars, json-serialize/string):
Update tests.
* doc/lispref/text.texi (Parsing JSON): Document.
* etc/NEWS: Announce.
* doc/lispref/os.texi (Suspending Emacs):
* src/keyboard.c (Fsuspend_emacs): Document possible failures
in sending STUFFSTRING to the shell. (Bug#73100).
* lisp/emacs-lisp/chart.el (chart--file-size)
(chart--directory-size): New functions.
(chart-space-usage): Invoke 'du' correctly on MS-Windows. Provide
alternative implementation in Lisp when 'du' is not installed,
using 'chart--directory-size' and 'chart--file-size'. (Bug#72919)
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Ensure
proper alignment between the columns in header-line and in the
body of the table. (Bug#73032)
* doc/misc/vtable.texi (Making A Table): Document the defaults of
the various keyword parameters.