1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-21 12:03:55 -08:00
Commit graph

47166 commits

Author SHA1 Message Date
Yuan Fu
eba6582436
Add the treesit-search functions that supplant the removed ones
The signatures also changed.

treesit-traverse-depth-first   -> treesit-search-subtree
treesit-traverse-breadth-first ->
treesit-traverse-forward       -> treesit-search-forward
treesit-search-forward         -> treesit-search-forward-goto
treesit-search-beginning/end   -> treesit-search-forward-goto
                               -> treesit-induce-sparse-tree

* doc/lispref/parsing.texi (Retrieving Node): Add relevant manual
sections.
* lisp/treesit.el (treesit-search-forward-goto): New function.
* src/treesit.c (ts_traverse_sibling_helper)
(ts_traverse_match_predicate)
(ts_search_dfs)
(ts_search_forward)
(treesit-search-subtree)
(treesit-search-forward)
(ts_build_sparse_tree)
(Ftreesit_induce_sparse_tree): Add functions.
* test/src/treesit-tests.el (treesit-node-supplemental): Add comments.
2022-09-24 21:11:30 -07:00
Yuan Fu
17422c2cfc
; * src/treesit.c (Ftreesit_node_field_name_for_child): Doc fix. 2022-09-24 21:11:30 -07:00
Yuan Fu
b584569014
Change make_string to build_string in treesit.c
* src/treesit.c (Ftreesit_node_string)
(Ftreesit_node_field_name_for_child): Change make_string to
build_string.
2022-09-24 21:11:29 -07:00
Yuan Fu
08a1c32d0b
Improve printing treesit nodes
* src/print.c (print_vectorlike): Instead of position, print the type
of the node.
2022-09-24 21:11:29 -07:00
Yuan Fu
361eaae71e
Improve treesit-query-capture
* src/treesit.c (Ftreesit_query_capture): Add a suggestion in the
signal message.
2022-09-20 18:36:52 -07:00
Yuan Fu
55e01229da
Rename treesit-expand-query/pattern
* src/treesit.c (treesit-expand-pattern): Rename to
treesit-patter-expand.
(treesit-expand-query): Rename to treesit-query-expand.
(make_ts_query): Use new name.
2022-09-20 18:36:49 -07:00
Yuan Fu
1d3234988a
Add node-only parameter to treesit-query-capture
* doc/lispref/parsing.texi (Pattern Matching): Mention the new
parameter.
* lisp/treesit.el (treesit-query-in): Add node-only.
* src/treesit.c (Ftreesit_query_capture): Add node-only.
2022-09-08 12:52:25 -07:00
Yuan Fu
77d5a0cf9f Merge remote-tracking branch 'origin/master' into feature/tree-sitter 2022-08-29 11:41:10 -07:00
Po Lu
d704c61e25 Fix two issues in xterm.c
* src/xterm.c (x_atom_refs): Make EMACS_SERVER_TIME_PROP atom
have a vendor-specific prefix.
(x_query_pointer_1): Fix leak of button mask.
2022-08-28 12:02:43 +08:00
Juri Linkov
3f076a8e44 Use truncated-partial-width-window-p in more places (bug#56815)
* lisp/simple.el (line-move, line-move-finish):
Use truncated-partial-width-window-p.

* lisp/window.el (count-screen-lines, scroll-command--goto-goal-column):
Use truncated-partial-width-window-p.
(truncated-partial-width-window-p): Replace window-width with
window-total-width.

* src/indent.c (scan_for_column): Bring the logic of using
truncated-partial-width-window-p closer to what the display engine does.
2022-08-27 22:52:03 +03:00
Eli Zaretskii
6b1ed2f2c9 Fix antialias face attribute when text is scaled
This restores the code we had in realize_gui_face before commit bf0d3f7.
The problem described in bug#17973, which led to that commit, only
happens if one uses a specific (misc-fixed) font family, not for
the usual default fonts used by Emacs, and I'm not sure what's
described there is a bug at all.  At least for the purposes of
text-scale-adjust, it makes no sense to ignore the
foundry/family/adstyle of the original font, because we _want_ the
same (or very similar) font, just of a different size.

And likely in other use cases: if the :font attribute of a face
specifies some font properties, we want to keep them all, not
arbitrarily to ignore some of them.  And definitely catering to an
obscure use case such as the one cited in bug#17973 is NOT a good
reason to make such radical changes in face-realization behavior.

So I think backing out that part of commit bf0d3f7 is TRT, and if
we decide that this causes bug#17973 in too many situations we care
about, I'd rather find a kludge for that specific case than do that
for every face realization.
* src/xfaces.c (realize_gui_face): Preserve face attributes when
text is scaled.  This reverts part of the changes installed in
commit bf0d3f7.  (Bug#37473)
2022-08-27 13:13:48 +03:00
Eli Zaretskii
56aa52c346 Support "replacement characters" on TTY frames
* src/nsterm.m (ns_draw_glyphless_glyph_string_foreground):
* src/pgtkterm.c (pgtk_draw_glyphless_glyph_string_foreground):
* src/haikuterm.c (haiku_draw_glyphless_glyph_string_foreground):
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
* src/w32term.c (w32_draw_glyphless_glyph_string_foreground):
* src/xdisp.c (lookup_glyphless_char_display): Handle extra-slot
of 'glyphless-char-display' that is a cons cell.
(syms_of_xdisp) <glyphless-char-display>: Update doc string.

* etc/NEWS:
* doc/lispref/display.texi (Glyphless Chars): Document the new
feature.

* lisp/faces.el (glyphless-char): Make the face stand out on TTY
frames that don't support the underline attribute.
2022-08-27 11:56:00 +03:00
Po Lu
4015d561c3 Fix crash when handling "swallowed" generic events
* src/xmenu.c (x_menu_translate_generic_event, x_menu_show):
Pass through more events, correctly.
* src/xterm.c (handle_one_xevent): Don't abort if must_free_data
and xi_event is NULL; this is an Xlib bug.
2022-08-27 09:54:19 +08:00
Po Lu
8cad97e3db Restore old code in x_sync_trigger_fence
* src/xterm.c (x_sync_trigger_fence): Restore old code, since that
makes it easier to adapt to more than 2 sync fences (which might be
necessary in the future, if we ever decide to do frame handling
asynchronously), and is much more recognizable for people coming from
other programs.
2022-08-26 09:42:35 +08:00
Po Lu
7ffac97f49 ; * src/xterm.h (struct x_display_info): Update comment. 2022-08-26 09:37:47 +08:00
Paul Eggert
9bd91a3751 Fix overflows in HAVE_XSYNC timestamp handling
Also, port to platforms lacking CLOCK_MONOTONIC and int64_t, and
use 0 more consistently to represent missing timestamps.
* src/xterm.h (struct x_display_info):
Omit server_time_monotonic_p and server_time_offset if
!HAVE_CLOCK_GETTIME since they are unused in that case.
* src/xterm.h (struct x_display_info, struct x_output):
* src/xterm.c (x_sync_get_monotonic_time)
(x_sync_current_monotonic_time, x_sync_note_frame_times):
Use int_fast64_t instead of int64_t as POSIX doesn't
guarantee the latter.  Similarly for uint_fast64_t.
(x_sync_get_monotonic_time, x_sync_current_monotonic_time)
(x_sync_note_frame_times, x_display_set_last_user_time):
Check for integer overflow in time arithmetic.
(CLOCK_MONOTONIC): Define to CLOCK_REALTIME if absent.
(x_sync_current_monotonic_time): Check for clock_gettime failure
and fall back on CLOCK_REALTIME if CLOCK_MONOTONIC does not work,
which POSIX allows.
(x_sync_current_monotonic_time, x_sync_note_frame_times)
(x_display_set_last_user_time):
Use 0 more consistently to represent missing timestamps.
2022-08-25 18:30:11 -07:00
Kien Nguyen
34e0a232cd Allow symlink creation on MS-Windows without Administrator privileges
* src/w32.c (symlink): Use the
SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag when available.
(Bug#57386)
2022-08-25 16:18:58 +03:00
Po Lu
34686263b7 Fix various problems with mouse highlight on XI2 builds
* src/dispextern.h (reset_mouse_highlight): Fix coding style.
* src/xterm.c (xi_position_changed): New functions.
(xi_report_motion_window_clear, handle_one_xevent): Don't report
motion events if the pixel position did not actually change.

* src/xterm.h (struct xi_device_t): New fields
`last_motion_window', `last_motion_x' and `last_motion_y'.
2022-08-25 12:24:34 +08:00
Po Lu
e518146a30 Fix input extension focus tracking with some window managers
* src/xterm.c (handle_one_xevent): If a window manager sends us
FocusIn and FocusOut with XSendEvent (they do that), don't
detect focus changes when XInput 2 is enabled.  The X server
will tell us the actual truth if the focus really did change.
2022-08-24 19:12:16 +08:00
Eli Zaretskii
b48bf42fc2 ; * src/buffer.h (struct buffer_text): Improve commentary. 2022-08-23 19:30:18 +03:00
Gregory Heytings
1c837c42c2 Improve detection of long lines.
* src/buffer.h (struct buffer_text): New field.
(BUF_CHARS_UNCHANGED_MODIFIED, CHARS_UNCHANGED_MODIFIED): New macros.

* src/buffer.c (Fget_buffer_create): Initialize the new field.

* src/xdisp.c (mark_window_display_accurate_1): Set the new field.
(redisplay_window): Use it, together with CHARS_MODIFF, instead of
MODIFF and UNCHANGED_MODIFIED to decide whether to check for long
lines.

* src/pdumper.c (dump_buffer): Dump the new field.
2022-08-23 17:48:51 +02:00
Po Lu
76982f0868 ; * src/xterm.c (x_free_frame_resources): Fix typo. 2022-08-23 20:56:12 +08:00
Po Lu
a328bf65ef Make frame synchronization conditional on clock_gettime
* src/xfns.c (x_set_parent_frame)
(x_set_use_frame_synchronization):
* src/xterm.c (x_update_begin, show_back_buffer, x_update_end)
(x_display_set_last_user_time, handle_one_xevent):
* src/xterm.h (struct x_output): Define out vsync code when
!HAVE_CLOCK_GETTIME.  (bug#57346)
2022-08-23 20:53:24 +08:00
Po Lu
3b7fb723e6 Make frame synchronization conditional on clock_gettime
* src/xfns.c (x_set_parent_frame)
(x_set_use_frame_synchronization):
* src/xterm.c (x_update_begin, show_back_buffer, x_update_end)
(x_display_set_last_user_time, handle_one_xevent):
* src/xterm.h (struct x_output): Define out vsync code when
!HAVE_CLOCK_GETTIME.
2022-08-23 20:53:24 +08:00
Po Lu
e425b7d231 Allow disabling the input extension at runtime on GTK 3
* src/xterm.c (xi_check_toolkit): New function.
(x_term_init): Do not enable the input extension should that
fail.
2022-08-23 09:30:25 +08:00
Lars Ingebrigtsen
cc33c6cf3a Make start/end in libxml-parse-html-region optional
* doc/lispref/text.texi (Parsing HTML/XML): Adjust.

* src/xml.c (parse_region): Default start/end to point-min/point-max.
(Flibxml_parse_html_region, Flibxml_parse_xml_region): Make
start/end optional.
2022-08-22 12:48:37 +02:00
Po Lu
e154ba196a Fix child frame focus for MPX environments
* src/xterm.c (handle_one_xevent): Set child frame click-to
focus on the pointer device's attachment.
2022-08-22 09:50:45 +08:00
Lars Ingebrigtsen
fe194f179d Remove a newline from the end of an error message
* src/pdumper.c (dump_native_comp_unit): Remove newline from end
of error message.
2022-08-21 18:01:40 +02:00
Mattias Engdegård
563ec6abc4 ; Complete renaming to pos-bol and pos-eol 2022-08-21 16:18:03 +02:00
Eli Zaretskii
982bd69520 ; * src/xterm.c (handle_one_xevent): Avoid compiler warning. 2022-08-21 16:12:03 +03:00
Lars Ingebrigtsen
2614e53216 Rename newly-added eol/bol functions to pos-eol/pos-bol
* lisp/emacs-lisp/shortdoc.el (buffer):
* doc/lispref/positions.texi (Text Lines): Adjust.
* src/editfns.c (Fpos_bol): Rename from Fpos.
(Fpos_eol): Rename from Feol.
2022-08-21 14:04:52 +02:00
Po Lu
8d4789c072 Minor optimization to x_query_pointer_1
* src/xterm.c (x_query_pointer_1): Clear client pointer if it
disappeared.
2022-08-21 14:06:22 +08:00
Po Lu
b2f9c4c6d4 Fix crash when the keymap changes
* src/xterm.c (handle_one_xevent): Call
XkbRefreshKeyboardMapping first before trying to update the map.
2022-08-20 10:32:09 +08:00
Stefan Kangas
043ae1f53a Delete two functions obsolete since Emacs 23
These were announced as removed in Emacs 28.1 NEWS, but apparently
never actually deleted: only their obsoletion warning was removed.
So the warnings were reintroduced in Emacs 28.2, and we now actually
delete them here instead.

* src/process.c (Fset_process_filter_multibyte)
(Fprocess_filter_multibyte_p): Delete functions obsolete since
Emacs 23.
(syms_of_process): Delete corresponding defsubrs.
* lisp/subr.el (process-filter-multibyte-p)
(set-process-filter-multibyte): Delete obsoletion.
* lisp/erc/erc-dcc.el (erc-dcc-server): Don't use obsolete functions.
2022-08-19 17:57:42 +02:00
Stefan Kangas
d0bb333efc Merge from origin/emacs-28
f2c0fb2615 Resurrect obsoletion warning for two functions
9c0eec4ed8 * src/window.c (select_window): Fix assert for buffer = no...
16dfe04be2 Find libgccjit on macOS with Homebrew differently

# Conflicts:
#	etc/NEWS
2022-08-19 17:30:18 +02:00
Alan Mackenzie
9c0eec4ed8 * src/window.c (select_window): Fix assert for buffer = non-active minibuffer 2022-08-19 15:06:38 +00:00
Robert Pluim
7c793c55cf Improve 'ns-read-file-name' docstring
* src/nsfns.m (Fns_read_file_name): Use '-' instead of '_' when naming
args.
2022-08-19 16:05:40 +02:00
Eli Zaretskii
6a1e3e8684 ; * src/editfns.c (Fline_beginning_position): Remove redundant parens. 2022-08-19 16:55:19 +03:00
Lars Ingebrigtsen
f117b5df4d Add new functions eol and bol
* doc/lispref/positions.texi (Text Lines): Document them
* lisp/emacs-lisp/shortdoc.el: Mention them, and also the
buffer/line predicates.

* src/editfns.c (bol): New function.
(Fbol): New defun.
(Fline_beginning_position): Use `bol'.
(eol): New function.
(Feol): New defun.
(Fline_end_position): Use `eol'.
2022-08-19 15:22:36 +02:00
Andrea Corallo
5dc2745939 * src/pdumper.c (dump_native_comp_unit): Error if CU is not fixed-up 2022-08-19 10:22:32 +02:00
Andrea Corallo
9297a9c45e * src/alloc.c (pure_alloc): Warn for pure space overflow 2022-08-19 10:09:38 +02:00
Andrea Corallo
095ea82120 * src/pdumper.c (Fdump_emacs_portable): Check and warn for pure space overflow 2022-08-19 10:09:38 +02:00
Po Lu
b90192b50e Fix more calls to XQueryPointer for MPX
* src/xterm.c (x_dnd_begin_drag_and_drop): Set DND devices to -1
if XI2 is not supported on the given display.
(x_query_pointer): Make wrapper around x_query_pointer_1.
(x_query_pointer_1): Split off most of x_query_pointer to this
function.  Allow a specific client pointer to be specified.
(x_dnd_update_tooltip_now, x_dnd_update_state): Use
x_query_pointer_1 with the right device instead of
XQueryPointer.
2022-08-19 10:06:29 +08:00
Mattias Engdegård
f33a429a53 Copy-edit doc strings and comments wrt bignum and fixnum
Don't say that a value is a fixnum if small enough and a bignum
otherwise, because that is now how Lisp integers always work,
and we generally don't expose the fixnum/bignum difference to the user
unless really necessary.

* src/charset.c (Fencode_char):
* src/editfns.c (Fuser_uid, Fuser_real_uid, Fgroup_gid)
(Fgroup_real_gid, Femacs_pid):
* src/font.c (Ffont_variation_glyphs):
* src/process.c (Fprocess_id):
Edit doc strings.
* src/pgtkselect.c:
* src/xselect.c: Edit comments.
2022-08-18 17:10:46 +02:00
Andrea Corallo
aea05a5dec * Expose `comp-loaded-comp-units-h'
* src/comp.c : remove 'all_loaded_comp_units_h'.
(syms_of_comp): Define `comp-loaded-comp-units-h'.
(register_native_comp_unit, Fnative_elisp_load): Use it.
2022-08-18 11:03:25 +02:00
Yuan Fu
f543a1ca0e Add treesit-parser-delete
* src/treesit.c (ts_record_change): Replace CHECK_TS_PARSER with
ts_check_parser.
(make_ts_parser): Initialize deleted field.
(Ftreesit_parser_delete): Replace CHECK_TS_PARSER with
ts_check_parser. Set deleted field.
(Ftreesit_parser_buffer, Ftreesit_parser_language): Replace
CHECK_TS_PARSER with ts_check_parser.
(ts_check_parser): New function.
(Ftreesit_parser_root_node, Ftreesit_parser_set_included_ranges)
(Ftreesit_parser_included_ranges): Replace CHECK_TS_PARSER with
ts_check_parser.
(Qtreesit_parser_deleted): New symbol.
(Qtreesit_parser_deleted): New error.
* src/treesit.h (Lisp_TS_Parser): New field 'deleted'.
2022-08-18 01:56:48 -07:00
Paul Eggert
7406ae4c98 Fix broken build on Solaris 10 emacs_spawn
* src/callproc.c (emacs_spawn) [SETUP_SLAVE_TTY]:
pty_flag no longer exists.  Use pty_in && std_in >= 0,
which at least compiles.
2022-08-17 23:12:55 -07:00
Po Lu
d0e126b6ed ; * src/xterm.c (xi_select_hierarchy_events): Fix typo. 2022-08-18 10:32:49 +08:00
Po Lu
79050eeeaf ; * src/xterm.c (xi_select_hierarchy_events): Fix typo. 2022-08-18 10:32:24 +08:00
Po Lu
ed9adafc0b Avoid disabling device multiple times while handling XI attachment events
* src/xterm.c (handle_one_xevent): Avoid disabling devices if we
notice it has been disabled while handling XISlaveDetached or
XISlaveAttached.
2022-08-17 10:20:25 +08:00