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'.
Juri Linkov [Thu, 17 Apr 2025 17:21:16 +0000 (20:21 +0300)]
* lisp/treesit.el (treesit-parsers-at): Fix for 'with-host' arg.
Don't add the primary parser or the first of treesit-parser-list
when non-nil 'with-host' is provided since there is no host
for the primary parser (bug#76788).
* doc/misc/modus-themes.org: Update the manual to document how
'modus-themes-list-colors' has changed. Make other minor changes.
* etc/themes/modus-operandi-deuteranopia-theme.el:
* etc/themes/modus-operandi-theme.el:
* etc/themes/modus-operandi-tinted-theme.el:
* etc/themes/modus-operandi-tritanopia-theme.el:
* etc/themes/modus-vivendi-deuteranopia-theme.el:
* etc/themes/modus-vivendi-theme.el:
* etc/themes/modus-vivendi-tinted-theme.el:
* etc/themes/modus-vivendi-tritanopia-theme.el: Make stylistic refinements.
* etc/themes/modus-themes.el: Make refinements to supported
faces, add support for more faces, and the like.
Juri Linkov [Thu, 17 Apr 2025 06:49:04 +0000 (09:49 +0300)]
Use the first parser from 'treesit-parser-list' to fix tests.
* lisp/treesit.el (treesit-parsers-at): Add treesit-primary-parser
only when it's non-nil. When the result list is still empty,
add the first parser from 'treesit-parser-list'.
https://lists.gnu.org/archive/html/emacs-devel/2025-04/msg00627.html
* test/src/treesit-tests.el (treesit-node-supplemental)
(treesit-node-at, treesit-node-check)
(treesit-search-subtree-forward-1)
(treesit-search-subtree-backward-1): Wrap test body in 'with-temp-buffer'.
Yuan Fu [Thu, 17 Apr 2025 05:50:56 +0000 (22:50 -0700)]
Remove treesit.el dependency from prog-mode.el
prog-mode.el doens't need treesit.el dependency. And it
shouldn't depend on it. In principle, treesit.el should
integrate into various parts of Emacs through standard hooks and
variables.
* lisp/progmodes/prog-mode.el:
(prog-fill-reindent-defun): Remove treesit.el functions. Use
generic functions to check whether the current line has
comments, and make the test more comprehensive.
Yuan Fu [Wed, 16 Apr 2025 00:28:32 +0000 (17:28 -0700)]
Fix c-ts-common--fill-paragraph for non-rust modes (bug#77727)
* lisp/progmodes/c-ts-common.el:
(c-ts-common--comment-regexp): Add // and /* to regexp for Rust.
(c-ts-common--line-comment-p): Extract out into new function,
add a check that the parent node is a comment node.
(c-ts-common--fill-paragraph): Extract some code out.
Stefan Monnier [Thu, 17 Apr 2025 04:03:43 +0000 (00:03 -0400)]
(eieio-backward-compatibility): Set to `warn` (bug#77612)
* lisp/emacs-lisp/eieio-base.el (make-instance) <eieio-named>:
Really skip backward compatibility when `eieio-backward-compatibility`
is nil and emit message if it's `warn`.
(eieio-persistent-make-instance): Warn when an obsolete name is used.
* lisp/emacs-lisp/eieio-core.el (eieio-backward-compatibility):
Change default to `warn`.
(eieio-defclass-internal): Warn when the *-list-p function is called
(eieio--slot-name-index): Warn when a initarg is used to access a slot.
* lisp/emacs-lisp/eieio.el (defclass): Warn when a class-slot is
accessed via the obsolete method.
(make-instance, clone) <eieio-default-superclass>: Really skip backward
compatibility when `eieio-backward-compatibility` is nil and emit
message if it's `warn`.
Po Lu [Thu, 17 Apr 2025 01:33:06 +0000 (09:33 +0800)]
Prevent unrelocated symbols with position from being dumped
* src/pdumper.c (dump_builtin_symbol_p): Test BARE_SYMBOL_P
\(object) rather than SYMBOLP to avoid depending on the value of
symbols_with_pos_enabled or depositing non-relocated references
to vectorlikes in the dump file. Clarify commentary.
F. Jason Park [Wed, 9 Apr 2025 06:17:21 +0000 (23:17 -0700)]
Don't round-trip auto-reconnect probe in ERC
* lisp/erc/erc-backend.el (erc-server--reconnect-opened)
(erc--server-reconnect-opened): Rename former to latter. Restore
original buffer-local value of session connector for Emacs 29 and below.
(erc--server-reconnect-timeout-check)
(erc--server-reconnect-timeout-scale-function): Change from buffer-local
to normal variables, which they should have been originally.
(erc--recon-probe-reschedule): Ensure `erc-server-reconnect-timeout' is
always non-nil to avoid seeing format specifier in admin message. Use
current buffer when `proc' argument is nil. Perform cleanup when `proc'
and `erc-server-process' differ.
(erc-server-delayed-check-reconnect-reuse-process-p): New variable.
(erc--recon-probe-sentinel): Run `erc--server-reconnect-opened'
immediately because sending a speculative PING doesn't work on all
servers and proxies, most crucially on ZNC, which replies with an error
only after an extended timeout.
(erc--recon-probe-filter): Remove unused function.
(erc--recon-probe-check) Rework to not use fixed periodic timer, change
second parameter to a Lisp time object.
(erc-server-delayed-check-reconnect): Use realistic name when reusing
process so that the session's process isn't "*erc-connectivity-check*".
Set filter to `ignore'. Always run `erc--recon-probe-sentinel' when
status is `open' or something other than `connect', but don't bother
spawning a `erc--recon-probe-check' task as well because any problems
creating the process should already be known. Handle quits during
connect functions that perform blocking I/O, such as
`socks-open-network-stream'.
(erc-schedule-reconnect): Don't bother setting filter to nil.
* test/lisp/erc/erc-scenarios-base-auto-recon.el
(erc-scenarios-base-auto-recon-unavailable)
(erc-scenarios-base-auto-recon-check/no-reuse): Rename former to latter.
(erc-scenarios-base-auto-recon-no-proto)
(erc-scenarios-base-auto-recon-check/reuse): Rename former to latter and
rewrite not to expect a PING.
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--forget-process): New
function.
(erc-d--process-sentinel): Stop serving when all dialogs have been
exhausted. (Bug#62044)
João Távora [Wed, 16 Apr 2025 23:31:07 +0000 (00:31 +0100)]
Eglot: be aware of LSP version of contextual diagnostics
In certain situations, Eglot has to report to the server parts
of the diagnostics that it itself sent us. The server may use
this as context to compute code actions, for example. Eglot
selects diagnostics by asking Flymake, looking for the ones that
contain Eglot-specific cookies.
But when doing so, it is important to also be aware of the LSP
document version these each of these diagnostics pertain to,
since if a diagonstic in the buffer pertains to an older version
of the LSP document (because Flymake fired or the server hasn't
pushed a new set), that diagnostics 'eglot-lsp-data' cookie is
invalid and possibly harmful.
An example is when a diagnostic extends all the way to the end
of the buffer. If we attempt to fix by shortening the buffer,
an Eldoc-started code actions request may be sent to the server
considering the soon-to-be-deleted Flymake diagnostic as
context. But that diagnostic's 'eglot-lsp-data' cookie is no
longer valid and when processing that context we try to go past
point-max and burp an annoying error.
Best to check the version of the diagnostic (if we have it) and
ignore the ones that don't match the document version.
* lisp/progmodes/eglot.el (eglot--versioned-identifier): Move up.
(eglot--flymake-diagnostics, eglot--diag-to-lsp-diag): New helpers.
(eglot-handle-notification): Record LSP doc version in diagnostics.
(eglot--code-action-bounds)
(eglot--code-action-params): Use eglot--flymake-diagnostics.
Juri Linkov [Wed, 16 Apr 2025 18:45:40 +0000 (21:45 +0300)]
* lisp/textmodes/markdown-ts-mode.el: More ts-modes for code blocks.
(markdown-ts--code-block-language-map): Add more aliases.
(markdown-ts-code-block-source-mode-map): Add more mappings
for existing core ts-modes.
(markdown-ts--convert-code-block-language):
Check 'lang-string' with 'symbolp'. Check 'mode' with 'fboundp'.
Juri Linkov [Wed, 16 Apr 2025 17:32:54 +0000 (20:32 +0300)]
Change the default navigation sexp-type in 'elixir-ts-mode'.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode):
Call 'treesit-cycle-sexp-type' at the end to enable navigation across
nodes defined by the tree-sitter thing 'sexp' by default (bug#76788).
Juri Linkov [Wed, 16 Apr 2025 17:11:34 +0000 (20:11 +0300)]
New hook 'outline-after-change-functions' (bug#77256).
* lisp/outline.el (outline-after-change-functions): New variable.
(outline--fix-buttons-after-change):
Run hook 'outline-after-change-functions'.
* lisp/treesit.el (treesit--after-change): Improve docstring.
(treesit-major-mode-setup): Simplify to just add
'treesit--after-change' to 'outline-after-change-functions' hook.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode): Add explicit
'treesit-outline-predicate' that is like
'treesit-simple-imenu-settings', but also adds "trait_item".
* lisp/treesit.el (treesit-language-at-point-function):
Change the default value from nil to 'treesit-language-at-point-default'.
(treesit-language-at): Funcall 'treesit-language-at-point-function'
unconditionally.
(treesit-language-at-point-default): New function with body from
'treesit-language-at'.
(treesit-node-at): Simplify by replacing duplicate code
with the call to 'treesit-parsers-at'.
Stefan Monnier [Wed, 16 Apr 2025 14:15:16 +0000 (10:15 -0400)]
(Freplace_region_contents): Treat point as insert-before marker
Experience suggests that it's more often useful to keep point
at the end of the replacement than it is to keep point at the
beginning of the replacement.
This also aligns the behavior of `replace-region-contents` with
that of `insert`.
* src/insdel.c (replace_range): Treat PT like an insert-before marker.
* src/editfns.c (Freplace_region_contents): Adjust docstring accordingly.
Select the created frame because 'quit-window' unexpectedly
selects the original frame (https://debbugs.gnu.org/71386#262).
Add a comment about the `message' call bound to the original frame.
https://lists.gnu.org/archive/html/emacs-devel/2025-04/msg00546.html
Yuan Fu [Wed, 12 Mar 2025 03:37:43 +0000 (20:37 -0700)]
Expand markdown-ts-mode and add code block support for javascript
- Define new faces and use them in place of font-lock faces
- Add more fontification, add a new feature for headings.
- Remove fontification for code blocks, so embedeed parser can
fontify them
- Add experimental code block support for javascript by using
tree-sitter setup from js-ts-mode.
- Correctly setup markdown_inline with range settings.
* lisp/textmodes/markdown-ts-mode.el:
(markdown-ts--code-block-language-map):
(markdown-ts-code-block-source-mode-map): New variables.
(markdown-ts-faces): New group.
(markdown-ts-delimiter):
(markdown-ts-heading-1):
(markdown-ts-setext-heading):
(markdown-ts-heading-2):
(markdown-ts-heading-3):
(markdown-ts-heading-4):
(markdown-ts-heading-5):
(markdown-ts-heading-6):
(markdown-ts-list-marker):
(markdown-ts-block-quote):
(markdown-ts-language-keyword): New faces.
(markdown-ts--treesit-settings):
(markdown-ts--configured-languages): New variables.
(markdown-ts--harvest-treesit-configs):
(markdown-ts--add-config-for-mode):
(markdown-ts--convert-code-block-language): New functions.
(markdown-ts--range-settings): New variable.
(markdown-ts-setup): Setup range configuration.
(markdown-ts-mode): Add heading feature.
Jared Finder [Sat, 22 Feb 2025 22:25:37 +0000 (14:25 -0800)]
Show drag cursor on all window lines (mode, tab, header)
* lisp/ruler-mode.el (ruler-mode-map): Remove down-mouse-1
binding that conflicts with dragging header line.
* src/xdisp.c (note_mode_line_or_margin_highlight): Renamed
to...
(note_line_or_margin_highlight): ...new name since it applies to
any window line (mode, tab, header). Set drag cursor for window
top lines.
(note_mouse_highlight): Update call to new name (bug#76084).
* lisp/man.el (Man-start-calling): Declare as debuggable.
(Man-getpage-in-background): Call `Man-bgproc-sentinel' with a
cons (BUFFER . EXIT-STATUS) as PROCESS argument for synchronous calls.
(Man-bgproc-sentinel): Use that information to handle those more
similarly to asynchronous calls. Do not employ window selection hacks
for synchronous calls. (Bug#77755)
* exec/exec.c (struct exec_jump_command, exec_0): Don't define
or set `fpu_mode' if __LP64__.
* exec/exec.h (struct exec_tracee): New field `callno'.
* exec/trace.c (process_system_call): Always record the current
system call number in TRACEE lest it should be required once it
has been overwritten upon the syscall's completion.
(seccomp_system_call): Likewise.
(after_fork): Clear `tracee->callno'.
Eli Zaretskii [Tue, 15 Apr 2025 06:45:16 +0000 (09:45 +0300)]
; Fix tab-bar-tests on MS-Windows
* test/lisp/tab-bar-tests.el (tab-bar-tests-quit-restore-window):
Skip test on MS-Windows in batch mode, since terminal frames
cannot be created in that case.
Po Lu [Tue, 15 Apr 2025 03:14:14 +0000 (11:14 +0800)]
Address typos in MIPS executable loader
* exec/loader-mipsel.s (rest_of_exec): Delete redundant nop.
(skip_environ): Correct stack space test. Don't jump into
the label for the sp preserving case's delay slot.
The compile-time option XMALLOC_BLOCK_INPUT_CHECK was added in
2012 (commit 4d7e6e51dd4acecff) to allow blocking input during
malloc-family calls, in case any issues arose from related
changes in Emacs 24.3. However, it has not been referenced on
emacs-devel or the bug tracker in over a decade.
It is clear that we do not need it, as our signal handlers do not
allocate memory. Removing it simplifies the allocation function
wrappers and eliminates dead debug code.
Po Lu [Mon, 14 Apr 2025 13:28:15 +0000 (21:28 +0800)]
Port recent changes to mipsel systems
* exec/exec.c (exec_0): Don't disable AT_EXECFN substitution on
MIPS systems.
* exec/loader-aarch64.s (skip_environ): Correct typo in
commentary.
* exec/loader-mips64el.s: Add a disclaimer that this file is
currently inoperable.
* exec/loader-mipsel.s (__start): Move environment and argument
vectors and produce and replace AT_EXECFN. Clear stack before
proceeding to circumvent an oversight in glibc.