1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 22:40:51 -08:00
Commit graph

47790 commits

Author SHA1 Message Date
Eli Zaretskii
03d9d18513 Fix display of raised/lowered composed text
* src/xdisp.c (fill_gstring_glyph_string): Adjust the base line of
the glyph string due to subscript/superscript.  (Bug#61290)
2023-02-05 13:57:10 +02:00
Eli Zaretskii
1a123feb18 Fix bidi reordering of sequence of whitespace characters before a TAB
* src/bidi.c (bidi_level_of_next_char): Test the current level
only for characters whose original type is BN.  (Bug#61269)
2023-02-04 13:34:42 +02:00
Eli Zaretskii
35e238cae8 Improve documentation of 'header-line-indent-mode'
* doc/lispref/modes.texi (Header Lines): Rewrite the documentation
of 'header-line-indent-mode' and its two variables.  Fix the
example.
* doc/lispref/display.texi (Pixel Specification): More accurate
description of what happens with :align-to in header-lines.
Improve indexing.  (Bug#61239)

* src/buffer.c (syms_of_buffer) <header-line-format>:
* lisp/display-line-numbers.el (header-line-indent)
(header-line-indent-width, header-line-indent-mode): Doc fixes.

* etc/NEWS: Enhance the announcement of 'header-line-indent-mode'.
2023-02-03 16:45:56 +02:00
Yuan Fu
8a6bdf88b4
Call treesit_record_change in insert_from_gap_1
Before this change, insert_from_gap calls treesit_record_change but
insert_from_gap_1 doesn't.  However, insert_from_gap_1 is a public
function and is called in many other places outside of insdel.c.  This
could lead to tree-sitter's parse tree becoming out-of-sync with the
buffer content.

This change might fix bug#60650.

* src/insdel.c (insert_from_gap_1): Call treesit_record_change.
(insert_from_gap): Remove call to treesit_record_change.

* admin/notes/tree-sitter/treesit_record_change: New file.
2023-02-02 18:31:19 -08:00
Eli Zaretskii
88ccf78b20 ; * src/treesit.c (treesit_predicate_match): Simplify last change. 2023-02-02 21:54:15 +02:00
Eli Zaretskii
20454128b8 Minor improvements in sqlite.c
* src/sqlite.c (Fsqlite_next): Doc fix.  Return nil if SQLITE_DONE
was once seen for this statement.  (Bug#61151)
(row_to_value): Cons the value in reverse, to avoid the Fnreverse
call.  Patch by Helmut Eller <eller.helmut@gmail.com>.
(Bug#61165)
2023-02-02 21:45:44 +02:00
Dmitry Gutov
3b3c47d977 (treesit_predicate_match): Match node text against regexp without consing
* src/treesit.c (treesit_predicate_match): Match node text against
regexp without creating a new string object (bug#60953).

* src/search.c (search_buffer): Make not static.
Delete declaration near the beginning of the file.

* src/lisp.h: Declare it here.

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--builtin-method-p):
Remove function.
(ruby-ts--font-lock-settings): Use the regexp with :match directly.
2023-02-02 21:38:59 +02:00
Kévin Le Gouguec
c498884059 Avoid spurious pause in kill-ring-save (Bug#60841)
'indicate-copied-region' checks whether the region is "highlighted"
and if not, briefly moves point to mark to give a visual cue of the
extent of text that was saved to the kill ring.

The region is considered "highlighted" if (a) it is active and (b) its
face specifies a :background.  That latter condition does not account
for the multiple ways in which the face can make the region "visually
distinct" from the default face, so switch to the more extensive
predicate face-differs-from-default-p.

The patch also fixes a couple of issues with the predicate's
implementation, and introduces a new user option in case anyone
happened to enjoy unconditional blinking.

* lisp/faces.el (face-differs-from-default-p): Filter out :extend; add
rationale for the attributes we ignore.
* lisp/simple.el (copy-region-blink-predicate): Add option to let
users explicitly opt into or out of blinking point and mark.
(region-indistinguishable-p): New function to detect
"if there is currently no active region highlighting", leveraging
face-differs-from-default-p.
(indicate-copied-region): Use it.
* src/xfaces.c (merge_face_ref): Allow :stipple to be nil, since it is
a documented valid value for that attribute.
* etc/NEWS: Announce user option.
2023-02-02 19:39:39 +01:00
Eli Zaretskii
f91bf9df89 Unbreak the MS-Windows build
* src/treesit.c (ts_query_pattern_count) [WINDOWSNT]: Load from
the library and define as macro.
2023-02-01 14:13:54 +02:00
Dmitry Gutov
66aa9cb450 ; (Ftreesit_query_capture): Fix typo 2023-02-01 03:53:38 +02:00
Dmitry Gutov
f711f4e99f (Ftreesit_query_capture): Cache list of predicates for given pattern index
* src/treesit.c (Ftreesit_query_capture):
Cache list of predicates for given pattern index (bug#60953).
2023-02-01 03:45:55 +02:00
Eli Zaretskii
49b6140558 Fix cursor-in-echo-area on TTY frames
* src/dispnew.c (update_frame_1): Fix off-by-one error when
positioning the cursor in the echo-area.  (Bug#61184)
2023-01-31 18:03:28 +02:00
Yuan Fu
382e018856
Add treesit-subtree-stat
* src/treesit.c (Ftreesit_subtree_stat): New function.
* lisp/treesit.el (treesit): Add to shortdoc.
2023-01-29 00:12:57 -08:00
Eli Zaretskii
bc5ee2b7bf ; * src/comp.c: Remove Local Variables section to avoid warnings. 2023-01-28 16:52:44 +02:00
Eli Zaretskii
ff9498624f ; * src/insdel.c (insert_from_buffer): Fix assertions. 2023-01-26 10:23:58 +02:00
Yuan Fu
4bd06ce2a9
Fix call to treesit_record_change in insdel.c
The start position of the change shouldn't be PT_BYTE, IIUC PT_BYTE is
actually the end position.

* src/insdel.c (insert_from_buffer): Move to here.
(insert_from_buffer_1): Remove call to treesit_record_change.
2023-01-25 23:14:35 -08:00
Basil L. Contovounesios
37454de0c8 Pacify --without-x unused function warning
* src/xfaces.c (font_maybe_unset_attribute): Move definition...
[HAVE_WINDOW_SYSTEM] (font_maybe_unset_attribute): ...to here, since
the function is used only when we HAVE_WINDOW_SYSTEM (bug#61049).
2023-01-25 14:32:42 +00:00
Eli Zaretskii
c854ef7a18 ; Fix last change (bug#60556). 2023-01-22 15:12:05 +02:00
Eli Zaretskii
8e83604dfe Avoid crashes in batch Emacs sub-processes on MS-Windows
* src/w32.c (shutdown_handler): When run in a separate thread,
don't call functions that only the main (a.k.a. "Lisp") thread can
call; instead, arrange for maybe_quit to kill Emacs.
* src/w32fns.c (emacs_abort): Don't show GUI Abort dialogs in
non-interactive sessions.  (Bug#60556)
2023-01-22 15:09:21 +02:00
Yuan Fu
bdd82fa797
; * src/treesit.c: Remove unused boilerplate.
These two functions are not used after 7c61a30410.
2023-01-17 22:32:39 -08:00
Basil L. Contovounesios
bd094207c7 Fix buffer-list-update-hook for indirect buffers
Fmake_indirect_buffer can be told whether to run buffer hooks since
bug#49160, but until now it ran buffer-list-update-hook irrespective
of this.

* src/buffer.c (Fmake_indirect_buffer): Don't run
buffer-list-update-hook when called with a non-nil
INHIBIT-BUFFER-HOOKS argument.
(run_buffer_list_update_hook): Don't special-case NULL argument, as
no such callers remain.

* test/src/buffer-tests.el
(buffer-tests-inhibit-buffer-hooks-indirect): Test whether indirect
buffer hooks are run regardless of whether base buffer hooks are
inhibited.  Check that all three buffer hooks, not just
kill-buffer-query-functions, are inhibited.
2023-01-17 10:38:22 +00:00
Yuan Fu
7c61a30410
Fix treesit-node-first-child-for-pos (bug#60127)
The problem is due to a bug in ts_node_first_child_for_pos, but
tree-sitter is moving pretty slowly right now so I reimplemented a
correct version of it in treesit.c.

* src/treesit.c (treesit_cursor_first_child_for_byte): New function.
(Ftreesit_node_first_child_for_pos): Use the new function.
2023-01-17 01:18:16 -08:00
Yuan Fu
b36cc7e7bb
; * src/treesit.c (Ftreesit_induce_sparse_tree): Minor change. 2023-01-17 00:58:36 -08:00
Eli Zaretskii
140824dc09 ; Fix more quoting in w32fns.c. 2023-01-16 16:55:01 +02:00
Eli Zaretskii
7c8eac8fbc ; * src/w32fns.c: Fix quoting. Patch by Arash Esbati <arash@gnu.org>. 2023-01-16 16:00:18 +02:00
Stefan Kangas
920a7d38e9 ; Fix typos 2023-01-15 02:14:19 +01:00
Yuan Fu
dc33a12223
Fix use of build_pure_c_string in treesit.c
This is brought up in bug#60691.  build_pure_c_string should only be
used in places such as syms_of_treesit, which are called just once,
during dumping.

* src/treesit.c (Vtreesit_str_libtree_sitter):
(Vtreesit_str_tree_sitter):
(Vtreesit_str_dot):
(Vtreesit_str_question_mark):
(Vtreesit_str_star):
(Vtreesit_str_plus):
(Vtreesit_str_pound_equal):
(Vtreesit_str_pound_match):
(Vtreesit_str_pound_pred):
(Vtreesit_str_open_bracket):
(Vtreesit_str_close_bracket):
(Vtreesit_str_open_paren):
(Vtreesit_str_close_paren):
(Vtreesit_str_space):
(Vtreesit_str_equal):
(Vtreesit_str_match):
(Vtreesit_str_pred): New variables.

(treesit_load_language):
(Ftreesit_pattern_expand):
(Ftreesit_query_expand):
(treesit_eval_predicates): Use new varaibles.

(treesit_check_buffer_size):
(treesit_compose_query_signal_data):
(treesit_check_range_argument):
(Ftreesit_parser_set_included_ranges):
(treesit_predicate_capture_name_to_node):
(treesit_predicate_equal):
(treesit_predicate_match):
(treesit_predicate_pred): Use build_string for signal message.

(syms_of_treesit): Initialize new variables.
2023-01-13 17:32:14 -08:00
Eli Zaretskii
dfb38fb2ee ; Improve documentation of tree-sitter node comparison
* doc/lispref/parsing.texi (Accessing Node Information):
* src/treesit.c (Ftreesit_node_eq): Improve documentation of node
comparison.
2023-01-13 09:13:24 +02:00
Eli Zaretskii
e8a89a18b6 ; Fix non-tree-sitter builds
* src/fns.c (internal_equal): Call treesit_node_eq only if
tree-sitter was compiled in.
2023-01-13 08:58:03 +02:00
Yuan Fu
956889d8ff
Equal now recognizes tree-sitter nodes (bug#60659)
Now equal uses ts_node_eq to check equality between nodes.

* doc/lispref/parsing.texi:
(Accessing Node Information): Update manual.
* src/fns.c (internal_equal): Handle tree-sitter nodes.
* src/treesit.c (treesit_node_eq): New function.
(Ftreesit_node_eq): Factor out.  Update docstring.
* src/treesit.h (treesit_node_eq): Declare new function.
2023-01-12 17:11:38 -08:00
Eli Zaretskii
cfd2b3504a Fix encoding with 'utf-8-auto'
* src/coding.c (encode_coding_utf_8): Fix encoding with
'utf-8-auto': it should produce BOM, per the documentation of
the :bom attribute.  (Bug#60750)

* lisp/international/mule.el (define-coding-system): Doc fix.

* test/src/coding-tests.el (coding-tests): Use
'with-coding-priority' instead of 'prefer-coding-system', as the
latter has global persistent effect and affects further tests.
2023-01-12 16:36:35 +02:00
Po Lu
53b47df822 Report cursor correctly on PGTK when there is a margin
* src/pgtkterm.c (pgtk_draw_window_cursor): Adjust frame_x by
the margin width as well.
2023-01-12 18:36:14 +08:00
Yuan Fu
aa9df1260c
Don't print named tree-sitter nodes with parenthesizes (bug#60696)
* src/print.c (print_vectorlike): Use empty string as delimiters if
the node is named.
2023-01-09 20:15:12 -08:00
Eli Zaretskii
ebc5263667 ; * src/callint.c (Finteractive): Doc string clarification. 2023-01-09 14:03:04 +02:00
Tad Fisher
1469aac20d ; * src/pgtkfns.c (parse_resource_key): Use recursive schema lookup
XDG_DATA_DIRS may consist of multiple directories, and
g_settings_schema_source_get_default composes these into a recursive
schema source. One must pass TRUE to g_settings_schema_source_lookup,
otherwise only the first directory in XDG_DATA_DIRS is searched.

It follows that in the case that the directory containing the compiled
GSettings schema for Emacs is not the first in XDG_DATA_DIRS,
parse_resource_key will not accept any resource key, which causes
pgtk_get_defaults_value and pgtk_set_defaults_value to fail.

This impacts systems that compose multiple GSettings schema sources
via XDG_DATA_DIRS, such Flatpak and NixOS.

Supporting GIO documentation for g_settings_schema_source_get_default:

> The returned source may actually consist of multiple schema sources
> from different directories, depending on which directories were given
> in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
> lookups performed against the default source should probably be done
> recursively.

Bug#60565

Copyright-paperwork-exempt: yes
2023-01-08 13:48:25 +02:00
Eli Zaretskii
5cb01ac5d7 ; * src/callint.c (Finteractive): Fix the doc string (bug#60645). 2023-01-08 12:43:56 +02:00
Eli Zaretskii
ec172d748f Avoid assertion violation due to fill-column indicator face
* src/xdisp.c (extend_face_to_end_of_line): Use the original
iterator metrics for the stretch glyph, the one unaffected by the
'fill-column-indicator' face.  (Bug#60580)
2023-01-05 22:33:51 +02:00
Eli Zaretskii
16eca92415 ; * src/gnutls.c (Fgnutls_deinit): Fix typo in doc string (bug#60579). 2023-01-05 20:39:14 +02:00
Eli Zaretskii
8d530ca654 ; Fix documentation of y-or-n-p/yes-or-no-p
* lisp/subr.el (y-or-n-p):
* src/fns.c (Fyes_or_no_p): Doc fix.
2023-01-04 19:25:47 +02:00
Eli Zaretskii
d26b523886 Fix shrinking of the tab-bar
* src/haikufns.c (haiku_change_tab_bar_height):
* src/pgtkfns.c (pgtk_change_tab_bar_height):
* src/nsfns.m (ns_change_tab_bar_height):
* src/w32fns.c (w32_change_tab_bar_height):
* src/xfns.c (x_change_tab_bar_height): Don't let the number of
tab-bar lines degenerate to zero due to integer division.
(Bug#60210)
2023-01-02 17:02:05 +02:00
Eli Zaretskii
b7ad0b4014 ; Clarify doc strings of 'call-process' and 'call-process-region'
* src/callproc.c (Fcall_process, Fcall_process_region): Document
that the destination buffer can be specified by its name.
(Bug#60477)
2023-01-02 13:52:25 +02:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Stefan Kangas
9292f595a7 ; Fix typos 2022-12-31 12:43:32 +01:00
Eli Zaretskii
bfdad6c4e5 ; Fix recent treesit-related changes
* lisp/treesit.el (treesit-language-source-alist)
(treesit--install-language-grammar-1): Doc fixes.

* src/treesit.c (Ftreesit_language_abi_version): Fix a typo in
function's Lisp name.  Doc fix.
(Ftreesit_language_available_p): Fix a typo in the function's C
name.

* doc/lispref/parsing.texi (Language Grammar): Fix wording.
2022-12-31 10:13:15 +02:00
Yuan Fu
ab1f245f1a
Show tree-sitter query source when signaling query error
* src/treesit.c (treesit_compose_query_signal_data): Add QUERY_SOURCE
parameter.
(treesit_ensure_query_compiled)
(Ftreesit_query_capture): Add query source.
2022-12-30 16:57:45 -08:00
Yuan Fu
0237c5927e
Add treesit-language-abi-version
Also rename treesit-language-version to treesit-library-abi-version,
because the old name is somewhat misleading.

* doc/lispref/parsing.texi (Language Grammar): Update.
* src/treesit.c (Ftreesit_library_abi_version): Rename.
(Ftreesit_language_abi_version): New function.
2022-12-30 02:54:13 -08:00
Juri Linkov
60418e6f09 * src/keyboard.c (echo_add_key): Use recently rebound C-h key C-q (bug#60249) 2022-12-29 19:41:41 +02:00
Eli Zaretskii
706ed85285 Avoid assertion violations in treesit.c with --enable-checking
* src/treesit.c (Ftreesit_node_first_child_for_pos)
(Ftreesit_node_descendant_for_range): Check validity of buffer
positions before converting them to byte-positions, to avoid
assertion violations in buf_charpos_to_bytepos.
2022-12-29 13:52:09 +02:00
Yuan Fu
f509246ba1
Call tree-sitter parser notifier on the first parse
* src/treesit.c (treesit_call_after_change_functions): Handle NULL
old_tree.
(treesit_ensure_parsed): Remove check for NULL tree.
2022-12-28 15:30:10 -08:00
Yuan Fu
ec6feeaa19
Fix tree-sitter parser notifier recursion
See the comment for detail.

* src/treesit.c (treesit_ensure_parsed): Move the need_reparse short
circuit to the very beginning.  Move the call to
treesit_call_after_change_functions to the very end.
2022-12-28 15:19:34 -08:00