Yuan Fu [Sat, 4 Jan 2025 05:39:32 +0000 (21:39 -0800)]
; Fix typo in treesit-explore-mode
* lisp/treesit.el (treesit-explore-mode): We added the hook to
kill-buffer-hook, so make sure to remove it from
kill-buffer-hook, not post-command-hook.
Stefan Monnier [Fri, 3 Jan 2025 18:24:26 +0000 (13:24 -0500)]
(mpc-cmd-find): Try and fix bug#41493
* lisp/mpc.el (mpc--proc-alist-to-alists): Don't presume that we
have either `directory` or `file` entries, instead allow both at
the same time.
(mpc-cmd-find) <Directory>: Don't presume that `directory`
entries have no associated data, so throw them away only after
having parsed them with `mpc--proc-alist-to-alists`.
On the latest update of the grammar expressions were added and won't be
seen as directives anymore.
* lisp/progmodes/heex-ts-mode.el
(heex-ts--sexp-regexp): Match on expression as well.
(heex-ts--indent-rules): Indent on expression end. (Bug#75191)
* test/lisp/progmodes/heex-ts-mode-resources/indent.erts: Add expression
indent test.
Stefan Kangas [Fri, 3 Jan 2025 06:50:07 +0000 (07:50 +0100)]
Improve temporary file handling in browse-url
* lisp/net/browse-url.el (browse-url-delete-temp-file): Don't add
to kill-buffer-hook on top level.
(browse-url--temp-file-setup): New macro to set 'kill-buffer-hook'
buffer-locally to above function when creating a temporary file. Use
stricter permissions to protect user privacy on multi-user systems.
(browse-url-of-file, browse-url-of-buffer): Use above new macro.
(browse-url-delete-temp-file): Simplify calling convention by removing
unused argument.
Stefan Kangas [Fri, 3 Jan 2025 03:08:44 +0000 (04:08 +0100)]
Remove gnudoit support from browse-url.el
* lisp/net/browse-url.el (browse-url-gnudoit-program)
(browse-url-gnudoit-args, browse-url-w3-gnudoit): Remove support
for gnudoit, obsolete since Emacs 25.1.
Stefan Monnier [Thu, 2 Jan 2025 19:58:10 +0000 (14:58 -0500)]
(describe-variable): Fix bug#73872
* lisp/help-fns.el (describe-variable): Put a `syntax-table` property
on the printed value for better navigation. Remove `set-syntax-table`
since `lisp-data-mode` already did it.
(describe-variable): Remove `set-syntax-table`, not needed any more.
* lisp/help-mode.el (help-mode-syntax-table): `;` shouldn't start a comment.
(help-make-xrefs): Use `with-syntax-table`.
Paul Eggert [Thu, 2 Jan 2025 19:29:26 +0000 (11:29 -0800)]
admin/merge-gnulib now warns if module lists change
From suggestions by Eli Zaretski and Stefan Kangas in:
https://lists.gnu.org/r/emacs-devel/2025-01/msg00036.html
https://lists.gnu.org/r/emacs-devel/2025-01/msg00037.html
* admin/merge-gnulib: For style consistency,
prefer ‘[ EXPR ]’ to ‘test EXPR’ and prefer -e to -f.
Fix bug that forgot to clean lib directory if it’s ./lib.
Check for lib/gnulib.mk.in, which we used directly, not ‘configure’.
(LC_ALL): Set to C.
(autogen): New function, to make it clearer to user when
commands are operating in some other directory.
(get_module_list): New function.
(old_modules, new_modules): New vars.
If they differ, issue a warning.
Roland Winkler [Thu, 2 Jan 2025 05:09:58 +0000 (23:09 -0600)]
Provide more flexibility for definition of BibTeX entries.
* lisp/textmodes/bibtex.el (bibtex-aux-opt-alist): Rename from
bibtex-user-optional-fields.
(bibtex-BibTeX-entry-alist, bibtex-biblatex-entry-alist): Permit
aliases that inherit their definition from another entry.
(bibtex-BibTeX-aux-entry-alist, bibtex-biblatex-aux-entry-alist)
(bibtex-BibTeX-aux-opt-alist, bibtex-biblatex-aux-opt-alist): New
user variables.
(bibtex-entry-alist): Honor these new variables.
(bibtex-field-alist): New function.
(bibtex-include-OPTkey): Default changed to nil, declared
obsolete. Use bibtex-aux-opt-alist instead.
(bibtex-set-dialect): Use cl-flet and bibtex-field-alist.
(bibtex-dialect-select-map): New variable.
(bibtex-init-dialect): New function.
(bibtex-field-list): Simplify.
(bibtex-print-help-message): Bug fix.
Alan Mackenzie [Tue, 31 Dec 2024 18:39:57 +0000 (18:39 +0000)]
CC Mode: Fix various minor indentation bugs
As part of this, introduce a second anchor point to the
syntactic symbols brace-list-intro and enum-intro, the position
of the opening brace.
* lisp/progmodes/cc-align.el
(c-lineup-item-after-paren-at-boi): New function.
* /lisp/progmodes/cc-engine.el
(c-foreign-truncate-lit-pos-cache)
(c-foreign-init-lit-pos-cache): Use
c-truncate-lit-pos/state-cache in place of an older function.
(c-no-bracelist-cache): Update its definition to exclude
conses.
(c-strip-conses): New function.
(c-inside-bracelist-p): Use c-strip-conses.
(c-add-stmt-syntax): In the "go out a block" loop, go out of a
brace at BOI when there's non-whitespace text after it.
Refactor an `if' form containing a cond form into a cond form.
Add the new second second anchor point into syntactic contexts
with brace-list-intro and enum-intro. Anchor brace-list-close
and enum-close elements on the individual declarations in
struct, etc., variable declarations.
(c-guess-basic-syntax, CASE 20): Use the new constraint-cont
syntactic symbol.
(c-guess-basic-syntax, CASE 9B): Anchor brace-list-close and
enum-close elements on the individual declarations in struct,
etc., variable declarations.
(c-guess-basic-syntax, CASEs 9C, 9D): Add the new second anchor
point into brace-list-intro and enum-intro syntactic contexts.
* lisp/progmodes/cc-mode.el (c-locate-first-punctuation-prop):
New function.
(c-depropertize-CPP): Use c-locate-first-punctuation-prop.
* lisp/progmodes/cc-vars.el (c-offsets-alist): Amend the
entries for constraint-cont, brace-list-intro, and enum-intro,
using c-lineup-item-after-paren-at-boi.
* doc/misc/cc-mode.texi (List Line-Up): Add a description of
c-lineup-item-after-paren-at-boi.
* lisp/treesit.el (treesit-forward-sexp-list): Rewrite to support
the value of ARG more than 1. In this case every step moves forward
either over the next treesit-based list or over the syntax-based symbol.
(treesit-down-list, treesit-up-list): Rewrite to support the fallback
to the syntax-based navigation while inside the treesit-based list.
Also use a loop for ARG more than 1 (bug#73404).
Juri Linkov [Mon, 30 Dec 2024 17:54:39 +0000 (19:54 +0200)]
* lisp/treesit.el (treesit-show-paren-data--categorize): Fix it.
Copy the implementation of treesit-parent-until here, and call
its treesit-node-match-p with the argument IGNORE-MISSING set to t
that causes it to fail silently instead of raising an error when
the predicate 'sexp-list' is not defined in an embedded language.
(treesit-major-mode-setup): Set show-paren-data-function to
treesit-show-paren-data only when 'sexp-list' thing is defined
that is used by treesit-show-paren-data--categorize (bug#75198).
Yuan Fu [Mon, 30 Dec 2024 08:21:55 +0000 (00:21 -0800)]
Make typescript-ts-mode work with latest grammar
* lisp/progmodes/typescript-ts-mode.el:
(tsx-ts-mode--font-lock-compatibility-bb1f97b): Return dummy
query when neither query works. In latest grammar, neither will
work, because typescript grammar doesn't include jsx grammar
anymore.
Yuan Fu [Mon, 30 Dec 2024 08:14:37 +0000 (00:14 -0800)]
Generate compatibility report for multiple Emacs versions
* admin/tree-sitter/compat-template.html: Update template.
* admin/tree-sitter/treesit-admin.el:
(treesit-admin--builtin-language-sources): Add sources.
(treesit-admin--builtin-modes): New variable.
(treesit-admin--verify-major-mode-queries): Don't need to pass
LANGS argument anymore.
(treesit-admin-verify-major-mode-queries): Move, and use
treesit-admin--builtin-modes.
(treesit-admin--mode-languages): Set some variables so it gets
all the languages.
(treesit-admin--find-latest-compatible-revision): Also return
commit timestamp.
(treesit-admin--generate-compatibility-report): New parameter
EMACS-EXECUTABLES. Support generating report for multiple Emacs
versions.
* lisp/treesit.el (treesit--language-git-timestamp): New function.
Yuan Fu [Sun, 29 Dec 2024 08:31:37 +0000 (00:31 -0800)]
Add treesit-admin-generate-compatibility-report
This function can generate a HTML report on latest compatible
grammar versions for each major mode.
* admin/tree-sitter/compat-template.html: Update.
* admin/tree-sitter/treesit-admin.el:
(treesit-admin--validate-mode-lang): Change so that emacs 30 can
also run it.
(treesit-admin--find-latest-compatible-revision): Support
running checks with a different Emacs executable.
(treesit-admin--generate-compatibility-report): New function.
This function computes the latest compatible grammar version for
each major mode.
* admin/treesit-admin.el (treesit-admin-file-name): Move.
(treesit-admin--compat-template-file-name): New variable.
(treesit-admin--mode-languages): New function.
(treesit-admin--find-latest-compatible-revision): Return a plist
instead.
(treesit-admin--last-compatible-grammar-for-modes): New function.
This function can find the last grammar revision that is
compatible with a major mode.
* admin/treesit-admin.el (treesit-admin-file-name): New
variable.
(treesit-admin--validate-mode-lang):
(treesit-admin--find-latest-compatible-revision): New functions.
Yuan Fu [Sat, 28 Dec 2024 22:54:17 +0000 (14:54 -0800)]
Refactor treesit-admin--verify-major-mode-queries
Make treesit-admin--verify-major-mode-queries use
treesit--install-language-grammar-1, rathre than the interactive
command treesit-install-language-grammar.
* admin/treesit-admin.el:
(treesit-admin--verify-major-mode-queries): Add parameter
SOURCE-ALIST. Use treesit--install-language-grammar-1.
(treesit-admin-verify-major-mode-queries): Pass
treesit-admin--builtin-language-sources to
treesit-admin--verify-major-mode-queries.
* lisp/treesit.el (treesit-install-language-grammar): Don't
return revision of the git repo.
Yuan Fu [Sat, 28 Dec 2024 22:41:55 +0000 (14:41 -0800)]
Refactor treesit--install-language-grammar-1
Separate treesit--install-language-grammar-1 into two functions,
one clones the repository, the other builds and installs the
grammar.
* lisp/treesit.el (treesit--install-language-grammar-1):
Refactor out treesit--build-grammar.
(treesit--build-grammar): New function.
(treesit--language-git-revision): Now takes REPO-DIR as an
argument.
Juri Linkov [Sun, 29 Dec 2024 18:08:11 +0000 (20:08 +0200)]
Treesit support for show-paren-mode (bug#75122)
* lisp/treesit.el (treesit-show-paren-data--categorize):
New internal function.
(treesit-show-paren-data): New function.
(treesit-major-mode-setup): Set 'show-paren-data-function' to
'treesit-show-paren-data'.
Juri Linkov [Sun, 29 Dec 2024 17:57:28 +0000 (19:57 +0200)]
Add new variable 'up-list-function' for 'treesit-up-list'
* lisp/emacs-lisp/lisp.el (up-list-function): New variable (bug#73404).
(up-list-default-function): New function.
(up-list): Split part to 'up-list-default-function'.
* lisp/treesit.el (treesit-up-list): New function.
(treesit-major-mode-setup): Set 'up-list-function' to
'treesit-up-list'.
Juri Linkov [Sun, 29 Dec 2024 17:51:18 +0000 (19:51 +0200)]
Add new variable 'down-list-function' for 'treesit-down-list'
* lisp/emacs-lisp/lisp.el (down-list-default-function): New function.
(down-list-function): New variable (bug#73404).
(down-list): Move meat to 'down-list-default-function',
and call 'down-list-function' when non-nil. Don't raise an error
in strings or comments when 'down-list-function' is non-nil.
* lisp/treesit.el (treesit--scan-error): New internal function.
(treesit-forward-sexp, treesit-forward-list): Use 'treesit--scan-error'.
(treesit-down-list): New function.
(treesit-major-mode-setup): Set 'down-list-function' to
'treesit-down-list'.
Juri Linkov [Sun, 29 Dec 2024 17:42:40 +0000 (19:42 +0200)]
Add new variable 'forward-list-function' for 'treesit-forward-list'
* lisp/emacs-lisp/lisp.el (forward-list-default-function): New function.
(forward-list-function): New variable (bug#73404).
(forward-list): Move meat to 'forward-list-default-function',
and call 'forward-list-function' when non-nil.
* lisp/treesit.el (treesit-forward-list): Rewrite to not rely on
'treesit-forward-sexp'.
(treesit-major-mode-setup): Set 'forward-list-function' to
'treesit-forward-list'.
Michael Albinus [Sun, 29 Dec 2024 11:26:05 +0000 (12:26 +0100)]
Some minor Tramp changes
* lisp/net/tramp-sh.el (tramp-sh-handle-process-file): Do proper quoting.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p):
Declare `tramp-suppress-trace' property.
(tramp-skeleton-make-symbolic-link): Drop volume letter when flushing.
* test/lisp/net/tramp-tests.el (tramp-test39-make-lock-file-name):
Adapt test.
(tramp-test42-utf8): Do not run expensive tests on MS Windows.
Make browser windows pop up when browsing URLs on Wayland
When a user invokes browse-url, the browser window viewing the URL
should be raised in the user's desktop environment. On X11, running
xdg-open as a subprocess does the job. However, on Wayland, this
approach doesn't work: xdg-open makes the web browser browse a URL all
right, but doesn't raise the browser window in the GUI. Therefore, if
the browser window is behind Emacs, browse-url appears to do nothing.
Repeated invocations of browse-url cause the browser to load multiple
tabs in the background, surprising the user when he gives up in
frustration and manually switches to the browser window.
There's no subprocess we can run to make the right thing happen.
Wayland requires that we pass along event activation information to the
browser using the xdg_activation_v1 protocol.
This change adds x-gtk-launch-uri to invoke GTK-native URL-dispatch
machinery. This machinery DTRT on both X11 and Wayland. We fall back
to the default browser machinery if we're not on a GTK frame.
The logic is more complicated than it has to be because the GTK URI
launch mechanism requires that we launch with respect to a specific GTK
window, and in some environments (e.g., running emacs -nw in a PGTK
Emacs) we don't have a GTK window. We also want to preserve the effect
of customizing browse-url-browser-function, so adding an entry to
browse-url-default-handlers that preempts URI open when we happen to be
on a GTK frame is the wrong thing to do.
* lisp/net/browse-url.el (browse-url--browser-defcustom-type):
(browse-url--inhibit-pgtk): avoid infinite recursion
(browse-url-default-browser): use pgtk launch
(x-gtk-launch-uri): new function
(browse-url-default-gtk-browser): ues it
* src/pgtkfns.c (unwind_gerror_ptr): new function
(Fx_gtk_launch_uri): new function
(syms_of_pgtkfns): register it
Alan Mackenzie [Sat, 28 Dec 2024 17:16:04 +0000 (17:16 +0000)]
CC Mode: Minor corrections and tidy ups for cache invalidation
These cache variables are c-lit-pos-cache-limit,
c-semi-near-cache-limit, c-full-near-cache-limit, and
c-state-cache-invalid-pos.
* lisp/progmodes/cc-awk.el
(c-awk-set-string-regexp-syntax-table-properties): Invalidate
the caches after changing the 'syntax-table property.
* lisp/progmodes/cc-defs.el (c-put-string-fence-trim-caches):
New macro.
(c-unmark-<-or->-as-paren): New name for c-unmark-<->-as-paren.
(Also renamed throughout CC Mode)
Alan Third [Fri, 27 Dec 2024 11:46:45 +0000 (11:46 +0000)]
Make image cache aware of image-scaling-factor (bug#74725)
* src/dispextern.h (struct image): Add scale so it can be compared in
search_image_cache.
* src/image.c (search_image_cache): Calculate the scale factor and
compare with the cached value.
(image_compute_scale): Compute the image's scale factor and optionally
store it in the image struct.
(compute_image_size): Move scale calculation code into
image_compute_scale and use it.
F. Jason Park [Tue, 24 Dec 2024 06:21:34 +0000 (22:21 -0800)]
Reuse process in erc-server-delayed-check-reconnect
* doc/misc/erc.texi (Integrations): Set `erc-server-reconnect-function'
to `erc-server-delayed-check-reconnect' in SOCKS example, and add
definition for `erc-open-socks-tls-stream'. Mention possible
inaccuracies related to error detection with certain reconnect
strategies.
* lisp/erc/erc-backend.el (erc-server--reconnect-opened): New function.
(erc-server-delayed-check-reconnect): Attempt to reuse process if server
sends a complete PONG, and attempt to accommodate connectors that set
:nowait to nil.
(erc--server-delayed-check-connectors): Remove variable.
(erc-server-prefer-check-reconnect): Inline what was the internal
variable `erc--server-delayed-check-connectors' because it's no longer
used in unit tests. Add `erc-open-socks-tls-stream' to the set of
connector functions thought to be compatible with the "check" reconnect
strategy.
* test/lisp/erc/erc-scenarios-base-auto-recon.el
(erc-scenarios-base-auto-recon-no-proto): Adapt to expect "reuse" behavior.
* test/lisp/erc/resources/base/reconnect/ping-pong.eld: Delete unused file.
* test/lisp/erc/resources/base/reconnect/unexpected-disconnect.eld:
Capture PING cookie to send back to client.
* test/lisp/erc/resources/erc-d/resources/proxy-solo.eld: Delete unused
file. (Bug#62044)
* lisp/emacs-lisp/package.el (package--download-and-read-archives):
Include the error info in the error message.
Suggested by Konstantin Kharlamov <Hi-Angel@yandex.ru>.
(package-refresh-contents, package-menu--perform-transaction):
Use `error-message-string`.
john muhl [Thu, 26 Dec 2024 00:03:50 +0000 (18:03 -0600)]
Fix comment indent in 'lua-ts-mode' and old grammar
* lisp/progmodes/lua-ts-mode.el (lua-ts--simple-indent-rules):
Improve multi-line comment indention for pre-0.0.19 grammars that
used a different structure for comment start/end markers.
(Bug#75107)
This patch fixes various problems preventing this script from
working. The job of this script is to collect Emacs' dependanicies and
the (MSYS2/MinGW64) source archives for dependancies (including 2nd
etc. order dependancies) into zip archives. GPL requires distributing such
archives (along with Emacs' own sources) when distributing GPL binaries.
Most principle of the changes is support for MSYS2 "w64" source archives
in zst format; previously this script assumed all sources were available
as tar.gz files. Additionaly several DLLs are added to list of
required, including sqllite3 and tree-sitter.
In general this is a maintaince fix to ensure others have access to the
code used to create pretest (and, presumably release) version of Emacs
30. Additional changes are required to progmatically identify changes
in Emacs' dependancies (e.g. after building a new Emacs binary for
distribution). There is commented out code to this effect in the
changes I've installed which did work, for a brief period in time; I
suspect some changes in MSYS2 made it more difficult (or impossible?) to
invoke the MSYS2 shell (under which this python script must run) from
the MINGW64 (under which Emacs is built). I may resort to a powershell
script as a way to orchistrate/invoke both MSYS2 and MING64 but I'm
currently still messing with a Makefile based approach (which would run
under MINGW64), in any event I believe we're all agreed this script
must interigate Emacs to create the "starting list" of dependancies to
include as a way to resolve this issue (missing/incorrect deps are
frequent source of broken binary releases). (bug#65206)
Corwin Brust [Mon, 23 Dec 2024 05:08:08 +0000 (23:08 -0600)]
* admin/nt/dist-build/emacs.nsi: (Uninstall) delete only one Emacs
Previously, the uninstaller would recursively, unconditionally, remove
the parent folder in which Emacs was installed (the folder selected by
when running the installer), into which the installer places a folder
named for the given release (e.g. emacs-30.1). This was a problem
during uinstalation when the selected folder contained other versions of
Emacs the user did not wish to remove. Additionally, deleting Start Menu
short-cuts did not work (bug#68756).
Some installer language now better reflects that users are not
required to "Accept" the GNU Public License in order to use (etc.)
Emacs (bug#67667).
Users selections related to where to create (or not create) Start Menu
shortcuts are no longer ignored. (bug#75013)
Emacs (as installed by the installer) can now be uninstalled via
Windows' Add/Remove Progrms Control Panel.
The uninstaller will now remove (empty) parent folders, both under
Program Files and (when creation of shortcuts is enabled) under the
select Start Menu location.
Paul Eggert [Thu, 26 Dec 2024 23:44:34 +0000 (15:44 -0800)]
Don’t include stdlib.h from conf_post.h
This is brittle, as evinced by the recent problem with lib/stdlib.c.
* src/conf_post.h: Move potential inclusion of stdlib.h and
redefinitions of malloc, free, realloc, aligned_alloc, and calloc
from here ...
* src/lisp.h: ... to here. Do not redefine the symbols
if UNEXMACOS_C is defined.
* src/unexmacosx.c: Do not undef malloc, realloc, free.
(UNEXMACOS_C): New symbol, to prevent lisp.h from defining them.