1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-22 20:42:26 -08:00
Commit graph

180935 commits

Author SHA1 Message Date
Mattias Engdegård
45089f9588 * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Speed up.
Manicure pcase patterns to avoid performance-sapping internal functions
and switch-breaking gaps, resulting in smaller code and less allocation.
2026-01-22 10:56:59 +01:00
Michael Albinus
2696eff451 ; * test/lisp/net/dbus-tests.el: Fix typos. 2026-01-22 09:58:37 +01:00
Juri Linkov
a0197aef96 Restrict the 'buffer' arg of 'goto-line' only to interactive uses
* lisp/simple.el (goto-line): Use 'buffer' arg only when
'interactive' is non-nil (bug#80150).  Update docstring.
2026-01-22 09:37:14 +02:00
João Távora
f2250ba244 Eglot: simplify Imenu setup again
See https://github.com/joaotavora/eglot/issues/1569.

* lisp/progmodes/eglot.el (eglot--managed-mode): Tweak.

* etc/EGLOT-NEWS: Tweak.
2026-01-21 23:09:19 +00:00
João Távora
10b132006e Eglot: display more readable server-originated messages
* lisp/progmodes/eglot.el (eglot--format-server-message): New helper.
(eglot-handle-notification<window/showMessage>)
(eglot-handle-request<window/showMessageRequest>): Use it.
2026-01-21 23:08:39 +00:00
Juri Linkov
41c0d254d5 ; * lisp/textmodes/yaml-ts-mode.el: Fix docstring wider than 80 characters. 2026-01-21 20:08:14 +02:00
Juri Linkov
8063921808 Fix down-list navigation in python-ts-mode
* lisp/progmodes/python.el (python-ts-mode):
Set 'treesit-sexp-thing-down-list' to 'list' to override
sexp navigation with list navigation (bug#72478).

* lisp/emacs-lisp/lisp.el (up-list): Mention 'up-list-function' in docstring.
2026-01-21 20:02:56 +02:00
Vincenzo Pupillo
15d3cc3f65 Flymake support for yaml-ts-mode.
* etc/NEWS: Announce the new customization option (bug#80215).
* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): New customization group.
(yaml-ts-mode-yamllint-options): New customization option.
(yaml-ts-mode--flymake-process): New variable that stores the reference
to the flymake process.
(yaml-ts-mode-flymake): New function that implements support for Flymake.
2026-01-21 19:41:40 +02:00
Binbin Ye
8ea6f6da77 Add JSON path utility command to json-ts-mode
* lisp/progmodes/json-ts-mode.el (json-ts--get-path-at-node)
(json-ts--path-to-jq, json-ts--path-to-python): New functions.
(json-ts-jq-path-at-point): New command for getting JSON path at point.

* test/lisp/progmodes/json-ts-mode-tests.el: New file.
Add tests for the utility command.

* etc/NEWS: Announce new command 'json-ts-jq-path-at-point' (bug#80190).
2026-01-21 19:27:03 +02:00
Eli Zaretskii
d4dbce74a7 Fix updating buffer menu after invoking "M-x term"
The doc string of 'frame-or-buffer-changed-p' says not to call it
with the nil argument, but term.el did.  Since "M-x term" puts
'term--update-term-menu' on the 'menu-bar-update-hook' ahead of
'menu-bar-update-buffers', it caused the latter decide that there
was no change in buffers, because the internal state variable
used by 'frame-or-buffer-changed-p' when called with the nil
argument was reset by 'term--update-term-menu'.  Fix that by using
a non-nil state variable.
* lisp/term.el (term--buffers-changed): New variable.
(term--update-term-menu): Use it when calling
'frame-or-buffer-changed-p'.  (Bug#80231)
2026-01-21 17:37:33 +02:00
Mattias Engdegård
fe2469c1c1 ; * test/lisp/net/dbus-tests.el: hush warnings on no-dbus platforms 2026-01-21 16:22:05 +01:00
João Távora
9d8e1af6f4 Eglot: fix textDocument/prepareRename support
Can't send prepareRename requests willy-nilly.

See https://github.com/joaotavora/eglot/issues/1554.

* lisp/progmodes/eglot.el (eglot--rename-interactive): Fix.
(eglot-client-capabilities): Advertise "prepareSupport".

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
f643ad53c7 Eglot: set imenu-create-index-function without advice
See https://github.com/joaotavora/eglot/issues/1569.

* lisp/progmodes/eglot.el (eglot--managed-mode): Stomp on
imenu-create-index-function conditionally.
(eglot-imenu): Don't check eglot-server-capable here.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
d3548aea96 Eglot: limit the number of file watches
Some language servers request file watching for a very large number of
directories (e.g. Python virtualenvs), which can exhaust system
resources and cause slow startup.

https://github.com/joaotavora/eglot/issues/1568

* lisp/progmodes/eglot.el (eglot-max-file-watches): New variable.
(eglot--count-file-watches): New function.
(eglot--watch-globs): Use them to limit watches.  Signal jsonrpc-error
when limit is reached.
(eglot-watch-files-outside-project-root): Fix docstring punctuation.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
a3ea65a984 Eglot: support more complex workspace edits (create/rename/delete)
Advertise support for file resource operations in workspace edits.
Implement create, rename, and delete file operations.  Rework
confirmation UI to handle mixed operation types.

* lisp/progmodes/eglot.el (eglot--lsp-interface-alist): Add
CreateFile, RenameFile, DeleteFile interfaces.
(eglot-client-capabilities): Advertise resourceOperations and
failureHandling.
(eglot-handle-request<workspace/applyEdit>): Return failureReason.
(eglot--apply-text-edits): Tweak error message.
(eglot--propose-changes-as-diff): Adjust for new prepared format.
Return buffer.
(eglot--apply-workspace-edit): Rework.  Handle file operations.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
f02a120f18 Eglot: overhaul eglot-confirm-server-edits defcustom
Now also accepts file operation kinds as keys in the alist form.

* lisp/progmodes/eglot.el (eglot-confirm-server-edits): Rework
default value, docstring and defcustom type.
(eglot--confirm-server-edits): Also check for operation-kind-based
entries.
2026-01-21 12:26:24 +00:00
João Távora
b40e89e523 Eglot: default eglot-advertise-cancellation to t
The current 2026 landscape suggests servers (especially gopls
and ocamllsp) take advantage of this, so let's give it to them
by default.

* lisp/progmodes/eglot.el (eglot-advertise-cancellation):
Default to t.

* etc/EGLOT-NEWS: Mention change.
2026-01-21 12:26:24 +00:00
João Távora
155f524f03 Eglot: handle user quits when applying server-initiated edits
If the user simply C-g's signal a 'jsonrpc-error' with code 32000 to
mean "no error", provide an LSP :failureReason and keep server chill.

* lisp/progmodes/eglot.el (eglot-handle-request<workspace/applyEdit>>):
2026-01-21 12:26:24 +00:00
João Távora
7216d7ff87 Eglot: ensure no timeout on remote command executions
Else, if the server asks us a question, the user has just 10
seconds to ponder, which is a bit silly.

* lisp/progmodes/eglot.el (eglot-execute): Pass timeout=nil to
eglot--request.
2026-01-21 12:26:24 +00:00
João Távora
0917169782 Eglot: slightly friendlier UI for server window/showMessageRequest
Previously, the default answer pre-filled in the minibuffer was
obscuring the other possible answers.

* lisp/progmodes/eglot.el
(eglot-handle-request<window/showMessageRequest>): Rework.
2026-01-21 12:26:24 +00:00
João Távora
ff5bab9552 Eglot: advertise cancellation on eglot--request quits
* lisp/progmodes/eglot.el (eglot--request): Pass CANCEL-ON-QUIT
to jsonrpc-request.
2026-01-21 12:26:24 +00:00
João Távora
81b7e8e927 Eglot: fix async request cancellation
It was completely broken, with a cancel being set for every sent (and
probably already received) async request, and no actual discarding
of the response of a cancelled request.

* lisp/progmodes/eglot.el (eglot--async-request): Fix cancellation
of async requests.
(eglot--semtok-request): Don't need 'buf' &aux anymore.
2026-01-21 12:26:24 +00:00
João Távora
977e354709 Eglot: treat code=0 JSONRPC errors as benign
* lisp/progmodes/eglot.el (eglot--request): Shoosh code=0 errors.
(eglot-mode-line-error): Check for code=0.
2026-01-21 12:26:24 +00:00
João Távora
adb605716f Jsonrpc: don't let remote endpoint requests go unanswered
Previously, 'quit' could cause remote endpoints to never get a
reply and thus sometimes hang.  Ensure we always reply.  Also,
give the application a chance to signal jsonrpc-error with the
served code=32000, meaning "no error".

* doc/lispref/text.texi (JSONRPC Overview): Rework section on
request dispatchers.

* lisp/jsonrpc.el (jsonrpc-connection-receive): Rework.
2026-01-21 12:26:24 +00:00
João Távora
7ce09a741a Jsonrpc: allow control over jsonrpc-request quits
This allows clients such as Eglot to act on the user
C-g's/quits out of a blocking jsonrpc-request call.  It also
fixes the TIMEOUT=nil passed to jsonrpc-request.  An infinite
timeout in that case (for a long-running request, for example)
and it was not being transmitted to the lower
jsonrpc-async-request.

* lisp/jsonrpc.el (jsonrpc-request): Add CANCEL-ON-QUIT.  Rework
docstring.
2026-01-21 12:26:23 +00:00
Mattias Engdegård
b364c42a0e ; * doc/lispref/internals.texi (Garbage Collection): typo 2026-01-21 12:45:44 +01:00
Eli Zaretskii
ac8bc9a2e2 ; * src/alloc.c (Fgarbage_collect_heapsize): Avoid compiler warning. 2026-01-21 13:44:31 +02:00
Martin Rudalics
2d758e73eb Fix thinko in 'quit-restore-window'
* lisp/window.el (quit-restore-window): Try to restore the
previously selected window only if WINDOW is either the selected
window or BURY-OR-KILL is neither 'burying' nor 'killing'.
Otherwise, this might deliberately change the selected window,
for example, when 'kill-buffer-quit-windows' is non-nil and WINDOW
shows the buffer to kill.
2026-01-21 11:14:36 +01:00
Morgan Smith
0d448871be * doc/misc/dbus.texi (Inhibitor Locks): Fix path. 2026-01-21 09:24:52 +01:00
Elías Gabriel Pérez
ff64470139 hideshow: Use 'message' instead of 'user-error'. (Bug#80201)
Using 'user-error' in 'hs-minor-mode', prevents the major-mode
from initializing correctly when hideshow is not supported in
that mode, using 'message' instead fixes this.

* lisp/progmodes/hideshow.el (hs-minor-mode): Tweak.
2026-01-21 09:46:23 +02:00
Jared Finder
75dd442058 (xterm--init): Fix probem in async mode (bug#80163)
In async mode, the workaround for the old Terminal.app collides
with the binding we install for the primary DA.  Just drop it.

* lisp/term/xterm.el (xterm--init): Remove workaround for very old
macOS `Terminal.app`.
2026-01-20 22:46:31 -05:00
Stefan Monnier
4150c2e22e (garbage-collect-heapsize): New function
The info returned from `garbage-collect` is really handy to
track the evolution of the heap size, but sadly it's available only
at the cost of running a full GC, which has two big downsides:
it's slow, it affects what we're measuring, and it can't be used
in `post-gc-hook`.
So, this patch makes it available without running the GC.

* src/alloc.c (Fgarbage_collect_heapsize): New function, extracted from
`Fgarbage_collect`.
(Fgarbage_collect): Use it.
(syms_of_alloc): defsubr it.

* doc/lispref/internals.texi (Garbage Collection): Extract
documentation for it from that of `garbage-collect`.
2026-01-20 16:09:22 -05:00
Juri Linkov
9ba2f13176 * lisp/tab-bar.el (tab-bar-split-tab): New command.
(split-tab): Alias for 'tab-bar-split-tab'.
2026-01-20 19:32:16 +02:00
Daniel Mendler
2fc549f3b4 ; * lisp/net/browse-url.el (browse-url-with-browser-kind): Fix call. 2026-01-20 14:44:49 +00:00
Michael Albinus
a32ee5026b Extend Tramp traces
* lisp/net/tramp-message.el (tramp-debug-message):
Change selection for `trace-function-background'.
2026-01-20 12:31:51 +01:00
Michael Albinus
8f96f5ffb5 Tag Tramp tests as :expensive-test
* test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults)
(tramp-test10-write-region-file-precious-flag)
(tramp-test10-write-region-other-file-name-handler)
(tramp-test16-file-expand-wildcards)
(tramp-test17-dired-with-wildcards)
(tramp-test17-insert-directory-one-file)
(tramp-test33-environment-variables-and-port-numbers)
(tramp-test35-remote-path, tramp-test39-make-lock-file-name)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test43-file-system-info)
(tramp-test44-file-user-group-ids, tramp-test48-session-timeout)
(tramp-test49-external-backend-function)
(tramp-test50-recursive-load): Tag them as :expensive-test.  (Bug#80164)
2026-01-20 12:30:48 +01:00
Daniel Mendler
94051b2c9a Call browser functions via `browse-url'
This is in order to apply `browse-url-transform-alist'.

* lisp/net/browse-url.el (browse-url-with-browser-kind)
(browse-url-button-open, browse-url-button-open-url):
* lisp/net/shr.el (shr-browse-url):
* lisp/net/eww.el (eww-browse-with-external-browser):
* lisp/gnus/gnus-sum.el (gnus-summary-browse-url):
* lisp/emacs-lisp/package.el (package-browse-url): Let-bind
`browse-url-browser-function' and call `browse-url'.
2026-01-20 10:31:03 +00:00
Pranshu Sharma
95775d9338 Factor out calculation of window combination for 'split-frame'
* lisp/window-x.el (window--get-split-combination): New function.
(split-frame): Call it.
2026-01-20 09:26:55 +01:00
Paul Eggert
1ca5eda85e Don’t use C basename function
* src/pdumper.c (pdumper_set_emacs_execdir):
Don’t use basename; simply use the pointer we already have.
If we ever need a basename-like function in the future, we should
use Gnulib’s basename-lgpl module, as POSIX basename modifies its
argument string and is incompatible with glibc/Android basename; see
<https://www.gnu.org/software/gnulib/manual/html_node/basename.html>.
2026-01-19 12:49:16 -08:00
Paul Eggert
4a0919df7f Update from Gnulib by running admin/merge-gnulib 2026-01-19 12:49:16 -08:00
Paul Eggert
c0afab671c Omit -Wzero-as-null-pointer-constant
* configure.ac: If --enable-gcc-warnings, don’t use
-Wzero-as-null-pointer-constant, which is enabled by default with
bleeding-edge Gnulib (as there seems to be movement in this
direction in C2y).  Although -Wzero-as-null-pointer-constant is
useful, Emacs isn’t clean for it yet.
2026-01-19 12:49:15 -08:00
Paul Eggert
128bfa6d44 Merge Gnulib save-cwd.c changes
* lib/save-cwd.c: Propagate changes from Gnulib sibling.
This doesn’t affect behavior.
2026-01-19 12:49:15 -08:00
Juri Linkov
5eb9800c42 Allow non-interactive calls of 'goto-line' (bug#80150)
* lisp/simple.el (goto-line, goto-line-relative): Add new arg 'interactive'.
Remove 'declare' with 'interactive-only'.  Don't push the mark when called
non-interactively.
2026-01-19 20:39:27 +02:00
Juri Linkov
86c40dcc31 Don't fail in minibuffer--completions-visible for undefined reference buffer
* lisp/minibuffer.el (minibuffer--completions-visible):
Return 'window' even when 'completion-reference-buffer' is nil (bug#80064).
2026-01-19 20:27:50 +02:00
Eli Zaretskii
1e080e2ecc ; * src/indent.c (Fvertical_motion): Fix last change. (Bug#80223) 2026-01-19 20:01:48 +02:00
Eli Zaretskii
cb7a3f4e89 Fix vertical cursor motion across overlay strings
* src/indent.c (Fvertical_motion): Fix vertical cursor motion when
a screen line begins with an overlay string.  (Bug#80223)
2026-01-19 16:20:39 +02:00
Eli Zaretskii
e81cee7468 ; * src/window.c (Fwindow_cursor_info): Fix commentary of last change. 2026-01-19 14:25:04 +02:00
RadioNoiseE
11347939c1 Fix box cursor width returned for stretch glyph
* src/window.c (Fwindow_cursor_info): Return canonical character width
when on stretch glyph and `x-stretch-cursor' is nil.  (Bug#80211)
2026-01-19 14:19:12 +02:00
Yavor Doganov
b44053536d NS: Fix UI freezes and Lisp threads on GNUstep
* src/nsterm.m (ns_select_1): Return thread_select if current
thread is not the main thread or timeout is zero; otherwise call
'thread_select' with a minimal timeout to allow other Lisp
threads to run.  (Bug#80110, Bug#80112)
2026-01-19 14:16:15 +02:00
Michael Albinus
31c07d873b ; Minor Tramp cleanup
* lisp/net/tramp-adb.el:
* lisp/net/tramp-androidsu.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-smb.el: Do not delay
`connection-local-set-profiles' until after loading `shell'.

* lisp/net/tramp-integration.el: Add the local profile for all
hosts listed in `tramp-local-host-names'.

* lisp/net/tramp.el (tramp-local-host-names): New defvar.
(tramp-local-host-regexp): Use it.

* test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults):
Adapt test.
2026-01-19 12:28:18 +01:00