Commit graph

176708 commits

Author SHA1 Message Date
Yuan Fu
3be04f3dab
Fix tree-sitter language remapping
* src/treesit.c (resolve_language_symbol): Move forward.
(treesit_ensure_query_compiled): Resolve language remapping
here.
(Ftreesit_parser_list): Don't resolve language remaping here,
because there's no need: parsers now carries the remapped
language.
(Ftreesit_query_compile): Don't resolve language remapping here,
because we resolve language remapping when actually compiling
the query.  Also we want the query to carry the unmapped
language.
2025-01-29 23:20:38 -08:00
Eli Zaretskii
0b3e050c6c * src/puresize.h (BASE_PURESIZE): Increase (bug#75907). 2025-01-30 08:38:05 +02:00
Yuan Fu
c81b50aaf5
Add back tree-sitter declare-function for python.el (bug#75526)
treesit-declare-unavailable-functions is not available for old
emacs versions, but python.el is a core package available on
ELPA.

Remove the treesit-declare-unavailable-functions until compat.el
releases a new version that contains it.

* lisp/progmodes/python.el: Remove
treesit-declare-unavailable-functions and add back
declare-function forms.
2025-01-29 21:25:32 -08:00
Gerd Möllmann
782be196e5 Further fixes for cursor positioning (bug#75056)
* src/dispnew.c (write_matrix): Don't set the cursor here. Parameter to
set the cursor or not removed.
(combine_updates_for_frame): Call tty_set_cursor here, depending on
whether or not the selected frame is related to the updated frame.
(update_frame_with_menu): Adapt to change of write_matrix.
2025-01-30 05:41:12 +01:00
Gerd Möllmann
7aacefba6b Replace two macros with functions in dispnew.c (bug#75056)
* src/dispnew.c (WINDOW_TO_FRAME_VPOS, WINDOW_TO_FRAME_VPOS): Macros
removed.
(window_to_frame_vpos, window_to_frame_vpos): Always define, and use
them instead of the removed macros.
2025-01-30 05:41:12 +01:00
Gerd Möllmann
6cf479931d Don't use selected frame in tty_set_cursor (bug#75056)
* src/dispnew.c (tty_set_cursor): Add frmae parameter.
(write_matrix): Pass to the updated frame to tty_set_cursor.
2025-01-30 05:41:12 +01:00
Alan Mackenzie
b34c069d82 CC Mode: Don't propertize parens in macros incorrectly
Parentheses in macros were getting incorrectly propertized with
the '(1) (punctuation) syntax-table text property.  This was
due to a typo in the patch "CC Mode: Rationalize and optimize
cache invalidation (1)" from 2024-10-06.  Correct this.

* lisp/progmodes/cc-mode.el (c-depropertize-CPP): Move the
first c-clear-syntax-table-with-value-trim-caches invocation
from inside the enclosing `when' form to after it.
2025-01-29 18:35:31 +00:00
Juri Linkov
6a92f674fe Fix args in treesit-beginning-of-defun and treesit-end-of-defun
* lisp/treesit.el (treesit-beginning-of-defun): Set arg to 1 when nil.
(treesit-end-of-defun): Fix arg names in docstring.
2025-01-29 19:58:10 +02:00
Basil L. Contovounesios
25c254aa41
; Remove duplicate defvar in comp-run.el.
* lisp/emacs-lisp/comp-run.el (comp-async-compilations): Remove
duplicate definition (bug#75925).
2025-01-29 18:13:41 +01:00
Eli Zaretskii
0c6aa27cde ; Fix Cygw32 build (bug#75926)
(cherry picked from commit cb62a47896)
2025-01-29 18:00:24 +02:00
Eli Zaretskii
cb62a47896 ; Fix Cygw32 build 2025-01-29 17:55:58 +02:00
João Távora
142fe5ace4 Eglot: don't auto-shutdown when reverting of single managed buffer
When eglot-autoshutdown is t and the only reason we're
considering it is because of a revert (which tears down Eglot's
minor mode as if by killing), detect that situation and
purposedly cancel the shutdown.

* lisp/progmodes/eglot.el (eglot--managed-mode): Tweak.
2025-01-29 08:59:07 +00:00
João Távora
e2ff77052d Eglot: in eglot-code-action-indications, make 'margin' interactive
Didn't know it was possible, thanks to Ergus <spacibba@aol.com> for the
tip about binding [left-margin mouse-2] in the keymap.

The technique adopted in 'eglot-mouse-call' possibly still doesn't work
very well if the margin thing we're clicking on is not on the line point
is currently on.  But we don't have that problem (yet?) because LSP
action suggestions function mostly on a "at point" basis.

* lisp/progmodes/eglot.el (eglot-code-action-indications): Adjust docstring.
(eglot--mouse-call): Don't go anywhere except in text area.
(eglot-diagnostics-map): Bind eglot-mouse-actions to left-margin.
2025-01-29 08:56:02 +00:00
Juri Linkov
2e3b085d44 Hideshow support for tree-sitter in hs-minor-mode (bug#75609)
* lisp/progmodes/hideshow.el (hs-inside-comment-p-func):
New buffer-local variable.
(hs-hide-block-at-point): Check if 'hs-block-end-regexp' is
a string or a function.
(hs-inside-comment-p): Move body to 'hs-inside-comment-p--default'.
Call 'hs-inside-comment-p-func' if it's a function.
(hs-inside-comment-p--default): New function with body from
'hs-inside-comment-p'.
(hs-hide-all): Don't use 'hs-block-start-regexp' when it's not a string.
(hs-minor-mode): Don't call 'hs-grok-mode-type' when
'hs-inside-comment-p-func' already has a buffer-local value.

* lisp/treesit.el (treesit-hs-block-end)
(treesit-hs-find-block-beginning, treesit-hs-find-next-block)
(treesit-hs-looking-at-block-start-p)
(treesit-hs-inside-comment-p): New functions.
(treesit-major-mode-setup): Set hs-minor-mode buffer-local variables.
2025-01-28 21:07:16 +02:00
Juri Linkov
cd6aed5c9e * lisp/treesit.el: Use default display behavior for treesit-explore.
(treesit-explorer-switch-parser, treesit-explore):
Revert to previous behavior (bug#75079).
2025-01-28 20:49:52 +02:00
Stefan Kangas
d0907a4388 ; * admin/MAINTAINERS: Prefer "website" to "home page". 2025-01-28 18:49:44 +01:00
Bastien Guerry
1969c2c3ed ; * admin/MAINTAINERS: Remove Bastien Guerry.
(cherry picked from commit eb73dd0d45126e693645ead7a34f113217fa48bb)
2025-01-28 18:49:44 +01:00
Stefan Kangas
6447634f17 ; * admin/MAINTAINERS: Add CC Mode. 2025-01-28 18:49:42 +01:00
Martin Rudalics
af033548aa Fix two more drawings in windows.texi
* doc/lispref/windows.texi (Changing Window Layouts): Fix two more
drawings.
2025-01-28 18:46:31 +01:00
Stefan Kangas
486d5d524c Update cc-mode URL to point to nongnu.org
* doc/misc/cc-mode.texi (Getting Started)
(Custom Filling and Breaking, Updating CC Mode)
(Mailing Lists and Bug Reports):
* lisp/progmodes/cc-mode.el: Update cc-mode URL to point to nongnu.org,
instead of old URL on SourceForge.
2025-01-28 18:44:05 +01:00
Stefan Kangas
17ef46e849 ; * etc/NEWS: Note CVE-2024-53920 further up also. 2025-01-28 18:42:52 +01:00
Eli Zaretskii
8c4a4b4eab ; Fix last change
* src/buffer.c (Fother_buffer):
* lisp/frame.el (make-frame):
* doc/lispref/frames.texi (Creating Frames): Fix em-dash.
2025-01-28 18:18:24 +02:00
Martin Rudalics
7f01dd8906 New variable 'expose-hidden-buffer' (Bug#75828)
* src/frame.c (make_frame): Handle 'expose-hidden-buffer'.
(expose-hidden-buffer): New variable to handle hidden buffers.
* src/buffer.c (Fother_buffer): Mention that it does not return
a hidden buffer.
* lisp/frame.el (make-frame): In doc-string describe handling
of hidden buffers.
* doc/lispref/frames.texi (Creating Frames): Explain handling
of hidden buffers in description of 'make-frame'.
2025-01-28 16:59:45 +01:00
Eli Zaretskii
05ee2b741f ; * CONTRIBUTE: Suggest to run more tests sometimes. 2025-01-28 16:57:47 +02:00
Bastien Guerry
c400ac680f ; * admin/MAINTAINERS: Remove Bastien Guerry. 2025-01-28 14:25:22 +01:00
João Távora
b4e9115f4f Eglot: allow customizing the mode line (bug#71823)
* lisp/progmodes/eglot.el (eglot-code-action-indications): Adjust docstring.
(eglot--mode-line-props): Tweak.
(eglot--mode-line-format): Delete.
(eglot-mode-line-format): New defcustom.
(eglot-mode-line-menu, eglot-mode-line-session)
(eglot-mode-line-error, eglot-mode-line-pending-requests)
(eglot-mode-line-progress, eglot-mode-line-action-suggestion): New
constants.
(mode-line-misc-info): Adjust setting

* etc/EGLOT-NEWS: Mention new feature.

* doc/misc/eglot.texi (Customization Variables): Mention new variable.
2025-01-28 11:04:21 +00:00
João Távora
d6a502fc7a Eglot: suggest code actions at point
* lisp/progmodes/eglot.el (eglot-code-action-indicator-face): New face.
(eglot-code-action-indications, eglot-code-action-indicator): New defcustoms.
(eglot--highlights): Move up here.
(eglot--managed-mode): Rework.
(eglot--server-menu-map, eglot--main-menu-map): Extract maps into
variables (avoids odd mode-line bug).
(eglot--mode-line-format): Rework.
(eglot--code-action-params): New helper.
(eglot-code-actions): Rework.
(eglot--read-execute-code-action): Tweak.
(eglot-code-action-suggestion): New function.

* etc/EGLOT-NEWS: Mention new feature.

* doc/misc/eglot.texi (Eglot Features): Mention new feature.
(Customization Variables): Mention new variables.
2025-01-28 11:04:21 +00:00
João Távora
7f0ef9655c Eglot: introduce eglot-advertise-cancellation
Setting this variable to true causes Eglot to send special
cancellation notification for certain stale client request.

This may help some LSP servers avoid doing costly but ultimately useless
work on behalf of the client, improving overall performance.

Request cancellation is described in

   https://microsoft.github.io/language-server-protocol/
      specifications/lsp/3.17/specification/#cancelRequest

* lisp/jsonrpc.el (jsonrpc-request): Accept function as value for
CANCEL-ON-INPUT.

* lisp/progmodes/eglot.el (eglot--request): Rework.

* doc/misc/eglot.texi (Customizing Eglot): Mention
eglot-advertise-cancellation.
2025-01-28 11:04:21 +00:00
João Távora
9e4b626f7e Eglot: restructure and overhaul documentation
* doc/misc/eglot.texi (Starting Eglot): Tweak.
(Using Eglot): Remove link to 'Eglot Variables'.
(Eglot Features): Rework.
(Eglot and Buffers): Rework.
(Eglot Commands): Rework.
(Customizing Eglot): New chapter.
(Customization Variables): Now contains what 'Eglot Variables'
used to contain.
(Other Variables): New section.
(More Customization): New section.
(...elsewhere...): Apply 'fill-paragraph'.
2025-01-28 11:04:19 +00:00
João Távora
60166a419f Eglot: symbol highlighting now done in eldoc-documentation-functions
Even though highlighting the thing at point isn't really producing
documentation at point, theory and practice have shown that using
eldoc-documentation-functions for this is a feasible way to avoid
reimplementing all the idle timer logic for such functionality.

In fact, we were already using ElDoc for this purpose, but this commit
makes it so the new eglot-highlight-eldoc-function is a first class
citizen in eldoc-documentation-functions, so users can manipulate it if
so desired.

* lisp/progmodes/eglot.el (eglot--managed-mode): Use
eglot-highlight-eldoc-function
(eglot-hover-eldoc-function): Don't mix highlighting with hover.
(eglot-highlight-eldoc-function): Rename and rework from
eglot--highlight-piggyback
2025-01-28 11:00:47 +00:00
Michael Albinus
e74efd9a42 * CONTRIBUTE: Recommend running the unit test prior to committing. 2025-01-28 10:12:09 +01:00
Martin Rudalics
33827bed04 Fix previous commit for Changing Window Layouts
* doc/lispref/windows.texi (Changing Window Layouts): Remove wrong
example.  Change some indentations.
2025-01-28 10:00:50 +01:00
Gerd Möllmann
d60198d7a4 Fix frame-visible-p for tty root frames
* src/frame.c (Fframe_visible_p): Don't unconditionally return t for tty
root frames.
2025-01-28 04:39:59 +01:00
Yuan Fu
a9cde2463a
Don't signal an error in treesit-node-at
* lisp/treesit.el (treesit-node-at): Wrap
treesit-buffer-root-node within condition-case.
2025-01-27 17:55:54 -08:00
Paul Eggert
1f1088188e Avoid some make_formatted_string mallocs
* src/alloc.c (make_formatted_string):
Grow the local buffer from 64 to MAX_ALLOCA bytes.
2025-01-27 17:16:44 -08:00
Paul Eggert
8e7588a267 Make vmessage a bit safer
* src/xdisp.c (vmessage): Avoid undefined behavior if
FRAME_MESSAGE_BUF_SIZE (f) is zero, or if doprnt generates output
containing only encoding errors.  Although it’s not clear whether
either is possible, it is better to be safe.  Also, clarify via a
new local message_bufsize.
2025-01-27 17:16:44 -08:00
Pip Cet
8812f526cf Avoid printing NUL characters in 'message' (bug#75900)
* src/xdisp.c (vmessage): Increase buffer size to fit an extra
multibyte character.  On buffer overflow, drop the last multibyte
character to determine an accurate byte length.
2025-01-27 17:16:43 -08:00
Pip Cet
0ed913cf46 Fix buffer overflows in doprnt (bug#75900)
* src/doprnt.c (doprnt): Clear rest of buffer on multibyte overflow.
Always decrement bufsize when writing a byte.
2025-01-27 17:16:43 -08:00
Paul Eggert
9b2e230c06 doprnt %X support
* src/doprnt.c (doprnt): Also support %X, since callers
now use %X.
2025-01-27 17:16:43 -08:00
Stefan Kangas
ba60fa3dea Don't use obsolete face variables in lisp-mode.el
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-1)
(lisp-cl-font-lock-keywords-1, lisp-el-font-lock-keywords-2)
(lisp-cl-font-lock-keywords-2): Don't use obsolete face variables.
2025-01-27 22:48:53 +01:00
Stephen Gildea
29c6dad78d time-stamp: Don't get confused by newline in file name
* lisp/time-stamp.el (time-stamp-filtered-buffer-file-name): New helper
* test/lisp/time-stamp-tests.el: (time-stamp-custom-file-name): New test
2025-01-27 10:46:56 -08:00
Stephen Gildea
2d386fc449 time-stamp-tests: Make macro-defined tests findable
* test/lisp/time-stamp-tests.el (define-formatz-tests): Use
'find-function-update-type-alist' to make defined tests findable.
(formatz-find-test-def-function): New test-finding function.
2025-01-27 10:42:35 -08:00
Eli Zaretskii
5d021a711a ; Improve documentation of '.dir-locals.el'
* doc/lispref/variables.texi (Directory Local Variables):
* doc/emacs/custom.texi (Directory Variables): Document that
'.dir-locals-2.el' must be in the same directory as
'.dir-locals.el'.  (Bug#75890)
2025-01-27 15:19:06 +02:00
jared
5eae7f5227 Fix clicking in child frames with GPM
* src/term.c (handle_one_term_event): Store child frame
coordinates in event.
2025-01-27 14:09:51 +02:00
Gerd Möllmann
59050c3e8c ; Fix workaround for xt-mouse-tests
* lisp/xt-mouse.el (xterm-mouse-event): For running this in batch mode,
fix computation of x and y.
2025-01-27 10:21:08 +01:00
Martin Rudalics
827dfe5a72 In Elisp manual document new functions for changing window layouts
* doc/lispref/windows.texi (Changing Window Layouts): New section
to document the new functions for changing window layouts.
* doc/lispref/elisp.texi (Top): Add entry for new section.
2025-01-27 10:06:51 +01:00
Stefan Kangas
d2ffa0fa48 ; Fix byte-compilation warnings 2025-01-27 09:19:39 +01:00
Eshel Yaron
84595cbcc7
; (let-alist): Document double-dot escape syntax. (Bug#75852) 2025-01-27 08:26:19 +01:00
Paul Eggert
1ed769a3cb Pacify -Wanalyzer-use-of-uninitialized-value
With ‘configure --enable-gcc-warnings’,
gcc (GCC) 14.2.1 20250110 (Red Hat 14.2.1-7) on x86-64
complained, as it apparently did not want to assume that enum
variables have one of the listed values.
Work around the problem by using tables rather than
switch statements.  This gives up a little static
checking but I don’t see any other easy way to pacify
GCC without disabling the warnings entirely.
* src/pdumper.c (dump_fwd_int, dump_fwd_bool, dump_fwd_obj)
(dump_fwd_buffer_obj, dump_fwd_kboard_obj):
Last arg is now void const * so that these functions’ addresses
can all be put into the same array.
(dump_fwd, dump_anonymous_allocate_posix, dump_map_file_posix):
Use an array rather than a switch.
(mem_prot_posix_table): New static constant table.
2025-01-26 23:05:55 -08:00
Paul Eggert
a5c47258ff Fix unlikely eassert failure in invalid_radix_integer
* src/lread.c (invalid_radix_integer):
Simplify by using sprintf with a big-enough buffer.
2025-01-26 23:05:55 -08:00