Yuan Fu [Sat, 21 Sep 2024 03:40:26 +0000 (20:40 -0700)]
Fix treesit--merge-ranges (bug#73324)
* lisp/treesit.el (treesit--merge-ranges): Make sure that old
ranges that intersects with START-END are actually discarded.
* test/src/treesit-tests.el (treesit-range-merge): New test.
Stefan Kangas [Sat, 21 Sep 2024 01:41:26 +0000 (03:41 +0200)]
; Delete bug fix from etc/NEWS
* etc/NEWS: Delete bug fix item. No correct program will see a
difference in behavior; at worst, the error message when calling
`(error)` is now better.
Reported by Mattias Engdegård <mattias.engdegard@gmail.com>.
Stefan Kangas [Sat, 21 Sep 2024 00:19:53 +0000 (02:19 +0200)]
Fix midnight-mode documentation
* lisp/midnight.el (Commentary): Document that 'midnight-mode' should be
enabled using the function, instead of by merely loading the library.
In Emacs 31, doing the latter will no longer work. (Bug#73291)
Instead of setting the highlight overlay on every line in the selection,
only do so on the window-height worth of lines closest to point because
the rest aren't likely to be visible.
This makes a massive difference for tall rectangular selections which
previously were so slow as to be unusable.
(Tall selections are still slow if `select-active-regions` is non-nil,
but that is something that users can actually do something about.)
* lisp/rect.el (rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay):
Replace call to `apply-on-rectangle`, which operates on every line,
with a loop over an approximate screenful.
Extend the `rectangle` overlay list structure with a value for point,
because `exchange-point-and-mark` must trigger a recomputation of
highlight overlays despite the selection not actually changing.
Spencer Baugh [Thu, 12 Oct 2023 22:01:46 +0000 (18:01 -0400)]
Support numeric indexing in let-alist
let-alist is very useful. But sometimes an alist contains a list in
the middle, which contains yet more alists. Previously, this was
somewhat painful to deal with, and required something like:
Paul Eggert [Wed, 18 Sep 2024 16:18:29 +0000 (09:18 -0700)]
yes-or-no-p now uses blankp rather than SYNTAX
* src/fns.c: Do not include syntax.h; no longer needed.
(Fyes_or_no_p): Use blankp rather than SYNTAX to check whether the
prompt ends in nonspace. That way, the test doesn’t depend on the
current buffer.
Yuan Fu [Wed, 18 Sep 2024 04:17:13 +0000 (21:17 -0700)]
Conservative heuristic for tree-sitter parser ranges (bug#73324)
* src/treesit.c (treesit_sync_visible_region): If the parser's original
ranges don't overlap with visible region, give it a zero range, rather
than don't set any range.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): Test new
behavior.
Enable GC_REMEMBER_LAST_MARKED by default (it was disabled in Emacs 29)
to make it easier to debug difficult-to-reproduce GC problems
encountered by users. This increases GC costs by about 5 %, which can
be avoided by turning the mark trace buffer back off using the new
--disable-gc-mark-trace option.
See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2024-09/msg00240.html
* configure.ac (--disable-gc-mark-trace): New config option.
* etc/NEWS: Mention it.
* src/alloc.c: Enable it by default and avoid a compiler warning.
Yuan Fu [Sun, 15 Sep 2024 07:24:03 +0000 (00:24 -0700)]
Fix treesit_sync_visible_region's range fixup code (bug#73264)
new_ranges_head
|
v
( )->( )->( )->( )->( )
^ ^
| |
| lisp_ranges (loop head)
|
prev_cons -> set cdr to nil to cut of the rest
result:
( )->( )
* src/treesit.c (treesit_sync_visible_region): Cut off this cons and the
rest, not set the current range's end to nil.
* test/src/treesit-tests.el:
(treesit-range-fixup-after-edit): Add tests for all cases.
Po Lu [Sun, 15 Sep 2024 01:01:25 +0000 (09:01 +0800)]
Document unavailability of frame geometry on Wayland
* etc/PROBLEMS (Runtime problems specific to PGTK build):
Document that frame-edges and company are liable not to return
valid coordinates. (bug#73207)
F. Jason Park [Mon, 14 Feb 2022 10:36:57 +0000 (02:36 -0800)]
Only conditionally resolve hosts in nsm-should-check
Libraries like `socks' need to run `nsm-verify-connection' without
performing DNS lookups. This change allows them to achieve this by
binding `nsm-trust-local-network' to nil around calls to that function.
* lisp/net/nsm.el (nsm-should-check): Rework in a functionally
equivalent way, except forgo calling both `network-lookup-address-info'
and `network-interface-list' unless the various conditions regarding
`nsm-trust-local-network' are first satisfied. Replace `mapc' with
`dolist' to align with modern sensibilities. (Bug#53941)
Paul Eggert [Tue, 17 Sep 2024 23:54:17 +0000 (16:54 -0700)]
Use c-ctype.h in lib-src
This fixes some unlikely bugs and removes the temptation
of using ctype.h. Although some uses were correct,
many weren't.
* lib-src/ebrowse.c: Include c-ctype.h, not ctype.h.
* lib-src/emacsclient.c: Include c-ctype.h, not ctype.h.
* lib-src/update-game-score.c: Include c-ctype.h, not ctype.h.
All uses changed.
Paul Eggert [Tue, 17 Sep 2024 23:38:53 +0000 (16:38 -0700)]
Fix some #! misparsing in check_interpreter
* exec/exec.c: Do not include ctype.h, as the kernel
does not care about the locale.
(check_interpreter): Treat only spaces and tabs as white space.
Do not inspect more bytes than were read.
Although the resulting code does not exactly match what
the Android kernel does, it’s closer than what it was before.
Paul Eggert [Tue, 17 Sep 2024 22:22:02 +0000 (15:22 -0700)]
Fix yes-or-no-p with multibyte spaces
Problem reported by Thomas Klausner (Bug#73307).
Emacs shouldn’t use ctype.h, as it doesn’t work for multibyte
chars and it doesn’t work with Emacs’s locale model anyway.
* src/fns.c: Include syntax.h, not ctype.h.
(Fyes_or_no_p): Check the character category with SYNTAX, not
with isspace, which assumes the current locale and works only
with single-byte characters.
Robert Pluim [Tue, 17 Sep 2024 13:19:01 +0000 (15:19 +0200)]
Fix idna-mapping-table following Unicode 16 changes
The latest version of UTS #46 in Unicode 16 has changed the way it
indicates which codepoints are invalid in domain names, causing
'idna-mapping-table' to contain incorrect information, which then breaks
'textsec-domain-suspicious-p' and our test suite. (Bug#73312)
* admin/unidata/unidata-gen.el (unidata-gen-idna-mapping): Check the
IDNA validity field in "IdnaMappingTable.txt" in addition to checking
the status field, as the latter can now be 'valid' for disallowed
codepoints.
Completion Preview mode implicitly assumed that
'completion-ignore-case' is nil, and while it can also work
with 'completion-ignore-case' non-nil, the results are a bit
different than what you get with 'completion-at-point'. Add
an option that controls case sensitivity explicitly and
specifically for Completion Preview mode, and clarify the
behavior when case differences are ignored. (Bug#73234)
* lisp/completion-preview.el
(completion-preview-ignore-case): New user option.
Yuan Fu [Sat, 14 Sep 2024 18:07:28 +0000 (11:07 -0700)]
Fix c++-ts-mode font-lock for latest c++ grammar (bug#73191)
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--keywords): Add "thread_local" keyword.
(c-ts-mode--test-virtual-named-p): New function.
(c-ts-mode--font-lock-settings): Use named/anonymous "virtual" depending
on the grammar.
David Fussner [Mon, 10 Jun 2024 13:16:04 +0000 (14:16 +0100)]
Provide a modified xref backend for TeX buffers
In addition to providing a new `xref' backend, the patch also improves
the general handling of expl3 syntax. Expl3 is the next-generation
LaTeX specification, and has for some time been available by default in
the LaTeX kernel. The new syntax co-exists in many files with the
standard LaTeX2e syntax, so we try at least minimally to separate the
way modes handle the two specifications, both to reduce
visually-disturbing interference between them and also to improve the
`xref' backend. (Bug#53749)
* lib-src/etags.c (TeX_commands): Improve parsing of commands in TeX
buffers.
(TEX_defenv): Expand list of commands to tag by default in TeX buffers.
(TeX_help):
* doc/emacs/maintaining.texi (Tag Syntax): Document new tagged commands.
(Identifier Search): Add note about semantic-symref-filepattern-alist,
auto-mode-alist, and xref-find-references.
* lisp/textmodes/tex-mode.el (tex-font-lock-suscript): Test for
underscore in expl3 files and regions, disable subscript face there.
(tex-common-initialization): Set up xref backend for in-tree TeX modes.
Detect expl3 files, and in others set up a list of expl3 regions.
(tex-expl-buffer-parse): New function called in previous.
(tex-expl-buffer-p): New variable to hold the result of previous.
(tex-expl-region-set): New function added to
'syntax-propertize-extend-region-functions' hook.
(tex-expl-region-list): New variable to hold the result of previous.
(tex--xref-backend): New function to identify the xref backend.
(tex--thing-at-point, tex-thingatpt--beginning-of-symbol)
(tex-thingatpt--end-of-symbol, tex--bounds-of-symbol-at-point):
New functions to return 'thing-at-point' for xref backend.
(tex-thingatpt-exclude-chars): New variable to do the same.
(xref-backend-identifier-at-point): New TeX backend method to provide
symbols for processing by xref.
(xref-backend-identifier-completion-table)
(xref-backend-identifier-completion-ignore-case)
(xref-backend-definitions, xref-backend-apropos): Placeholders to
call the standard 'etags' xref backend methods.
(xref-backend-references): Wrapper to call the default xref backend
method, finding as many relevant files as possible and using a bespoke
syntax-propertize-function when required.
(tex--collect-file-extensions, tex-xref-syntax-function): Helper
functions for previous.
(tex-find-references-syntax-table, tex--buffers-list)
(tex--xref-syntax-fun, tex--old-syntax-function): New variables for
the same.
* lisp/progmodes/compile.el (compilation--update-markers):
Factor out function...
(compilation-next-error-function): ...from here. Adjust
to use the above.
* lisp/progmodes/grep.el (grep-edit--prepare-buffer)
(grep-edit-mode-map, grep-edit-mode-hook, grep-edit-mode)
(grep-change-to-grep-edit-mode, grep-edit-save-changes): Add
new 'grep-edit-mode' to make the grep results editable like
in 'occur-edit-mode' by using the 'occur' framework.
(grep-mode-map): Bind 'e' to the new command
'grep-change-to-grep-edit-mode'.
* doc/emacs/building.texi (Grep Searching): Update Info
manual to include the above command.
* etc/NEWS: Announce the change. (Bug#70820)
Spencer Baugh [Mon, 26 Aug 2024 14:12:51 +0000 (10:12 -0400)]
Correctly include fixed strings before a prefix wildcard in PCM
In 03ac16ece40ba3e3ba805d6a61cc457d84bf3792 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.
Eli Zaretskii [Sat, 14 Sep 2024 08:55:08 +0000 (11:55 +0300)]
; Improve documentation of 'easy-menu-define'
* 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)
Yuan Fu [Sat, 14 Sep 2024 07:46:05 +0000 (00:46 -0700)]
Set treesit-primary-parser for c and elixir ts mode
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.
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.
Robert Pluim [Fri, 13 Sep 2024 14:08:56 +0000 (16:08 +0200)]
Use stable URLs for files imported from Unicode
* admin/notes/unicode: Point people at "admin/unidata/README" for URLs
for Unicode files.
* admin/unidata/README: Use stable URLs for the various files. Remove
dates, the files self-describe their dates anyway.