1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-13 10:20:59 -07:00
Commit graph

47962 commits

Author SHA1 Message Date
Mattias Engdegård
8dc36cc53b * src/lread.c (syms_of_lread): Drop unused capture group. 2022-11-09 11:54:57 +01:00
Po Lu
12e601f981 Clean up some duplicate event group conversion code
* src/xterm.c (xi_convert_event_keyboard_state): New function.
Move keyboard event state over.
(handle_one_xevent): Use it where necessary.
2022-11-08 20:00:36 +08:00
Po Lu
d30a7c142d Add missing SAFE_FREE on XI 2.0 servers
* src/xterm.c (xi_populate_device_from_info): Add missing
SAFE_FREE.
2022-11-07 20:34:14 +08:00
Po Lu
802671493d Avoid invalid values showing up in scroll valuators
* src/xterm.c (xi_populate_device_from_info): Reset emacs_value
when invalid_p is cleared.
2022-11-07 18:08:57 +08:00
Stefan Monnier
35221a7bd5 (itree_insert_gap, itree_delete_gap): Minor optimization
`limit` can get smaller in either of the two children of a node.
It can also happen that the root node itself has a low enough limit
that the loop can be interrupted right away.

The previous code only checked `limit` when going down to a left
child, which is not wrong, but tests suggest that it is also very
common to reach this limit when going to a right child, so move the
test accordingly.

* src/itree.c (itree_insert_gap, itree_delete_gap): Check `limit` for
all nodes, rather than only when following a `left` pointer.
2022-11-07 00:38:43 -05:00
Eli Zaretskii
6cb963ff19 ; Avoid compiler warnings in 'extend_face_to_end_of_line'
* src/xdisp.c (extend_face_to_end_of_line): Return if no
default_face is cached or could be realized.  This avoids
compilation warnings about NULL pointer dereferences.
2022-11-06 16:45:30 +02:00
Eli Zaretskii
5233186611 Revert "Pacify -Wnull-dereference"
This reverts commit dad452552b.
Please don't assume I write such code by omission.
2022-11-06 16:31:25 +02:00
Po Lu
44138d5ecc ; * src/image.c (syms_of_image): Add missed part of change.
Author:
2022-11-06 20:11:56 +08:00
Po Lu
5f8c655a44 Fix splash screen display on NS and Haiku with native image APIs
* src/image.c (syms_of_image): Add Qsvg image type if SVG is
also supported by native image APIs.
2022-11-06 20:07:49 +08:00
Po Lu
dad452552b Pacify -Wnull-dereference
* src/xdisp.c (extend_face_to_end_of_line): Use FACE_FROM_ID,
not FACE_FROM_ID_OR_NULL, when the next line proceeds to
immediately dereference the face.
2022-11-06 19:42:36 +08:00
Po Lu
f305d1ab3a Write more commentary on XI2 device management
* src/xterm.c (xi_populate_device_from_info): Take dpyinfo.
Describe what master and slave devices are, how they represent
seats, and how they are used to multiplex user input.  Also
simplify ifdefs and avoid looping over scroll classes on XI 2.0.
(x_cache_xi_devices, handle_one_xevent): Adjust accordingly.
(x_term_init): Set dpyinfo->xi2_version before calling
x_cache_xi_devices.
2022-11-06 19:39:01 +08:00
Eli Zaretskii
cd296e19a2 ; * src/itree.h (forget_itree): Make the prototype conditional. 2022-11-06 12:22:11 +02:00
Eli Zaretskii
24e5abdc06 Fix face extension when Org narrows the buffer
* src/xdisp.c (extend_face_to_end_of_line): Make sure glyph rows
at ZV use the default face for extension.  (Bug#59065)
2022-11-06 11:33:38 +02:00
Matt Armstrong
23dd27a979 itree.c and buffer-tests.el: Incorporate code review feedback
* src/itree.c: Improve wording in `itree_insert_gap` comment.
* test/src/buffer-tests.el (test-overlay-insert-before-markers-at-start):
Don't rely on (point-min) being 1.
(test-overlay-insert-before-markers-at-end): ditto.
(test-overlay-insert-before-markers-empty): ditto.
2022-11-06 00:05:55 -04:00
Stefan Monnier
6e5ec08551 buffer.c: evaporate overlays in all indirect buffers
This fixes bug#58928.  The patch works by moving the
`evaporate_overlays` check closer to `itree_delete_gap`.

* src/buffer.c (adjust_overlays_for_delete_in_buffer): New function,
integrating the functionality of `evaporate_overlays`.
(adjust_overlays_for_delete): Use it.
(evaporate_overlays): Delete function.

* src/buffer.h (evaporate_overlays): Delete declaration.

* src/insdel.c (adjust_markers_for_replace): Minor optimization.
(adjust_after_replace, replace_range, replace_range_2, del_range_2):
Don't call `evaporate_overlays`.

* test/src/buffer-tests.el (buffer-tests--overlays-indirect-evaporate):
Remove the `:expected-result :failed` attribute.
2022-11-05 17:22:37 -04:00
Matt Armstrong
26d2ac38e9 Minor tweaks to the fix for `insert-before-markers' overlay fix
(bug#58928)

* src/buffer.c (adjust_overlays_for_insert): wrap to less than 80
chars.
* src/itree.c: document BEFORE_MARKERS.
2022-11-05 16:45:18 -04:00
Eli Zaretskii
26460328bc Fix the unexec build
* src/itree.c (forget_itree): New function.
* src/emacs.c (Fdump_emacs): Call 'forget_itree'.
2022-11-05 15:19:42 +02:00
Eli Zaretskii
ae497d75f7 Fix warnings in sqlite.c in the MS-Windows build
* src/sqlite.c (sqlite3_errstr) [WINDOWSNT]: Define and load from
the DLL only if the SQLite3 version is at least 3.7.15.
(sqlite_prepare_errdata) [SQLITE_VERSION_NUMBER >= 3007015]: Use
the original code if sqlite3_errstr is available.
2022-11-05 14:28:53 +02:00
Po Lu
ae7dcba6c5 Make sqlite.c build with SQlite in Fedora 9
* src/sqlite.c (sqlite_prepare_errdata): Use sqlite3_errmsg
instead of sqlite3_errstr.
2022-11-05 19:43:30 +08:00
Po Lu
154ecf6197 Simplify XI scroll class reporting code
* src/xterm.c (xi_populate_device_from_info): Use xnmalloc.
Avoid reading classes at all when the XI library only supports
2.0.
(xi_handle_new_classes): New function.
(xi_handle_device_changed): Move class parsing logic there to
avoid duplicating code.
2022-11-05 19:11:29 +08:00
Paul Eggert
90a0aac3e8 Pacify gcc -Wanalyzer-null-dereference
This is for gcc 12.2.1 20220819 (Red Hat 12.2.1-2) x86-64
when Emacs is configured with --enable-gcc-warnings.
* src/buffer.c (Fmove_overlay): Prefer BASE_EQ to EQ in a place
where they’re equivalent because the only symbol allowed here is nil.
2022-11-04 11:02:08 -07:00
Philip Kaludercic
5fa2f11679 Merge branch 'feature/package+vc' 2022-11-04 18:57:45 +01:00
Michael Albinus
5d6e919a90 Fix calling file name handler for `load'.
* lisp/net/ange-ftp.el (ange-ftp-load): Add MUST-SUFFIX argument.

* lisp/net/tramp.el (tramp-handle-load): Adapt MUST_SUFFIX test.

* src/lread.c (Fload): Call handler with must_suffix.

* test/lisp/net/tramp-tests.el (tramp-test27-load): Extend test.
2022-11-04 15:39:58 +01:00
Po Lu
01471b5fdf Avoid using too up-to-date values when restoring valuators
* src/xterm.c (xi_has_scroll_valuators): New function.
(xi_handle_device_changed): If the device changed event provides
scroll valuators, then use the values in there.  (bug#58980)
2022-11-04 19:23:19 +08:00
Yuan Fu
b86deb617b
Fix treesit-parser-set-included-ranges
Track whether a parser has ranges set ourselves.  See comment in
Ftreesit_parser_included_ranges for detail.

* src/treesit.c (make_treesit_parser): Initialize has_range.
(Ftreesit_parser_set_included_ranges): Set has_range.  Fill docstring.
(Ftreesit_parser_included_ranges): Check has_range.
* src/treesit.h (Lisp_TS_Parser): Add has_range.
2022-11-03 22:14:50 -07:00
Stefan Monnier
5e7d08ae13 itree.c: Minor tightening
* src/itree.c (iter): Initialize to NULL.
(init_itree): Make sure it's not allocated before we overwrite it.
(itree_insert_gap): Tweak the end-loop.
2022-11-03 23:16:12 -04:00
Stefan Monnier
ff679e16f8 itree: Reproduce markers's behavior more faithfully (bug#58928)
The most obvious problem was the lack of support for
`insert-before-markers`, but the behavior was also different in a few
other cases.

* src/itree.h (itree_insert_gap):
* src/itree.c (itree_insert_gap): Add `before_markers` arg.
* src/lisp.h (adjust_overlays_for_insert):
* src/buffer.c (adjust_overlays_for_insert): Add `before_markers` arg.

* src/insdel.c (adjust_markers_for_replace, adjust_markers_for_insert)
(adjust_markers_for_delete): Adjust overlays directly from here.
(insert_1_both, insert_from_string_1, insert_from_gap)
(insert_from_buffer_1, adjust_after_replace, replace_range)
(replace_range_2, del_range_2): Don't adjust overlays explicitly here
any more.

* test/src/buffer-tests.el (test-overlay-insert-before-markers-empty)
(test-overlay-insert-before-markers-non-empty): New tests.
2022-11-03 22:44:55 -04:00
Yuan Fu
c5f24f76eb
; * src/treesit.c: Minor comment change. 2022-11-03 19:39:43 -07:00
Po Lu
8e7066babe Fix initialization of scroll valuator emacs_value
* src/xterm.c (xi_handle_device_changed): Initialize emacs_value
to 0, not DBL_MIN.  (bug#58980)
2022-11-04 08:29:13 +08:00
Basil L. Contovounesios
a66280162f Port interval trees to --enable-checking=structs
Some names under the interval_* namespace were renamed under the
itree_* namespace in commits:

  0. f421b58db5 of 2022-10-19
  "Prefix all itree.h type names with itree_".
  1. 37a1145410 of 2022-10-19
  "Rename all exported itree.h functions with the itree_ prefix"

Further, some values still referenced in commentary were removed in
commits:

  2. 258e618364 of 2022-10-17
  "Delete the itree_null sentinel node, use NULL everywhere."
  3. 2c4a3910b3 of 2022-10-02
  "itree: Use a single iterator object"

* src/emacs.c (main): Allocate global itree iterator once and for
all.
* src/alloc.c (mark_overlay):
* src/buffer.c (set_overlays_multibyte):
* src/itree.c (itree_destroy): Update commentary.
(interval_stack_ensure_space, itree_insert_gap): Prefer
unsigned-to-unsigned comparisons over signed-to-unsigned.
(interval_stack_push_flagged, interval_tree_insert)
(interval_tree_contains, itree_iterator_start)
(itree_iterator_finish, itree_iterator_next, itree_iterator_narrow):
Improve assertions.
(itree_init): Rename...
(init_itree): ...to this, for consistency with other global init
functions.
(itree_create): Stop leaking a global iterator allocation on each
call.
(interval_tree_init): Complete renames of
interval_tree -> itree_tree and interval_tree_clear -> itree_clear.
(interval_tree_remove_fix): Fix indentation.
* src/itree.h: Declare init_itree.
(ITREE_FOREACH): Fix typo in commentary.

* src/pdumper.c [CHECK_STRUCTS]
(dump_interval_node): Use the correct name in the HASH condition
and #error message.
(dump_overlay, dump_buffer): Update HASH (bug#58975).
2022-11-03 16:49:05 +02:00
Juanma Barranquero
8b8038494c * src/gnutls.c (Fgnutls_available_p): Avoid duplicating capabilities. 2022-11-03 14:43:27 +01:00
Po Lu
eb8478c514 Further simplify valuator reset code
* src/xterm.c (xi_reset_scroll_valuators_for_device_id): Minor
style adjustments.
(handle_one_xevent): Don't check frames; reset on all XI_Enter
and XI_Leave events.
2022-11-03 19:27:29 +08:00
Po Lu
9909652849 More style fixes to tree-sitter code
* src/treesit.c (treesit_node_uptodate_p):
* src/treesit.h: Fix coding style.
2022-11-03 19:14:16 +08:00
Po Lu
6b91ea5a61 Minor fixes to last tree-sitter change
* src/treesit.c (treesit_find_override_name): Initialize
variable.
(Ftreesit_query_expand): Revert change to behavior.
2022-11-03 19:13:33 +08:00
Po Lu
bd8e19e1e2 Stylistic changes to tree-sitter code
* src/treesit.c (treesit_find_override_name)
(treesit_load_language_push_for_each_suffix, treesit_load_language)
(Ftreesit_langauge_available_p, treesit_record_change)
(make_treesit_parser, make_treesit_node, make_treesit_query)
(Ftreesit_parser_create, Ftreesit_parser_delete, Ftreesit_parser_list)
(treesit_check_range_argument, Ftreesit_parser_included_ranges)
(Ftreesit_node_start, Ftreesit_node_end, Ftreesit_node_check)
(Ftreesit_node_child_by_field_name, Ftreesit_pattern_expand)
(Ftreesit_query_expand, treesit_predicates_for_pattern)
(treesit_predicate_capture_name_to_text, treesit_predicate_equal)
(treesit_predicate_match, treesit_eval_predicates)
(Ftreesit_query_capture, treesit_search_dfs, treesit_build_sparse_tree)
(syms_of_treesit): Use FOR_EACH_TAIL (or FOR_EACH_TAIL_SAFE where not
obviously safe), and check list heads and tails correctly; fix coding
style of various constructs, especially:

  variable =
    mumble (frob (bar), (foo () + bar ()) + (baz () + quux ()))

which should actually be

  variable
    = mumble (frob (bar), (foo () + bar ()) + (baz () + quux ()))

and

  foo =
    mumble (frob (bar), 0)
      + (foo () + bar ())
      + (baz () + quux ())

which should actually be

  foo = (mumble (frob (bar), 0)
	 + (foo () + bar ())
	 + (baz () + quux ()))

* src/treesit.h: Make declaration coding style consistent.
2022-11-03 19:13:33 +08:00
Yuan Fu
88d54756d4
Check for outdated tree-sitter node when printing
* src/print.c (print_vectorlike): Check for outdated node.
* src/treesit.c (treesit_check_node): Use the new function.
(treesit_node_uptodate_p): New function.
* src/treesit.h: Declare new function.
2022-11-02 17:47:14 -07:00
Yuan Fu
32e87f09c8
; * src/print.c (print_vectorlike): Fix comment for tree-sitter. 2022-11-02 17:23:29 -07:00
Paul Eggert
05f5d978ae Initialize child signal handling before posix_spawn too.
Problem reported by Tino Calancha (Bug#58960).
* src/callproc.c (call_process): Initialize SIGCHLD handling
before possibly creating a child with emacs_span.  This need not
be in the critical section that calls emacs_spawn, so do it
outside the critical section.
* src/process.c (child_signal_init): Now extern.
2022-11-02 13:25:11 -07:00
Po Lu
a5d4c29a7f Improve commentary in some parts of xterm.c
* src/xterm.c (x_probe_xfixes_extension): Rename to
`x_fixes_pointer_blanking_supported', as fixes is now used for
selection tracking as well.  All callers changed.
(x_focus_changed): Document where this code is used.
2022-11-02 18:27:48 +08:00
Paul Eggert
840b9eadd6 Remove unused local in simple_search
* src/search.c (simple_search): Remove unused local.
2022-11-01 23:04:00 -07:00
Stefan Monnier
8a5678906f src/buffer.c: Fix interaction between overlays & indirect buffers (bug#58928)
* src/buffer.c (adjust_overlays_for_insert)
(adjust_overlays_for_delete): Repeat for all buffers sharing the same text.

* src/itree.c (itree_insert_gap, itree_delete_gap): Allow an empty tree.

* test/src/buffer-tests.el (buffer-tests--overlays-indirect-bug58928):
New test.
2022-11-01 21:39:12 -04:00
Yuan Fu
ccd2509ed3
Don't print buffer when printing tree-sitter node and parser
Additionally, print node's position in buffer.

* doc/lispref/parsing.texi (Retrieving Node): Reflect this change in
manual.
* src/print.c (print_vectorlike): Remove printing of buffer, add
printing of node position.
2022-11-01 12:54:56 -07:00
Po Lu
e39537ea1e * src/xterm.c (x_term_init): Fix last change. 2022-11-01 19:20:15 +08:00
Po Lu
eb68c3d5a2 Fix leak on Lucid build
* src/xterm.c (x_term_init): Rectify wrong fix for bug#18403.
2022-11-01 19:20:15 +08:00
Stefan Kangas
123baf3772 Merge from origin/emacs-28
1862df834c ; * src/search.c (Fmatch_data): Doc fix.
15fc5225b1 ; * lisp/whitespace.el (whitespace-trailing): Fix a typo.
9f3c896f7c ; * doc/emacs/text.texi (Quotation Marks): Typo fix.  (Bug...

# Conflicts:
#	src/search.c
2022-11-01 10:30:09 +01:00
Gerd Möllmann
d305eaf4ce Preven a buffer-overflow (bug#58850)
* src/print.c (print_vectorlike): Don't use sprintf.
2022-11-01 10:14:07 +01:00
Po Lu
ecdbf82cb9 Fix leaks of XImage structures in image.c
* src/image.c (image_clear_image, lookup_image): Fix coding
style.
(x_destroy_x_image): Remove unnecessary assertion.  Call
XDestroyImage, since otherwise only the image data is freed.
(image_from_emacs_colors): Rename variables to make more sense.
2022-11-01 12:54:03 +08:00
Yuan Fu
4ef50ccd3f
; Explain the BEG and END argument in treesit-query-capture better
* doc/lispref/parsing.texi (Pattern Matching): Update manual.
* src/treesit.c (Ftreesit_query_capture): Update docstring.
2022-10-31 15:35:52 -07:00
Eli Zaretskii
1862df834c ; * src/search.c (Fmatch_data): Doc fix. 2022-10-30 19:57:14 +02:00
Philip Kaludercic
2a4f37fe52 Merge remote-tracking branch 'origin/master' into feature/package+vc 2022-10-30 18:45:37 +01:00