]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 months agolisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type): Fix corner case
Stefan Monnier [Wed, 14 May 2025 02:38:15 +0000 (22:38 -0400)]
lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type): Fix corner case

(cherry picked from commit 81cbff70f29c5138859b75b9a7369e0019c457b6)

2 months agolisp/emacs-lisp/cl-macs.el (cl--define-derived-type): Fix thinko
David Ponce [Wed, 14 May 2025 02:32:55 +0000 (22:32 -0400)]
lisp/emacs-lisp/cl-macs.el (cl--define-derived-type): Fix thinko

(cherry picked from commit b8f23179dacc7477f1c680fef38bb2bc70ac4fca)

2 months agoFix description of a remapped command's bindings
Eli Zaretskii [Tue, 13 May 2025 15:50:31 +0000 (18:50 +0300)]
Fix description of a remapped command's bindings

* lisp/help-fns.el (help-fns--key-bindings): Qualify the
description of any menu-bar bindings by remapping.  (Bug#78391)

(cherry picked from commit ebeeced9e3ca94bbb679730155a2582bc12f8ea7)

2 months agoEglot: Fix parsing file:// URIs on MS-Windows
Eli Zaretskii [Tue, 13 May 2025 11:45:04 +0000 (14:45 +0300)]
Eglot: Fix parsing file:// URIs on MS-Windows

* lisp/progmodes/eglot.el (eglot-uri-to-path): Remove the leading
slash in MS-Windows file names only if they begin with a slash.
This adjusts the function to the recent fix for bug#76982 in
'url-generic-parse-url', which previously would produce file names
that begin with an extra slash.  (Bug#78392)

(cherry picked from commit b3e280faba98d2ca7e4feef1017e3bebf53f036a)

2 months ago; Skip commit 4b4276d64f47fad6e485b6da8cf908204f167f61
Eshel Yaron [Wed, 14 May 2025 12:35:03 +0000 (14:35 +0200)]
; Skip commit 4b4276d64f47fad6e485b6da8cf908204f167f61

2 months ago; * src/buffer.c (Fgenerate_new_buffer_name): Fix typo.
Sean Whitton [Tue, 13 May 2025 09:13:26 +0000 (10:13 +0100)]
; * src/buffer.c (Fgenerate_new_buffer_name): Fix typo.

(cherry picked from commit e17001b2e181ae5f6d568573788e94f19e1cff0a)

2 months ago; * lisp/vc/diff-mode.el (diff-mode-shared-map): Document.
Sean Whitton [Tue, 13 May 2025 09:09:26 +0000 (10:09 +0100)]
; * lisp/vc/diff-mode.el (diff-mode-shared-map): Document.

(cherry picked from commit a8309895ae83a18dbdfe4afae49152e98bee1e6f)

2 months ago* test/README: Tests in *-tests/ directories are also performed.
Michael Albinus [Tue, 13 May 2025 07:48:31 +0000 (09:48 +0200)]
* test/README: Tests in *-tests/ directories are also performed.

(cherry picked from commit d1be1c91e0618da5129fcc5a8d42146277efac57)

2 months agohelp.el: Don't abuse `inhibit-modification-hooks`
Stefan Monnier [Mon, 12 May 2025 21:49:02 +0000 (17:49 -0400)]
help.el: Don't abuse `inhibit-modification-hooks`

* lisp/help.el (substitute-command-keys):
Set `inhibit-modification-hooks` locally so it doesn't affect
downstream function.
(help--window-setup): Don't let-bind `inhibit-modification-hooks`.
It was introduced accidentally in commit cd87a5c7a18e.

(cherry picked from commit 40559bf71cd5efdf4c88ab43bc7e55abf3a66c20)

2 months ago(hash-table-contains-p): Don't allocate memory (bug#78162)
Stefan Monnier [Mon, 12 May 2025 21:20:12 +0000 (17:20 -0400)]
(hash-table-contains-p): Don't allocate memory (bug#78162)

* lisp/subr.el (static-when): Remove spurious extra `progn` and improve
warning message's location info.
(hash-table-contains-p): Don't allocate memory (bug#78162).
Suggested by Daniel Mendler <mail@daniel-mendler.de>.

(cherry picked from commit 872658764823bb805796002c46c0e6e4456e65b7)

2 months agocomint.el: Cosmetic changes
Stefan Monnier [Mon, 12 May 2025 19:25:05 +0000 (15:25 -0400)]
comint.el: Cosmetic changes

* lisp/comint.el: Prefer #' to quote function names.
(comint-mode): Turn some of the `make-local-variable`s to `setq-local`
or `defval-local`.
(comint-osc-hyperlink): Delete bogus alias.
(comint-replace-by-expanded-history-before-point): Use `looking-at-p`.
(comint-history-isearch-wrap): Share a bit more code.

(cherry picked from commit 0c3cf0e16c1f28b1c50ecd5918af5802801e51b2)

2 months ago; Skip commit 396c8873f3bf992635fce12478313ce1e1d84017
Eshel Yaron [Mon, 12 May 2025 19:56:59 +0000 (21:56 +0200)]
; Skip commit 396c8873f3bf992635fce12478313ce1e1d84017

2 months ago* lisp/treesit.el (treesit--parser-overlay-offset): New variable.
Juri Linkov [Mon, 12 May 2025 18:23:03 +0000 (21:23 +0300)]
* lisp/treesit.el (treesit--parser-overlay-offset): New variable.

(treesit-parsers-at): Use it (bug#77906).
(treesit-forward-sexp, treesit--forward-list-with-default)
(treesit-up-list): Let-bind 'treesit--parser-overlay-offset'.

(cherry picked from commit 824e4868db312f0cd9e735cf13d54466c4af5934)

2 months ago; RefTeX: Describe activation with use-package
Arash Esbati [Mon, 12 May 2025 18:17:12 +0000 (20:17 +0200)]
; RefTeX: Describe activation with use-package

* doc/misc/reftex.texi (Installation): Add examples how to
activate RefTeX with use-package.
Fix markup.

(cherry picked from commit c53f53f11b0dbf4417bc8b478659f8ec33b182b4)

2 months agosimple.el (delete-trailing-whitespace-mode): New minor mode (bug#78264)
Stefan Monnier [Mon, 5 May 2025 15:55:29 +0000 (11:55 -0400)]
simple.el (delete-trailing-whitespace-mode): New minor mode (bug#78264)

Partly motivated by bug#78097.

* lisp/simple.el (delete-trailing-whitespace-if-possible): New function.
(delete-trailing-whitespace-mode): New minor mode.

* lisp/editorconfig.el (editorconfig-trim-whitespaces-mode):
Change default to `delete-trailing-whitespace-mode`.
(editorconfig--get-trailing-ws): Simplify accordingly.
(editorconfig--add-hook-safe-p): Delete function.  Don't touch
`safe-local-eval-function` any more.

(cherry picked from commit 8a19c249f813e9f3830308e40f0205d7665f78a3)

2 months agoRequire key and cert when searching for client cert
Jens Schmidt [Mon, 5 May 2025 11:47:17 +0000 (13:47 +0200)]
Require key and cert when searching for client cert

* lisp/net/network-stream.el (network-stream-certificate):
Require :key and :cert when searching auth sources for a client
certificate.  (Bug#78189)

(cherry picked from commit d11570d80ee18932ffb0ceed552313ada2879bcb)

2 months agoImprove handling of tests in *-tests subdirs
Michael Albinus [Mon, 12 May 2025 14:39:15 +0000 (16:39 +0200)]
Improve handling of tests in *-tests subdirs

* test/Makefile.in (subdir_template): Add rules for *-tests subdirs.

* test/infra/Makefile.in: Remove special handling of eieio, faceup
and so-long.  Add recipes for *-tests subdirs.  Filter out rules
for *-tests subdirs.

* test/infra/test-jobs.yml: Regenerate.

(cherry picked from commit b91efd401d68f22510856008ce79121b8b9bd199)

2 months agoFix filelock-tests on MS-Windows
Eli Zaretskii [Mon, 12 May 2025 12:08:20 +0000 (15:08 +0300)]
Fix filelock-tests on MS-Windows

* test/src/filelock-tests.el (filelock-tests-file-locked-p-spoiled)
(filelock-tests-unlock-spoiled)
(filelock-tests-kill-buffer-spoiled): Don't special-case
MS-Windows, as it was evidently fixed to signal the same error as
Posix systems.

(cherry picked from commit 8b67e566b9fe156b6be8be0a6381052fa79abc2c)

2 months agodiff-mode-shared-map: Don't inherit from special-mode-map
Sean Whitton [Mon, 12 May 2025 09:11:18 +0000 (10:11 +0100)]
diff-mode-shared-map: Don't inherit from special-mode-map

* lisp/vc/diff-mode.el (diff-mode-shared-map): No longer inherit
from special-mode-map.
(diff-mode-map): Tidy up list of unbindings now that we no
longer need to override any bindings from special-mode-map.
(minor-mode-map-alist): <diff-mode-read-only>: Ensure that the
minor mode keymap continues to inherit from special-mode-map by
calling make-composed-keymap here.

Co-authored-by: Stefan Monnier <monnier@iro.umontreal.ca>
(cherry picked from commit 4ddafede8d7bebdaa795279cc4c527e5fe425add)

2 months agoAvoid unnecessary calls to GetFileAttributes on MS-Windows
Eli Zaretskii [Sun, 11 May 2025 16:27:13 +0000 (19:27 +0300)]
Avoid unnecessary calls to GetFileAttributes on MS-Windows

* src/w32.c (access_attrs): New function, refactored from
'faccessat'.
(faccessat): Call 'access_attrs' early to determine whether the
file doesn't exist, and if so, avoid calling 'chase_symlinks'.
Also avoid calling 'chase_symlinks' if it is known that the file
cannot be a symlink, given its attributes.  (Bug#78341)

(cherry picked from commit 882c849034a909a62179c38ee01cc08572fa1a68)

2 months agoAdd test for file time-stamp granularity on MS-Windows
Eli Zaretskii [Sun, 11 May 2025 12:47:17 +0000 (15:47 +0300)]
Add test for file time-stamp granularity on MS-Windows

* test/src/fileio-tests.el
(fileio-tests-w32-time-stamp-granularity): New test.

(cherry picked from commit 7d84ffc2ded59a1d32b902cf7487a6486e0d9869)

2 months agoSupport sub-second file time-stamps on MS-Windows
Eli Zaretskii [Sun, 11 May 2025 10:33:24 +0000 (13:33 +0300)]
Support sub-second file time-stamps on MS-Windows

* nt/inc/sys/stat.h (struct stat): New members for nsec part of
file times.

* lib-src/ntlib.c (convert_time):
* src/w32.c (convert_time): Accept an additional argument
TIME_NSEC and set it to the sub-second part of time.  All callers
changed.

(cherry picked from commit 3975094f1d96680fe73232ca4216733904ebecd0)

2 months agoTweak .clangd to work with gcc-compiled Emacs (bug#78367)
João Távora [Sun, 11 May 2025 10:14:02 +0000 (11:14 +0100)]
Tweak .clangd to work with gcc-compiled Emacs (bug#78367)

A Gcc configuration of Emacs emits -fstrict-flex-arrays but
clangd doesn't understand that.  This causes spurious errors of
"unknown flag" that prevent analysis.  So tweak .clangd to the
nearest clang equivalent (which is very similar).

* .clangd (CompileFlags): Remove -fstrict-flex-arrays, add
-fstrict-flex-arrays=3.

(cherry picked from commit 9df2074a06fefa0b5bfe9714b45c383fa45d6650)

2 months agoEglot: fix call hierarchy navigation again (bug#78367, bug#78250)
João Távora [Sun, 11 May 2025 10:09:06 +0000 (11:09 +0100)]
Eglot: fix call hierarchy navigation again (bug#78367, bug#78250)

* lisp/progmodes/eglot.el (eglot--hierarchy-label): Fix again.

(cherry picked from commit c69c18b732c2b1cd772dc7e15c0ea3074a3492bc)

2 months agodiff-mode-map: Unhide some additional M-<foo>
Sean Whitton [Sun, 11 May 2025 10:12:53 +0000 (11:12 +0100)]
diff-mode-map: Unhide some additional M-<foo>

* lisp/vc/diff-mode.el (diff-mode-map): Don't inherit M-?,
M-SPC, M-DEL and M-S-SPC bindings through from special-mode-map.

(cherry picked from commit 5b73625714ff6357170d83bff8fafa8d4c6a47c4)

2 months agolisp/emacs-lisp/cl-macs.el (cl--define-derived-type): Fix partial bootstrap
Stefan Monnier [Sun, 11 May 2025 05:30:01 +0000 (01:30 -0400)]
lisp/emacs-lisp/cl-macs.el (cl--define-derived-type): Fix partial bootstrap

(cherry picked from commit dfafe1830f06634ec779fd62f7081d4cc4f6d3e7)

2 months agolisp/net/browse-url.el (browse-url-interactive-arg): Fix bug#78026
Stefan Monnier [Sat, 10 May 2025 16:05:17 +0000 (12:05 -0400)]
lisp/net/browse-url.el (browse-url-interactive-arg): Fix bug#78026

Don't burp when run from a timer where (this-command-keys) will
usually return an empty vector.

(cherry picked from commit 66990628b8f91554e05aa2bee9a657149ac0037c)

2 months ago; * src/callint.c (Fcall_interactively): Refine docstring.
Eshel Yaron [Mon, 12 May 2025 19:50:07 +0000 (21:50 +0200)]
; * src/callint.c (Fcall_interactively): Refine docstring.

2 months agosh-script.el: Improve consistency in variable-use fontification.
Jostein Kjønigsen [Wed, 30 Apr 2025 09:33:26 +0000 (11:33 +0200)]
sh-script.el: Improve consistency in variable-use fontification.

sh-mode--treesit-settings: Ensure all variable use is treated the
same way.
Before this patch the following commands would all be treated differently:

    echo "${var}"
    echo "$var"
    echo ${var}
    echo $var

Now they are treated the same.
* lisp/progmodes/sh-script.el (sh-mode--treesit-settings): Tweak
rules.  (Bug#78167)

(cherry picked from commit 7265be09cebc9ee752b688b7a85fb1ac18b45ef5)

2 months agoFix indentation of XML comments
Eli Zaretskii [Sat, 10 May 2025 10:11:22 +0000 (13:11 +0300)]
Fix indentation of XML comments

* lisp/nxml/nxml-mode.el (nxml-compute-indent-in-delimited-token):
Fix indentation in XML comments with empty lines.  Patch by John
Ciolfi <ciolfi@mathworks.com>.  (Bug#73206)

(cherry picked from commit 0d493864cee2ea1d7661d51b973db58667b6b65b)

2 months ago; Skip commit 013ed9799e68d83b478320b0a31180f8047d13b1
Eshel Yaron [Sat, 10 May 2025 14:04:40 +0000 (16:04 +0200)]
; Skip commit 013ed9799e68d83b478320b0a31180f8047d13b1

2 months agoImprove Tramp's make-process handling for Solaris
Michael Albinus [Sat, 10 May 2025 08:05:51 +0000 (10:05 +0200)]
Improve Tramp's make-process handling for Solaris

* lisp/net/tramp-sh.el (tramp-sh-handle-make-process):
Disable buffering also for remote Solaris hosts.
Reported by Stacey Marshall <stacey.marshall@gmail.com>.

(cherry picked from commit 1a2c29b5317357ba451fdd6f308675a1c6cbba2e)

2 months agoDocument 'time-stamp-time-zone' in Emacs Manual
Stephen Gildea [Thu, 8 May 2025 21:48:22 +0000 (14:48 -0700)]
Document 'time-stamp-time-zone' in Emacs Manual

* doc/emacs/files.texi (Time Stamp Customization): Document
time-stamp-time-zone.

(cherry picked from commit a7dffc2ea38583db39eaec5f21fd0d8fa5571ab4)

2 months agoMake treesit--simple-indent-eval more permissive (bug#78065)
Yuan Fu [Wed, 7 May 2025 03:57:06 +0000 (20:57 -0700)]
Make treesit--simple-indent-eval more permissive (bug#78065)

* lisp/treesit.el (treesit--simple-indent-eval): Allow EXP to be
anything, so higher-order indent presets can take anything as an
argument: t, nil, symbols, keywords, etc.

(cherry picked from commit 0b4eb525b69822c6b503982ef49980c72c8d0232)

2 months agoAdapt Tramp tests
Michael Albinus [Tue, 6 May 2025 10:22:45 +0000 (12:22 +0200)]
Adapt Tramp tests

* test/lisp/net/tramp-tests.el (tramp-test29-start-file-process)
(tramp-test30-make-process): Adapt tests.

(cherry picked from commit ed7b55f6bf1b8d0ceb40c9e196d8b31fd6afc21e)

2 months ago; * doc/lispref/tips.texi (Library Headers): Fix wording (bug#78253).
Eli Zaretskii [Mon, 5 May 2025 11:51:56 +0000 (14:51 +0300)]
; * doc/lispref/tips.texi (Library Headers): Fix wording (bug#78253).

(cherry picked from commit b172a1478c16067d88b3a79eed857f265cafb1b7)

2 months ago; * lisp/gnus/mail-source.el (mail-sources): Fix a typo (bug#78235).
Eli Zaretskii [Sun, 4 May 2025 06:47:49 +0000 (09:47 +0300)]
; * lisp/gnus/mail-source.el (mail-sources): Fix a typo (bug#78235).

(cherry picked from commit 81629b2b2ba282136bc5055bbaa0302321306e61)

2 months agoImprove flymake diagnostics list next-error support
Eshel Yaron [Sat, 10 May 2025 09:42:21 +0000 (11:42 +0200)]
Improve flymake diagnostics list next-error support

2 months ago; * doc/emacs/vc1-xtra.texi (General VC Options): Fix markup.
Sean Whitton [Fri, 9 May 2025 15:38:16 +0000 (16:38 +0100)]
; * doc/emacs/vc1-xtra.texi (General VC Options): Fix markup.

(cherry picked from commit 63f73de839b3142a3587ccb6edecc78d5232bced)

2 months agoix bugs when a SES buffer has named cells, and another don't.
Vincent Belaïche [Fri, 9 May 2025 12:30:50 +0000 (14:30 +0200)]
ix bugs when a SES buffer has named cells, and another don't.

* lisp/ses.el (ses-list-named-cells): Give a message when the list is empty.
(ses--unbind-cell-name): Do not throw error in a SES buffer w/o
any named cell for gethash from 'ses--named-cell-hashmap' being
'nil'.

(cherry picked from commit 2102554a486e457cf020a03b72276e532afc98ea)

2 months ago; Fix VC tests
Eli Zaretskii [Fri, 9 May 2025 11:43:03 +0000 (14:43 +0300)]
; Fix VC tests

* test/lisp/vc/vc-tests/vc-tests.el (vc-test-hg06-version-diff):
Skip on MS-Windows in batch mode.

* test/lisp/vc/vc-git-tests.el (vc-git-test--start-branch): More
portable command for showing the current branch ("--show-current"
is only available since Git 2.22).

(cherry picked from commit b87608c9c7fd3a7a2a2fb3803d6038fa888602c4)

2 months agoCreate new test/lisp/vc/vc-tests/ for vc.el tests
Sean Whitton [Fri, 9 May 2025 10:00:47 +0000 (11:00 +0100)]
Create new test/lisp/vc/vc-tests/ for vc.el tests

* test/lisp/vc/vc-tests.el: Move ...
* test/lisp/vc/vc-tests/vc-tests.el: ... to here.
* test/lisp/vc/vc-misc-tests.el: Move ...
* test/lisp/vc/vc-tests/vc-test-misc.el: ... to here.

(cherry picked from commit 295c38b03d065d00361ca07355b82bf279ebd6b1)

2 months agoNew vc-async-checkin user option
Sean Whitton [Sat, 5 Apr 2025 02:58:35 +0000 (10:58 +0800)]
New vc-async-checkin user option

* lisp/vc/vc.el (vc-async-checkin): New option.
(vc-checkin): Don't use with-vc-properties on or display
messages around asynchronous checkins.
* lisp/vc/vc-git.el (vc-git-checkin):
* lisp/vc/vc-hg.el (vc-hg-checkin, vc-hg-checkin-patch): Perform
an async checkin operation when vc-async-checkin is non-nil.
* doc/emacs/vc1-xtra.texi (General VC Options):
* etc/NEWS: Document the new option.

* lisp/vc/vc-dispatcher.el (vc-wait-for-process-before-save):
New function.
(vc-set-async-update): If the current buffer visits a file, call
vc-refresh-state.
* lisp/vc/vc-hg.el (vc-wait-for-process-before-save): Autoload.
(vc-hg--async-command, vc-hg--async-buffer, vc-hg--command-1):
New utilities, partially factored out of vc-hg-command.
(vc-hg-merge-branch): Use vc-hg--async-command, thereby newly
respecting vc-hg-global-switches.

(cherry picked from commit 8e02537d0be3cfdeaaf7764e2ef2db8b66de542a)

2 months agovc-exec-after: New PROC argument
Sean Whitton [Sat, 5 Apr 2025 02:58:35 +0000 (10:58 +0800)]
vc-exec-after: New PROC argument

* lisp/vc/vc-dispatcher.el (vc-exec-after): New PROC argument.
* lisp/vc/vc-hg.el (vc-exec-after): Update declaration.

(cherry picked from commit 3739b86f5af654ec0ae3e47a3662e19ea79d2b3c)

2 months agoFix infinite looping in 'next-frame' and associates (Bug#77985)
Martin Rudalics [Fri, 9 May 2025 07:36:00 +0000 (09:36 +0200)]
Fix infinite looping in 'next-frame' and associates (Bug#77985)

* src/frame.c (next_frame): Rewrite to avoid infinite looping if
FRAME itself does not qualify as candidate frame (Bug#77985).
(Fnext_frame, Fprevious_frame): Adjust do-strings.
* lisp/frame.el (other-frame): Adjust doc-string.
(frame-list-1): New function.
(make-frame-names-alist): Rewrite using 'frame-list-1' instead
of 'next-frame' (Bug#77985).
(delete-other-frames): Rewrite using 'frame-list' instead of
'next-frame'.
* doc/lispref/frames.texi (Finding All Frames): Minor
clarifications for 'frame-list' and 'next-frame'.

(cherry picked from commit 004187350238a05a5c7f818c9feb648c792fe9db)

2 months agoUpdate from Gnulib by running admin/merge-gnulib
Paul Eggert [Fri, 9 May 2025 01:54:14 +0000 (18:54 -0700)]
Update from Gnulib by running admin/merge-gnulib

(cherry picked from commit e929d6df772e19d29b6e396e3a3330d4c9d7fe21)

2 months agoEglot: fix navigation in eglot-hierarchy-mode (bug#78250)
João Távora [Thu, 8 May 2025 20:06:41 +0000 (21:06 +0100)]
Eglot: fix navigation in eglot-hierarchy-mode (bug#78250)

* lisp/progmodes/eglot.el (eglot--hierarchy-label):  Take PARENT-URI. Rework.
(eglot--hierarchy-2): Rework.

(cherry picked from commit 7617c7a6e417d25807537c58bbe9c05376bbcece)

2 months agoFlymake: tweak 'fancy' eol diagnostic display
João Távora [Thu, 8 May 2025 11:15:24 +0000 (12:15 +0100)]
Flymake: tweak 'fancy' eol diagnostic display

When calculating the face for boxdraw chars, protect against
diagnostics with an empty first line.  Also don't inherit from
:default, which seems to mess up the background color when using
hl-line-mode.

* lisp/progmodes/flymake.el (flymake--eol-draw-fancy): Tweak

(cherry picked from commit 64eb60bd91dbeed458d5a410e6dc9ab4e9e0a10e)

2 months agocl-types: Improve error messages
Stefan Monnier [Thu, 8 May 2025 21:11:05 +0000 (17:11 -0400)]
cl-types: Improve error messages

* lisp/emacs-lisp/cl-extra.el (cl--derived-type-generalizers):
Check that the type is valid and fully defined.

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) <derived-type>:
Don't delegate to another method just because the type is invalid.

* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Minor simplification, and improvement to an error message.

(cherry picked from commit ceba490da921399393200e704520d313eb1ac5c8)

2 months agolisp/bs.el (bs--goto-current-buffer): Fix thinko in last commit
Stefan Monnier [Thu, 8 May 2025 14:51:16 +0000 (10:51 -0400)]
lisp/bs.el (bs--goto-current-buffer): Fix thinko in last commit

(cherry picked from commit c522428b33c8a34b7309b6166f35255bc4f2447c)

2 months agoRecenter for the calendar (bug#78205)
Manuel Giraud [Thu, 1 May 2025 15:06:07 +0000 (17:06 +0200)]
Recenter for the calendar (bug#78205)

* lisp/calendar/cal-move.el (calendar-recenter-last-op): New
variable to track last recenter operation.
(calendar-recenter): New command to recenter the calendar.
* lisp/calendar/calendar.el (calendar-mode-map): Keybinding for
this command.
* doc/emacs/calendar.texi (Scroll Calendar): Document this
command.
* etc/NEWS: Announce this command.

(cherry picked from commit 0469f41ac2e8f78bfbf9500b335fa32195c0482e)

2 months agoUpdate from Gnulib by running admin/merge-gnulib
Paul Eggert [Thu, 8 May 2025 06:57:18 +0000 (23:57 -0700)]
Update from Gnulib by running admin/merge-gnulib

The following changes were made by hand,
so that admin/merge-gnulib could succeed
instead of failing because the diff didn’t match.
* admin/gnulib-patches/lib/getloadavg.c.diff:
Remove, as it is no longer needed now that recent
Gnulib has been merged.
* admin/merge-gnulib (GNULIB_TOOL_FLAGS):
Remove the --local-dir="$src"admin/gnulib-patches option,
as it is no longer needed either.

(cherry picked from commit c9c6abfa81c58b4a62f4fa5fcaad94b219f5d706)

2 months agocl-lib.el (cl-generic-generalizers): Fix partial bootstrap
Stefan Monnier [Thu, 8 May 2025 03:26:40 +0000 (23:26 -0400)]
cl-lib.el (cl-generic-generalizers): Fix partial bootstrap

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers): Tweak the
bootstrap hack to avoid a problem when dumping `bootstrap-emacs` when
`cl-lib.el` has already been compiled.

* lisp/emacs-lisp/cl-macs.el (list): Move out of `static-if` test.

(cherry picked from commit 322ed637b4c2fe826d41c5af3800b2f2e381bb0f)

2 months ago(cl-deftype): Precompute the predicate function
Stefan Monnier [Thu, 8 May 2025 03:17:41 +0000 (23:17 -0400)]
(cl-deftype): Precompute the predicate function

Always define a `cl-deftype-satisfies` predicate (if possible), so
we only need `cl-typep` to "interpret" a type specifier when we use
a compound type but never for the atomic types (e.g. never
in `cl-types-of`).

* lisp/emacs-lisp/cl-macs.el (cl-typep): Test `cl-deftype-satisfies` first.
Don't handle `real` here any more.
(base-char, character, command, keyword, natnum, real): Define with
`c-deftype`.
(cl-deftype): Precompute the predicate for the atomic derived type,
if applicable.

* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Add argument for the precomputed predicate function.

* lisp/emacs-lisp/cl-extra.el (cl-types-of): Use `cl-deftype-satisfies`
instead of `cl-type-p`.

(cherry picked from commit 777da8c3f9ea73077c00957d48d8e6b317b9657d)

2 months ago; * src/pdumper.c (dump_buffer): Update hash.
Yuan Fu [Wed, 7 May 2025 18:07:49 +0000 (11:07 -0700)]
; * src/pdumper.c (dump_buffer): Update hash.

(cherry picked from commit a918f9e640f0c652d2f908fda88ecb2905eb4c58)

2 months ago; RefTeX: Update author email
Jeremy Bryant [Wed, 16 Apr 2025 20:14:57 +0000 (21:14 +0100)]
; RefTeX: Update author email

Update Carsten's email across related reftex* files:
lisp/textmodes/reftex.el
lisp/textmodes/reftex-auc.el
lisp/textmodes/reftex-cite.el
lisp/textmodes/reftex-dcr.el
lisp/textmodes/reftex-global.el
lisp/textmodes/reftex-index.el
lisp/textmodes/reftex-parse.el
lisp/textmodes/reftex-ref.el
lisp/textmodes/reftex-sel.el
lisp/textmodes/reftex-toc.el
lisp/textmodes/reftex-vars.el
lisp/textmodes/reftex.el
(AUCTeX bug#77850)

(cherry picked from commit 0d96565d5df014d2b9454b1960dffb850feb6b7c)

2 months agoMark !%:.^~, as punctuation rather than symbol constituents
James Cherti [Fri, 11 Apr 2025 14:18:19 +0000 (10:18 -0400)]
Mark !%:.^~, as punctuation rather than symbol constituents

In Bash, the characters !%:.^~, are not valid in variable names. In sh,
they are not permitted in either function or variable names. Treating
them as punctuation is convenient, as they are rarely used in function
names and never in variable names. Even among commands, their usage is
uncommon. The only character among these that is commonly seen in
command names is '.', although it is rarely used in function names.

Marking these characters as punctuation, rather than symbol
constituents, enhances the accuracy of symbol detection.

* lisp/progmodes/sh-script.el: Mark !%:.^~, as punctuation in the
  sh-mode-syntax-table syntax table.

Copyright-paperwork-exempt: yes
(cherry picked from commit 4e1fe56e316c041ed3b07f510ecba428c6b06cd1)

2 months agoImprove support of UTF-8 encoded file names in ZIP archives
Eli Zaretskii [Wed, 7 May 2025 18:43:59 +0000 (21:43 +0300)]
Improve support of UTF-8 encoded file names in ZIP archives

* lisp/arc-mode.el (archive-zip-summarize): Support the 0x7075
UPath Unicode Path Extra Field extension of ZIP format.
(Bug#78290)

(cherry picked from commit 74e7e0f08abfe6b50ba7c2a153a989bf4910835e)

2 months ago; Skip commit 3089d822ffa7d0d5fcc1cd56b432ab80c1f6771f
Eshel Yaron [Sat, 10 May 2025 08:54:33 +0000 (10:54 +0200)]
; Skip commit 3089d822ffa7d0d5fcc1cd56b432ab80c1f6771f

2 months ago; Skip commit 839d29b81ffac1d809f76e182468f40e184cfe22
Eshel Yaron [Sat, 10 May 2025 08:54:29 +0000 (10:54 +0200)]
; Skip commit 839d29b81ffac1d809f76e182468f40e184cfe22

2 months ago(cl-deftype): Don't set `cl-deftype-handler` directly
Stefan Monnier [Wed, 7 May 2025 17:54:47 +0000 (13:54 -0400)]
(cl-deftype): Don't set `cl-deftype-handler` directly

In order to make it easier to change that in the future, let
`cl--define-derived-type` take care of storing the derived
type's function into `cl-deftype-handler`.

* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Change calling convention.  Set `cl-deftype-handler`.
* lisp/emacs-lisp/cl-macs.el (cl-deftype): Don't set `cl-deftype-handler`,
instead pass the function to `cl--define-derived-type`.

(cherry picked from commit 9f50fdf1e75040d7feaa1edb235377a33da94781)

2 months agolisp/emacs-lisp/cl-types.el: Delete file
Stefan Monnier [Wed, 7 May 2025 17:24:58 +0000 (13:24 -0400)]
lisp/emacs-lisp/cl-types.el: Delete file

(cherry picked from commit d7459da58de8bf317d7669f001c35244ba38d17b)

2 months agocl-types: The big renaming to "derived types"
Stefan Monnier [Wed, 7 May 2025 17:24:07 +0000 (13:24 -0400)]
cl-types: The big renaming to "derived types"

`cl-defstruct` also defines a type and is also in CL, so
"cl-type" is not precise enough to talk about those types
defined with `cl-deftype`.  Use the term "derived type" to be
more clear, as is done in the HyperSpec.

* doc/misc/cl.texi (Derived types): Move `cl-deftype` to this
new subsection.  Document the use of derived types as method specializers.

* lisp/emacs-lisp/cl-extra.el (cl--types-of-memo): Rename from
`cl--type-unique`.
(cl--derived-type-dispatch-list): Rename from `cl--type-dispatch-list`.
(cl--derived-type-generalizer): Rename from `cl--type-generalizer`.
(cl--derived-type-generalizers): Rename from `cl--type-generalizers`.

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) <derived-types>:
Rename from <cl-types-of>.  Catch but don't hide errors when a derived
type cannot be used as an atomic type specifier.

* lisp/emacs-lisp/cl-preloaded.el (cl--derived-type-list): Rename from
`cl--type-list`.
(cl-derived-type-class): Rename from `cl-type-class`.
(cl--derived-type-class-make): Rename from `cl--type-class-make`.
(cl--define-derived-type): Rename from `cl--type-deftype`.

(cherry picked from commit b13044dae3db9c449a93f52fecfd848a3e7dd67d)

2 months ago(cl-types-of): Fix two plain bugs
David Ponce [Wed, 7 May 2025 16:24:00 +0000 (12:24 -0400)]
(cl-types-of): Fix two plain bugs

* lisp/emacs-lisp/cl-extra.el (cl-types-of): Fix error handling.
Don't mutate `found` since it's stored as key in the hash-table.

(cherry picked from commit f6f35644b7f49732fe38fac3c199ef3a6a22abe7)

2 months ago; Skip commit 5fee8a04335c0699d6072a9d775df2b197ad7c41
Eshel Yaron [Sat, 10 May 2025 08:53:44 +0000 (10:53 +0200)]
; Skip commit 5fee8a04335c0699d6072a9d775df2b197ad7c41

2 months agoUpdate the default value of 'diff-outline-regexp'.
Juri Linkov [Wed, 7 May 2025 06:31:01 +0000 (09:31 +0300)]
Update the default value of 'diff-outline-regexp'.

* lisp/vc/diff-mode.el (diff-outline-regexp): Change the default value
to match the diff command name in recursive diff.  Move after
'diff-hunk-header-re' variable definition used in the new value.
(diff-setup-buffer-type): Change setq of 'diff-outline-regexp'
to buffer-local (bug#78269).

(cherry picked from commit 47b075e24b65b0c07ea3e887b9c6d46ba8fbaa78)

2 months agoDon't ignore errors in diff-syntax-fontify-hunk.
Juri Linkov [Wed, 7 May 2025 06:20:18 +0000 (09:20 +0300)]
Don't ignore errors in diff-syntax-fontify-hunk.

* lisp/nxml/nxml-mode.el (nxml-extend-region):
Protect against error "Invalid search bound (wrong side of point)".

* lisp/vc/diff-mode.el (diff-syntax-fontify-hunk):
Use 'with-demoted-errors' instead of 'ignore-errors'.

(cherry picked from commit ddc7bd547a2b422c4b8dca30076c0d9b70de09ad)

2 months ago(cl-generic-generalizers): Fix typo in last change
Stefan Monnier [Wed, 7 May 2025 03:04:46 +0000 (23:04 -0400)]
(cl-generic-generalizers): Fix typo in last change

(cherry picked from commit 2eb90d43e6e3b8325503d56c7778b9245b930d88)

2 months ago(cl-generic-generalizers): Skip types that need arguments
Stefan Monnier [Wed, 7 May 2025 02:53:01 +0000 (22:53 -0400)]
(cl-generic-generalizers): Skip types that need arguments

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) "cl-types-of":
make sure the atomic derived type is valid.

(cherry picked from commit 147113b3b5a89b401448424dd01c4ac915ea6081)

2 months agoFix compilation on Android 35 and on Termux
Po Lu [Tue, 6 May 2025 14:29:46 +0000 (22:29 +0800)]
Fix compilation on Android 35 and on Termux

* configure.ac (gl_cv_onwards_func_tzalloc): Define to "future
OS version" on Android API 35 and later.
Detect posix_spawn* by means of gl_CHECK_FUNCS_ANDROID.

* src/conf_post.h (tzalloc, tzfree): Define to non-conflicting
names on Android 35 and later.

(cherry picked from commit fa05cfd4455f2883d16992e5f1323a8945956987)

2 months ago; Skip commit 852d50ecfcfa505ca245be8d82123b27cc967f73
Eshel Yaron [Sat, 10 May 2025 08:53:21 +0000 (10:53 +0200)]
; Skip commit 852d50ecfcfa505ca245be8d82123b27cc967f73

2 months agocl-types: Integrate into CL-Lib
Stefan Monnier [Tue, 6 May 2025 03:18:56 +0000 (23:18 -0400)]
cl-types: Integrate into CL-Lib

* lisp/emacs-lisp/cl-extra.el (cl--type-unique, cl-types-of)
(cl--type-dispatch-list, cl--type-generalizer): Move to `cl-extra.el`.
(cl--type-generalizers): New function extracted from "cl-types-of"
method of `cl-generic-generalizers`.

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers): New method to
dispatch on derived types.  Use `cl--type-generalizers`.

* lisp/emacs-lisp/cl-macs.el (cl-deftype): Move from `cl-types.el`
and rename from `cl-deftype2`.
(extended-char): Tweak definition to fix bootstrapping issues.

* lisp/emacs-lisp/cl-preloaded.el (cl--type-list, cl-type-class)
(cl--type-deftype): Move from `cl-types.el`.

* lisp/emacs-lisp/oclosure.el (oclosure): Don't abuse `cl-deftype` to
register the predicate function.

* test/lisp/emacs-lisp/cl-extra-tests.el: Move tests from
`cl-type-tests.el`.

(cherry picked from commit fc4d8ce9514dd45ab34dbef6f023347b42ee9fef)

2 months agocl-types: Simplify a bit further
Stefan Monnier [Mon, 5 May 2025 18:57:05 +0000 (14:57 -0400)]
cl-types: Simplify a bit further

Mostly, get rid of `cl--type-flag` and rely only on the presence/absence
of the type on `cl--types-list` to "flag" erroring-types.
Also, don't try and catch errors during dispatch.

* lisp/emacs-lisp/cl-types.el (cl--type-dispatch-list): Move to the
relevant section.
(cl--type-parents): Inline into sole caller.
(cl--type-deftype): Add `arglist` argument.
Don't signal an error if the type already existed but wasn't in
`cl--type-list` since that's normal and we can fix it.
Don't touch `cl--type-flag` any more.
Don't add to `cl--type-list` if it can't be used without arguments.
(cl-deftype2): Adjust call accordingly.
(cl--type-error): Inline into sole caller.
(cl-types-of): Be more careful to preserve ordering of types
before passing them to `merge-ordered-lists`.
Add `types` argument for use by dispatch.
Don't bother skipping the `root-type` since that's a built-in type,
so it should never happen anyway.
Don't catch errors if called from dispatch.
Don't bother with `cl--type-flag`.
(cl--type-generalizer): Use new arg of `cl-types-of` instead of
let-binding `cl--type-list`, in case `cl-types-of` ends up (auto)loading
a file or some such thing which needs to use/modify `cl--type-list`.
(cl--type-undefine): Move to end of file.

* test/lisp/emacs-lisp/cl-types-tests.el (cl-types-test): Remove DAG
test since we don't detect such errors any more.
Relax ordering test when the order is not guaranteed
by parent-relationships.

(cherry picked from commit 68a50324a70bd794d7f3228290310093f1515f7b)

2 months ago(comment-setup-function): Make it usable with `add-function`
Stefan Monnier [Mon, 5 May 2025 18:05:36 +0000 (14:05 -0400)]
(comment-setup-function): Make it usable with `add-function`

* lisp/newcomment.el (comment-setup-function): Give it a non-nil default.
(comment-normalize-vars): Call it unconditionally.

(cherry picked from commit a64a56fbf03d5ece647254c8920fe5af59cdf3cd)

2 months agoNew variable 'comment-setup-function' for multi-language modes.
Juri Linkov [Mon, 5 May 2025 16:57:29 +0000 (19:57 +0300)]
New variable 'comment-setup-function' for multi-language modes.

* lisp/newcomment.el (comment-setup-function): New variable.
(comment-normalize-vars): Call non-nil 'comment-setup-function'.

* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--comment-current-lang): New internal variable.
(mhtml-ts-mode--comment-setup): New function.
(mhtml-ts-mode): Set 'comment-setup-function' to
'mhtml-ts-mode--comment-setup' instead of using
'c-ts-common-comment-setup' only for JavaScript.

https://lists.gnu.org/archive/html/emacs-devel/2025-05/msg00025.html
(cherry picked from commit 61cb73a2dbe756b060d4256c3b7ebe09f71ed2b7)

2 months ago* lisp/vc/diff-mode.el (diff-syntax-fontify-hunk): Add 'ignore-errors'.
Juri Linkov [Mon, 5 May 2025 16:52:28 +0000 (19:52 +0300)]
* lisp/vc/diff-mode.el (diff-syntax-fontify-hunk): Add 'ignore-errors'.

(cherry picked from commit e5746d3677b86ef3d0ba0d7f1e916180cc4b6f69)

2 months ago* lisp/outline.el (outline-minor-mode-highlight-buffer): Adjust match data.
Juri Linkov [Mon, 5 May 2025 16:50:24 +0000 (19:50 +0300)]
* lisp/outline.el (outline-minor-mode-highlight-buffer): Adjust match data.

After a successful call to 'outline-search-function'
set the end of the match data to the end of the line
that is equivalent to adding ".*" in the regexp.
This accompanies the recent change in 'outline-font-lock-keywords'.

(cherry picked from commit 6c3a995ed535f9fb492461a53442e4d8bd4deb17)

2 months agocl-types.el: Speed up deftype and dispatch
David Ponce [Mon, 5 May 2025 15:03:56 +0000 (11:03 -0400)]
cl-types.el: Speed up deftype and dispatch

* lisp/emacs-lisp/cl-types.el (cl--type-list): Doc string.
(cl--type-dispatch-list): New variable.
(cl--type-parents): Make it a plain defun.
(cl--type-children, cl--type-dag): Remove.
(cl--type-undefine): Remove duplicate test for `cl--type-p'.  Use
`cl--class-children'.  Clear `cl--type-flag' instead of
`cl--type-error'.  Also remove type from the dispatch list.
(cl--type-deftype): Doc string.  Remove useless safeguard of
data on error.  Fix some error messages.  Clear `cl--type-flag'
when a type is (re)defined.  Just push new types on
`cl--type-list'.
(cl--type-error): Set `cl--type-flag' to the symbol `error' and
remove type in error from the dispatch list.
(cl-types-of): Doc string.  Remove useless check for
`cl-type-class-p'.  Skip types which we are sure will not match.
Simplify creation of the DAG.
(cl--type-generalizer): In the tagcode-function, check only types
that can be dispatched.
(cl-generic-generalizers): Populate the dispatch list.

(cherry picked from commit 8f649c42702144dbbacba180c78ab0df04951807)

2 months ago; More fixes for treesit tests
Eli Zaretskii [Mon, 5 May 2025 12:16:43 +0000 (15:16 +0300)]
; More fixes for treesit tests

* test/src/treesit-tests.el (treesit-parse-string)
(treesit-parser-tracking-line-column-p)
(treesit-tracking-line-column-p, treesit--linecol-at)
(treesit--linecol-cache-set, treesit--linecol-cache)
(treesit-languages-require-line-column-tracking): Declare.

(cherry picked from commit cc6e604da6f274aafeda1476b2e1e2083063c20e)

2 months ago; Fix recently added treesit tests
Eli Zaretskii [Mon, 5 May 2025 12:07:28 +0000 (15:07 +0300)]
; Fix recently added treesit tests

* test/src/treesit-tests.el (treesit-linecol-basic)
(treesit-linecol-search-back-across-newline)
(treesit-linecol-col-same-line): Skip tests if tree-sitter is not
available.

(cherry picked from commit b84e306be765d5071577f81a12f9557e64732ecf)

2 months agoFix test-regressions in python-ts-mode
Jostein Kjønigsen [Mon, 5 May 2025 07:45:36 +0000 (09:45 +0200)]
Fix test-regressions in python-ts-mode

* lisp/progmodes/python.el (python--treesit-settings): Use more
specific selectors for constants.

* test/lisp/progmodes/python-tests.el
(python-ts-mode-nested-types-face-1)
(python-ts-mode-union-types-face-1)
(python-ts-mode-union-types-face-2): None is now a constant.

(cherry picked from commit 9261d353ccc0f94da8049faaade025f338d75354)

2 months agowhitespace.el: Collaborate better with `combine-after-change-calls`
Stefan Monnier [Mon, 5 May 2025 03:42:12 +0000 (23:42 -0400)]
whitespace.el: Collaborate better with `combine-after-change-calls`

* lisp/whitespace.el: Remove redundant `:group` arguments.
Prefer #' to quote function names.
(whitespace-buffer-changed): Delete function.
(whitespace-color-on): Don't touch `before-change-functions`.
(whitespace--update-bob-eob): Set `whitespace-buffer-changed` here, instead.
(whitespace-post-command-hook): Apply De Morgan.
(whitespace--empty-at-bob-matcher, whitespace-post-command-hook)
(whitespace--update-bob-eob): Use `point-min` and `point-max`.

(cherry picked from commit 7cb7e96a5cca6778054cf74fd2c7548ca40f0691)

2 months agoSynchronize Android and Haiku terminal frontends with X
Po Lu [Mon, 5 May 2025 00:51:42 +0000 (08:51 +0800)]
Synchronize Android and Haiku terminal frontends with X

* src/androidterm.c (handle_one_android_event):

* src/haikuterm.c (haiku_read_socket): Port recent changes to
handle_one_xevent.

(cherry picked from commit b97b3b057ca8128cb479f8d3893816d146cfef59)

2 months agoAvoid duplication in defining tree-sitter grammar sources.
Juri Linkov [Sun, 4 May 2025 17:50:40 +0000 (20:50 +0300)]
Avoid duplication in defining tree-sitter grammar sources.

* lisp/progmodes/php-ts-mode.el: Require 'html-ts-mode'.
(php-ts-mode--language-source-alist): Remove duplicate source info
for html, css, javascript, jsdoc.
(php-ts-mode-install-parsers): Install pre-defined grammars.
(php-ts-mode): Move 'require' to the top.

* lisp/textmodes/mhtml-ts-mode.el
(mhtml-ts-mode--language-source-alist): Remove variable
since 'treesit-language-source-alist' is pre-filled by
requiring 'html-ts-mode', 'css-mode', 'js'.
(mhtml-ts-mode-install-parsers): Install pre-defined grammars.

* test/infra/Dockerfile.emba: Remove 'mhtml-ts-mode'
that doesn't define own grammars.

(cherry picked from commit 815dea7b59392d83ca8f9e98d1569484aea605ad)

2 months ago* lisp/textmodes/markdown-ts-mode.el: Improve.
Juri Linkov [Sun, 4 May 2025 17:03:32 +0000 (20:03 +0300)]
* lisp/textmodes/markdown-ts-mode.el: Improve.

(markdown-ts-list-marker): Inherit from 'shadow' like in non-ts mode.
(markdown-ts-block-quote): Inherit from 'italic' like in non-ts mode.
(markdown-ts--treesit-settings): Use 'shadow' for parens in
'markdown-inline' only under 'inline_link' and 'image'.
Use @markdown-ts-block-quote for 'block_quote'.
Override with 'append' for links.
(markdown-ts--range-settings): Use global html parser for 'html_tag'
since its ranges are interconnected.
(markdown-ts-setup): Create the 'html' parser.

(cherry picked from commit 9e75d1815125178b4b8584faa02569d6b84fc0b5)

2 months agoEglot: allow other keys in window/logMessage (bug#77948)
João Távora [Sun, 4 May 2025 07:27:13 +0000 (08:27 +0100)]
Eglot: allow other keys in window/logMessage (bug#77948)

* lisp/progmodes/eglot.el (eglot-handle-notification window/logMessage): Fix.

(cherry picked from commit 660ebdddf6583e447b50f6574dca4ca8ff42ef60)

2 months agoFix support of 'mouse-highlight' on X (bug#78218)
Gerd Möllmann [Sun, 4 May 2025 06:17:27 +0000 (08:17 +0200)]
Fix support of 'mouse-highlight' on X (bug#78218)

* src/xterm.c (handle_one_xevent): Fix comparison with tool-bar
and tab-bar window.

(cherry picked from commit 6ccfc8977821d02e8d589c801e6cad2e74ab699b)

2 months agoAdd line-column tracking for tree-sitter
Yuan Fu [Wed, 19 Mar 2025 00:26:26 +0000 (17:26 -0700)]
Add line-column tracking for tree-sitter

Add line-column tracking for tree-sitter parsers.  Copied from
comments in treesit.c:

   Technically we had to send tree-sitter the line and column
   position of each edit.  But in practice we just send it dummy
   values, because tree-sitter doesn't use it for parsing and
   mostly just carries the line and column positions around and
   return it when e.g. reporting node positions[1].  This has
   been working fine until we encountered grammars that actually
   utilizes the line and column information for
   parsing (Haskell)[2].

   [1] https://github.com/tree-sitter/tree-sitter/issues/445
   [2] https://github.com/tree-sitter/tree-sitter/issues/4001

   So now we have to keep track of line and column positions and
   pass valid values to tree-sitter.  (It adds quite some
   complexity, but only linearly; one can ignore all the linecol
   stuff when trying to understand treesit code and then come
   back to it later.)  Eli convinced me to disable tracking by
   default, and only enable it for languages that needs it.  So
   the buffer starts out not tracking linecol.  And when a
   parser is created, if the language is in
   treesit-languages-require-line-column-tracking, we enable
   tracking in the buffer, and enable tracking for the parser.
   To simplify things, once a buffer starts tracking linecol, it
   never disables tracking, even if parsers that need tracking
   are all deleted; and for parsers, tracking is determined at
   creation time, if it starts out tracking/non-tracking, it
   stays that way, regardless of later changes to
   treesit-languages-require-line-column-tracking.

   To make calculating line/column positons fast, we store
   linecol caches for begv, point, and zv in the
   buffer (buf->ts_linecol_cache_xxx); and in the parser object,
   we store linecol cache for visible beg/end of that parser.

   In buffer editing functions, we need the linecol for
   start/old_end/new_end, those can be calculated by scanning
   newlines (treesit_linecol_of_pos) from the buffer point
   cache, which should be always near the point.  And we usually
   set the calculated linecol of new_end back to the buffer
   point cache.

   We also need to calculate linecol for the visible_beg/end for
   each parser, and linecol for the buffer's begv/zv, these
   positions are usually far from point, so we have caches for
   all of them (in either the parser object or the buffer).
   These positions are far from point, so it's inefficient to
   scan newlines from point to there to get up-to-date linecol
   for them; but in the same time, because they're far and
   outside the changed region, we can calculate their change in
   line and column number by simply counting how much newlines
   are added/removed in the changed
   region (compute_new_linecol_by_change).

* doc/lispref/parsing.texi (Using Parser): Mention line-column
tracking in manual.
* etc/NEWS: Add news.
* lisp/treesit.el:
(treesit-languages-need-line-column-tracking): New variable.
* src/buffer.c: Include treesit.h (for TREESIT_EMPTY_LINECOL).
(Fget_buffer_create):
(Fmake_indirect_buffer): Initialize new buffer fields.
(Fbuffer_swap_text): Add new buffer fields.
* src/buffer.h (ts_linecol): New struct.
(buffer): New buffer fields.
(BUF_TS_LINECOL_BEGV):
(BUF_TS_LINECOL_POINT):
(BUF_TS_LINECOL_ZV):
(SET_BUF_TS_LINECOL_BEGV):
(SET_BUF_TS_LINECOL_POINT):
(SET_BUF_TS_LINECOL_ZV): New inline functions.
* src/casefiddle.c (casify_region): Record linecol info.
* src/editfns.c (Fsubst_char_in_region):
(Ftranslate_region_internal):
(Ftranspose_regions): Record linecol info.
* src/insdel.c (insert_1_both):
(insert_from_string_1):
(insert_from_gap_1):
(insert_from_buffer):
(replace_range):
(del_range_2): Record linecol info.
* src/treesit.c (TREESIT_BOB_LINECOL):
(TREESIT_EMPTY_LINECOL):
(TREESIT_TS_POINT_1_0): New constants.
(treesit_debug_print_linecol):
(treesit_buf_tracks_linecol_p):
(restore_restriction_and_selective_display):
(treesit_count_lines):
(treesit_debug_validate_linecol):
(treesit_linecol_of_pos):
(treesit_make_ts_point):
(Ftreesit_tracking_line_column_p):
(Ftreesit_parser_tracking_line_column_p): New functions.
(treesit_tree_edit_1): Accept real TSPoint and pass to
tree-sitter.
(compute_new_linecol_by_change): New function.
(treesit_record_change_1): Rename from treesit_record_change,
handle linecol if tracking is enabled.
(treesit_linecol_maybe): New function.
(treesit_record_change): New wrapper around
treesit_record_change_1 that handles some boilerplate and sets
buffer state.
(treesit_sync_visible_region): Handle linecol if tracking is
enabled.
(make_treesit_parser): Setup parser's linecol cache if tracking
is enabled.
(Ftreesit_parser_create): Enable tracking if the parser's
language requires it.
(Ftreesit__linecol_at):
(Ftreesit__linecol_cache_set):
(Ftreesit__linecol_cache): New functions for debugging and
testing.
(syms_of_treesit): New variable
Vtreesit_languages_require_line_column_tracking.
* src/treesit.h (Lisp_TS_Parser): New fields.
(TREESIT_BOB_LINECOL):
(TREESIT_EMPTY_LINECOL): New constants.
* test/src/treesit-tests.el (treesit-linecol-basic):
(treesit-linecol-search-back-across-newline):
(treesit-linecol-col-same-line):
(treesit-linecol-enable-disable): New tests.
* src/lisp.h: Declare display_count_lines.
* src/xdisp.c (display_count_lines): Remove static keyword.

(cherry picked from commit 1897da0b599cc3ea1e4aa626e47ac8943a7b6833)

2 months agoFix support of 'mouse-highlight' on NS (bug#78218)
Gerd Möllmann [Sun, 4 May 2025 04:39:22 +0000 (06:39 +0200)]
Fix support of 'mouse-highlight' on NS (bug#78218)

* src/nsterm.m: ([EmacsView keyDown:]): Add missing '!' in
if-condition.  Check tab_bar_window as other window systems do.

(cherry picked from commit 159e3a981ed5482393182b036e38818d42405c90)

2 months ago; Skip commit f41ab0b425c7cfb2c337deb28ef2d7e4bd339394
Eshel Yaron [Sat, 10 May 2025 08:48:57 +0000 (10:48 +0200)]
; Skip commit f41ab0b425c7cfb2c337deb28ef2d7e4bd339394

2 months agoAvoid warnings about 'lexical-binding' in 'eval-buffer'
Eli Zaretskii [Sat, 3 May 2025 13:26:44 +0000 (16:26 +0300)]
Avoid warnings about 'lexical-binding' in 'eval-buffer'

* src/lread.c (Feval_buffer): Don't emit a lexbind warning if the
buffer already has a local value of 'lexical-binding'.  Doc fix.
(Bug#77883)

(cherry picked from commit 8a097aede53dfb8f595d79824c784c188b210093)

2 months agoFix quoted local file name parts in Tramp
Michael Albinus [Sat, 3 May 2025 13:00:18 +0000 (15:00 +0200)]
Fix quoted local file name parts in Tramp

* lisp/net/tramp.el (tramp-handle-directory-file-name):
* lisp/net/tramp-integration.el (tramp-rfn-eshadow-update-overlay):
Handle quoted local file name part.

(cherry picked from commit 28a276efe8744227e15a8077f6333974eda157bb)

2 months agoFix support of 'mouse-highlight' on MS-Windows console
Eli Zaretskii [Sat, 3 May 2025 11:07:27 +0000 (14:07 +0300)]
Fix support of 'mouse-highlight' on MS-Windows console

* src/w32inevt.c (w32_console_read_socket): Support numerical
value of 'mouse-highlight'.  (Bug#78218)

(cherry picked from commit c31f23016c6db449c646c12352e9207a19f5b70f)

2 months ago; * lisp/textmodes/markdown-ts-mode.el (treesit-node-child): Declare.
Eli Zaretskii [Sat, 3 May 2025 10:24:59 +0000 (13:24 +0300)]
; * lisp/textmodes/markdown-ts-mode.el (treesit-node-child): Declare.

(cherry picked from commit 790c475ec57b2f3c72f00be3ba186caee1538ebf)

2 months agoAdd `next-error' support for flymake diagnostics buffers
Matthew Tromp [Tue, 22 Apr 2025 19:27:58 +0000 (15:27 -0400)]
Add `next-error' support for flymake diagnostics buffers

This adds `next-error' support for flymake diagnostics buffers.
Buffers created with `flymake-show-buffer-diagnostics' and
`flymake-show-project-diagnostics' are now next-error enabled,
and `next-error' and `previous-error' will navigate through
their listed diagnostics.
* lisp/progmodes/flymake.el (flymake-current-diagnostic-line)
(flymake--diagnostics-next-error): Add.
(flymake-show-diagnostic, flymake-show-buffer-diagnostics)
(flymake-show-project-diagnostics): Set next-error-last-buffer.
(flymake--tabulated-setup): Set next-error-function.
(Bug#77809)

Copyright-paperwork-exempt: yes
(cherry picked from commit ee8b4eaca12af0ef6bf0d37780efaa558c25d45e)

2 months ago; * doc/misc/ert.texi (erts files): Improve indexing.
Eli Zaretskii [Sat, 3 May 2025 07:34:43 +0000 (10:34 +0300)]
; * doc/misc/ert.texi (erts files): Improve indexing.

(cherry picked from commit 1f998d11a585a9915cc6e8b67050dc1bb9191107)

2 months agoFix 'Skip' behavior in erts files (bug#76839)
Roi Martin [Thu, 6 Mar 2025 19:26:46 +0000 (20:26 +0100)]
Fix 'Skip' behavior in erts files (bug#76839)

* lisp/emacs-lisp/ert.el (ert-test--erts-test): Fix 'Skip'
behavior in erts files, so only the test case where it is
specified is skipped.
* test/lisp/emacs-lisp/ert-tests.el (ert-test-erts-skip-one)
(ert-test-erts-skip-last): Add test cases.

(cherry picked from commit d164116aa52b10bdfe8242dd1089406d4e557f32)

2 months agoImprove native--compile-skip-on-battery-p
Sean Whitton [Sat, 3 May 2025 02:32:42 +0000 (10:32 +0800)]
Improve native--compile-skip-on-battery-p

* lisp/emacs-lisp/comp-run.el
(native--compile-skip-on-battery-p): Look at %L, %b and %B
format characters.  Add commentary.

(cherry picked from commit f180e4c9cb676e771acdaed7b0fd76c1c83dd485)

2 months ago(decode_coding): Avoid nested *-change-functions (bug#78042)
Stefan Monnier [Fri, 2 May 2025 20:59:17 +0000 (16:59 -0400)]
(decode_coding): Avoid nested *-change-functions (bug#78042)

* src/coding.c (decode_coding): Avoid nested *-change-functions (bug#78042).

* test/src/editfns-tests.el (sanity-check-change-functions-before)
(sanity-check-change-functions-after): Record notifications in
`sanity-check-change-functions-op`.
(sanity-check-change-functions-with-op): Don't rely on
`sanity-check-change-functions-op` always holding only the `op`.
(sanity-check-change-functions-errors): Include the sequence of
notifications in the error info.
(editfns-tests--before/after-change-functions): Add tests for (bug#78042).

(cherry picked from commit 9048fcf22c3ec3b5cc77dbb98993a53f5f9b7cd5)

2 months ago; Skip commit 99ca41b6ef300653a0d15b73a0c0d446a9a9e059
Eshel Yaron [Sat, 10 May 2025 06:56:54 +0000 (08:56 +0200)]
; Skip commit 99ca41b6ef300653a0d15b73a0c0d446a9a9e059