Juri Linkov [Wed, 23 Apr 2025 17:17:46 +0000 (20:17 +0300)]
Add the keyword ':copy-queries' to 'treesit-language-source-alist'.
* lisp/treesit-x.el (define-treesit-generic-mode): Add keyword
':copy-queries t' to the end of 'source'.
* lisp/treesit.el (treesit-language-source-alist):
Document the keyword ':copy-queries'.
(treesit--install-language-grammar-1): Add &rest args.
Process the keyword args. Call 'treesit--copy-queries'
when :copy-queries is non-nil.
(treesit--copy-queries): Add arg 'source-dir'. Copy queries
from source-dir as well. Copy only the file "highlights.scm".
w32: change the way text is measured when using DirectWrite
Now the glyph outline is inspected directly to get its real size,
as the direct measuring functions give generic values for some
fonts.
* src/w32dwrite.c (data structures): Added data structures from
header files that are not present in the 32bit MinGW build
environment.
(text_extents_internal): Call GetGlyphRunOutline to get exact
glyph vertical bounds. Add new parameter to make this optional
if case that information is not required.
(w32_dwrite_text_extents, w32_initialize_direct_write)
(w32_dwrite_draw): New parameter for 'text_extents_internal'.
(Bug#77171)
Juri Linkov [Tue, 22 Apr 2025 16:48:30 +0000 (19:48 +0300)]
* lisp/treesit-x.el: Use 'treesit-ensure-installed'.
(define-treesit-generic-mode): Append new item
to 'treesit-language-source-alist' instead of prepending.
(treesit-generic-mode-setup): Remove 'source' arg.
Use 'treesit-ensure-installed'.
(liquid-generic-ts-mode): Use 'treesit-ensure-installed'.
(alpinejs-generic-ts-setup): Run setup hook.
(treesit-generic-mode-font-lock-map): Add more mappings.
Sean Whitton [Tue, 22 Apr 2025 12:45:34 +0000 (20:45 +0800)]
Delete unused block-comment-start and block-comment-end
* lisp/newcomment.el (block-comment-start)
(block-comment-end): Delete.
(comment-indent):
* lisp/cedet/semantic/doc.el
(semantic-doc-snarf-comment-for-tag):
Remove use of the now-deleted variables.
Sean Whitton [Tue, 22 Apr 2025 12:42:45 +0000 (20:42 +0800)]
Revert addition of electric-block-comment-mode & follow-up commits
As presently under discussion in bug#77823, the intended new
functionality is not really about comments at all.
Remove it for now to allow us to redesign from a clean slate,
and to deal with the regression reported in bug#77823.
This reverts the following three changesets:
Author: Elías Gabriel Pérez <eg642616@gmail.com>
AuthorDate: Mon Mar 17 12:56:52 2025 -0600
New minor mode: `electric-block-comment-mode'
Author: Elías Gabriel Pérez <eg642616@gmail.com>
AuthorDate: Mon Mar 31 17:58:16 2025 -0600
Add block-comment-start and block-comment-end to supported modes
Author: Elías Gabriel Pérez <eg642616@gmail.com>
AuthorDate: Sun Apr 13 12:26:08 2025 -0600
João Távora [Fri, 18 Apr 2025 18:43:45 +0000 (19:43 +0100)]
Flymake: new flymake-diagnostic-format-alist (bug#77439, bug#77480)
* lisp/progmodes/flymake.el (flymake-diagnostic-text): Overhaul.
(flymake-diagnostic-format-alist): New defcustom.
(flymake--diagnostic-format): New util.
(flymake--eol-overlay-summary)
(flymake--highlight-line)
(flymake-eldoc-function): Use flymake--diagnostic-format.
(flymake--tabulated-diagnostic-origin): New helper.
(flymake--tabulated-entries-1): Use flymake--tabulated-diagnostic-origin.
(flymake--diagnostics-base-tabulated-list-format): "Backend" -> "Origin"
* doc/misc/flymake.texi (Customizable variable): Mention new variable.
João Távora [Thu, 17 Apr 2025 21:00:39 +0000 (22:00 +0100)]
Flymake: more powerful flymake-make-diagnostic and rework manual
Flymake backends may now explicitly specify an origin and a code for a
diagnostic in addition to the textual description. This change lays
groundwork for richer diagnostic listings and user options for
summarizing diagnostics, addressing bug#77439 and bug#77480.
* doc/misc/flymake.texi (Flymake API): Rename from "Extending
Flymake". Rework.
(Inspecting diagnostics): New section.
* lisp/progmodes/flymake.el (flymake--diag): Add origin, code and
message. Remove text.
(flymake-make-diagnostic): Support new origin, code and message.
(flymake-diagnostic-text): Rework.
Michael Albinus [Sun, 20 Apr 2025 16:16:14 +0000 (18:16 +0200)]
Fix emerge.el for remote files
* lisp/vc/emerge.el (emerge-make-diff-list)
(emerge-make-diff3-list): Set proper `default-directory' in order
to support remote files. (Bug#6850, Bug#74352)
Fix indentation of "{" on a new line of a function declaration
* lisp/progmodes/js.el (js--treesit-switch-body-helper): New
anchor helper function for the switch_body.
(js--treesit-member-chained-expression-helper): New anchor
helper function for chained calls in member_expression.
(js--treesit-arrow-function-helper): New anchor helper
function for arrow_function.
(js--treesit-indent-rules): Fix rule for the indentation of
"{" when of a new line of a function declaration. (Bug#76704)
Fix the indentation of the parent of arrow_function, member_expression,
switch_body, ternary_expression and sequence_expression.
Paul Eggert [Sun, 20 Apr 2025 05:50:28 +0000 (22:50 -0700)]
Omit trailing white space in one line
* oldXMenu/Recomp.c: Omit trailing spaces in C source code line.
This was the only such line found by this command:
grep '[ ]$' $(git ls-files | grep '\.[chmy]$')
Paul Eggert [Sun, 20 Apr 2025 01:44:52 +0000 (18:44 -0700)]
Avoid name clashes with static GnuTLS
Work around a bug in GnuTLS 3.7.11 and earlier: when built
statically, its mistakenly exports symbols hash_lookup and
hash_string, which collide with Emacs symbols of the same name,
preventing temacs from linking statically. Problem reported by
Greg A. Woods (Bug#77476).
Because GnuTLS never uses hash_lookup or hash_string this issue
ordinarily doesn’t seem to prevent temacs from linking to GnuTLS
on GNU/Linux, as it’s linked dynamically and the dynamic linker
never needs to resolve references to either symbol. However, I
suppose a clash or bug could occur even with dynamic linking if
Emacs later loads a module that uses either symbol.
Although GnuTLS should be fixed, Emacs should link statically to
current and older GnuTLS versions in the meantime, and it should
avoid potential problems with dynamic linking. Renaming the two
clashing names is an easy way to do this. For consistency with
the new name for hash_lookup, also rename hash_lookup_with_hash
and hash_lookup_get_hash.
* src/fns.c (hash_find_with_hash): Rename from hash_lookup_with_hash.
(hash_find): Rename from hash_lookup.
(hash_find_get_hash): Rename from hash_lookup_get_hash.
(hash_char_array): Rename from hash_string.
All uses changed.
Paul Eggert [Sat, 19 Apr 2025 19:15:51 +0000 (12:15 -0700)]
Don’t use Gnulib’s locale-h module
* admin/merge-gnulib (AVOIDED_MODULES):
Add locale-h, as Emacs should’t need this Gnulib module.
This change is needed for when we next run admin/merge-gnulib,
as some Gnulib dependencies changed recently.
Werner Fink [Mon, 7 Apr 2025 11:51:07 +0000 (13:51 +0200)]
Fix seccomp-filter for newer Linux kernels
* lib-src/seccomp-filter.c (MAP_DROPPABLE): Define if undefined.
(main): Use MAP_DROPPABLE flag. Allow `tcgetattr' call of glibc
on physical terminal devices. (Bug#77232)
Peter Oliver [Wed, 2 Apr 2025 14:15:02 +0000 (15:15 +0100)]
Tweak AppStream metadata to satisfy `appstream-util validate'
* etc/emacs.metainfo.xml: `appstream-util validate' suggests that
screenshot height and width attributes should match the actual size of
the image, and that captions be no longer than 50 chars and do not end
in `.'. Follow those rules.
Peter Oliver [Wed, 2 Apr 2025 14:06:05 +0000 (15:06 +0100)]
Add AppStream metadata about supported and recommended hardware
* etc/emacs.metainfo.xml: Note that Emacs is best with a keyboard, but
other forms of input are possible. Also note that Emacs can access the
Internet. A modestly sized display is sufficient.
Stefan Kangas [Sat, 19 Apr 2025 08:35:59 +0000 (10:35 +0200)]
; Fix failing diff-mode tests
* test/lisp/vc/diff-mode-resources/git.patch: Delete file, moving
its contents to...
* test/lisp/vc/diff-mode-tests.el (diff-mode-tests--git-patch):
...this new variable. Git merges kept deleting a trailing
whitespace in the patch signature, so let's do this instead.
(diff-mode-test-git-patch)
(diff-mode-test-git-patch/before-first-hunk)
(diff-mode-test-git-patch/signature): Use above new variable.
Stefan Kangas [Sat, 19 Apr 2025 06:48:17 +0000 (08:48 +0200)]
xterm.c: Move GTK3-specific variables into narrower scopes
Avoid declaring GTK3-specific variables in larger-than-necessary scopes,
especially under #ifdefs. Instead, declare them where used. This improves
readability and reduces #ifdef clutter without changing behavior.
Don't align variable names to their declaratory expression.
Before this commit in code like:
const a = 1,
b = 2;
the b would get indented to `const'. Similarly for `var' and
`let'. The expected behavior instead is getting indented to
`typescript-ts-mode-indent-offset'.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Indent identifiers declarations to
`typescript-ts-mode-indent-offset'.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
(Lexical and variable declarations): Update test accordingly.
Juri Linkov [Fri, 18 Apr 2025 16:52:19 +0000 (19:52 +0300)]
Embed elixir in heex as well as elixir->heex->elixir (bug#76788).
* lisp/progmodes/elixir-ts-mode.el (elixir-ts--range-rules):
Rename to a shorter name from 'elixir-ts--treesit-range-rules'.
(elixir-ts--font-lock-feature-list, elixir-ts--thing-settings)
(elixir-ts--range-rules): New variables with default values
extracted from 'elixir-ts-mode'.
(elixir-ts-mode): Use 'elixir-ts--font-lock-feature-list',
'elixir-ts--thing-settings', 'elixir-ts--range-rules'
and 'heex-ts--range-rules'.
Use 'treesit-merge-font-lock-feature-list' to merge
'heex-ts--font-lock-feature-list'.
* lisp/progmodes/heex-ts-mode.el
(heex-ts--font-lock-feature-list, heex-ts--range-rules):
New variables.
(heex-ts-mode): Use 'heex-ts--font-lock-feature-list',
'heex-ts--range-rules'. Merge 'elixir-ts--font-lock-settings',
'elixir-ts--font-lock-feature-list', 'elixir-ts--thing-settings'
for embedding elixir in heex. Enable the 'sexp' navigation
by default with 'treesit-cycle-sexp-type'.
* lisp/progmodes/c-ts-mode.el (c-ts-mode): Append
'treesit-range-rules' to possibly already existing list in
'treesit-range-settings'.
* lisp/treesit.el (treesit-language-at-point-default):
Optimize to use 'when-let*'.
* lisp/progmodes/c-ts-mode.el:
Append language source to treesit-language-source-alist.
(c-ts-mode, c++-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/cmake-ts-mode.el:
Append language source to treesit-language-source-alist.
(cmake-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/csharp-mode.el:
Append language source to treesit-language-source-alist.
(csharp-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/dockerfile-ts-mode.el:
Append language source to treesit-language-source-alist.
(dockerfile-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/elixir-ts-mode.el:
Append language source to treesit-language-source-alist.
(elixir-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/go-ts-mode.el:
Append language source to treesit-language-source-alist.
(go-ts-mode, go-mod-ts-mode, go-work-ts-mode):
Use treesit-ensure-installed.
* lisp/progmodes/heex-ts-mode.el:
Append language source to treesit-language-source-alist.
(heex-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/java-ts-mode.el:
Append language source to treesit-language-source-alist.
(java-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/js.el:
Append language source to treesit-language-source-alist.
(js-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/json-ts-mode.el:
Append language source to treesit-language-source-alist.
(json-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/lua-ts-mode.el:
Append language source to treesit-language-source-alist.
(lua-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--language-source-alist):
Update versions from comments in ts-modes.
Append to treesit-language-source-alist.
(php-ts-mode-install-parsers):
Use treesit-language-source-alist directly.
(php-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/ruby-ts-mode.el:
Append language source to treesit-language-source-alist.
(ruby-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/rust-ts-mode.el:
Append language source to treesit-language-source-alist.
(rust-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/sh-script.el:
Append language source to treesit-language-source-alist.
(bash-ts-mode): Use treesit-ensure-installed.
* lisp/progmodes/typescript-ts-mode.el:
Append language source to treesit-language-source-alist.
(typescript-ts-mode, tsx-ts-mode): Use treesit-ensure-installed.
* lisp/textmodes/css-mode.el:
Append language source to treesit-language-source-alist.
(css-ts-mode): Use treesit-ensure-installed.
* lisp/textmodes/html-ts-mode.el:
Append language source to treesit-language-source-alist.
(html-ts-mode): Use treesit-ensure-installed.
* lisp/textmodes/markdown-ts-mode.el:
Append language source to treesit-language-source-alist.
(markdown-ts-mode): Use treesit-ensure-installed.
* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--language-source-alist):
Append to treesit-language-source-alist.
(mhtml-ts-mode-install-parsers):
Use treesit-language-source-alist directly.
(mhtml-ts-mode): Use treesit-ensure-installed.
* lisp/textmodes/toml-ts-mode.el:
Append language source to treesit-language-source-alist.
(toml-ts-mode): Use treesit-ensure-installed.
* lisp/textmodes/yaml-ts-mode.el:
Append language source to treesit-language-source-alist.
(yaml-ts-mode): Use treesit-ensure-installed.
* test/infra/Dockerfile.emba: Add verified versions
to treesit-language-source-alist.
Robert Pluim [Thu, 17 Apr 2025 14:08:53 +0000 (16:08 +0200)]
Match mail headers case-insensitively when encoding
* lisp/mail/rfc2047.el (rfc2047-encode-message-header): Bind
'case-fold-search' to t when looking up the encoding method,
otherwise a header spelled "CC" is encoded using the wrong
method. (Bug#77866)
Stefan Monnier [Fri, 18 Apr 2025 13:35:14 +0000 (09:35 -0400)]
(tab-bar-tests-quit-restore-window): Try and clarify the skip
* test/lisp/tab-bar-tests.el (tab-bar-tests-quit-restore-window):
Rewrite the `skip-unless` based on the code's history because
I found the current code quite confusing.
* lisp/calc/calc-trail.el (calc-trail-kill): Remove the check
preventing the removal of the first trail line, which is no
longer relevant since commit 8e1376a3912. (Bug#77816)
Yuan Fu [Thu, 17 Apr 2025 23:56:07 +0000 (16:56 -0700)]
Add guard in treesit-language-at-point-default (bug#77870)
* lisp/treesit.el (treesit-language-at-point-default): Return
nil if there's no parser in the buffer.
(treesit-parsers-at): Add docstring for parser order.
Juri Linkov [Thu, 17 Apr 2025 18:21:29 +0000 (21:21 +0300)]
Don't switch to another frame if window is not on the selected frame.
* lisp/window.el (window--quit-restore-select-window):
Add optional arg 'frame'. Don't switch to another frame
if window is not on the selected frame (bug#71386).
(quit-restore-window): Provide the 'frame' arg
to 'window--quit-restore-select-window' calls.
Patch by martin rudalics <rudalics@gmx.at>.
* test/lisp/tab-bar-tests.el (tab-bar-tests-quit-restore-window):
No need to reselect the frame after 'quit-window'.