1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 19:31:02 -08:00
Commit graph

47790 commits

Author SHA1 Message Date
Eli Zaretskii
b3847c0208 ; Minor cleanup in treesit.c
* src/treesit.c (Ftreesit_query_capture)
(Ftreesit_parser_set_included_ranges): Minor cleanups.
2022-12-06 19:28:02 +02:00
Eli Zaretskii
ed4734405d Avoid crashes in a build --without-modules
* src/lread.c (syms_of_lread): Move the definitions of
'dynamic-library-suffixes' outside of the HAVE_MODULES
conditional.  (Bug#59832)
2022-12-06 17:15:35 +02:00
Mattias Engdegård
9b9b39a2d8 Lisp reader undefined behaviour excision
* src/lread.c (read_bool_vector, skip_lazy_string):
Replace `|` with `||` to explicitly introduce sequence points since
the variables, `length` and `nskip`, are mutated more than once.

The `|` was just a weak attempt at micro-optimisation in any case;
sorry about that.
2022-12-06 12:13:18 +01:00
Yuan Fu
c26fe45cb8
Fix treesit-query-capture
Before this change Ftreesit_query_capture doesn't convert character
position to byte position for BEG and END parameters.  I observed
fontification issue in css files but couldn't figure out why, now I
know :-)

I decide to keep treesit--font-lock-query-expand-range, since it might
provide a escape hatch for problems we discover in the future, and it
should be very cheap so no downside of keeping it.

* lisp/textmodes/css-mode.el (css-ts-mode): Stop setting
treesit--font-lock-query-expand-range.
* lisp/treesit.el (treesit--font-lock-query-expand-range): Update
docstring.
* src/treesit.c (Ftreesit_query_capture): Convert BEG and END to byte
position.  Also added parentheses wround "beg_byte - visible_beg" in
the call to ts_query_cursor_set_byte_range (i.e., style change).
2022-12-05 19:56:47 -08:00
Kai Ma
029988d4a5 Prevent a segfault when deleting a fullscreen frame on NextStep.
* nsterm.m ([EmacsView resetCursorRects:]): Be defensive when
accessing FRAME_OUTPUT_DATA.  [resetCursorRects:] can be called
from the event loop after the frame is deleted.  When this
happens, emacsframe is NULL.  This means there is an underlying
leak of the EmacsView object!  (Bug#59794)
Do not merge to master.

Copyright-paperwork-exempt: yes
2022-12-04 14:50:04 +02:00
Stefan Kangas
a0dd9fdebe ; Add cross-reference to string-equal docstring
* lisp/subr.el (string-equal-ignore-case):
* src/fns.c (Fstring_equal): Doc fix; add cross-references.
2022-12-03 11:32:23 +01:00
Eli Zaretskii
368c7c7d8e Improve detection of very long lines
* src/xdisp.c (redisplay_window): Recheck for long lines if the
restriction has changed.  (Bug#56682)
2022-12-02 00:07:53 +02:00
Stefan Kangas
70ecdebc92 ; Fix typos (don't abbreviate "with" or "without") 2022-12-01 16:36:09 +01:00
Po Lu
4161023a63 Fix crashes and memory leaks during display deinitialization
* .dir-locals.el (c-mode): Add more noise macro names.
* src/frame.c (delete_frame): Do not delete terminal if force is
Qnoelisp.

* src/xterm.c (x_wm_supports): Fix coding style.
(x_delete_display): Delete the supported atoms list.
(x_delete_terminal): Delete all terminals.  Free the scratch
cursor GC.
2022-12-01 14:23:04 +08:00
Daniel Martín
a699f65936 Fix typo in flag to load Emacs-specific LLDB commands
* src/.lldbinit: Fix typo in flag to parse .lldbinit files from the
current directory.  (Bug#59702)
2022-11-29 23:45:59 +01:00
Yuan Fu
f794263da2
Reparse tree-sitter tree when buffer restriction changes
* src/treesit.c (treesit_sync_visible_region): Set nee_reparse flag to
true if buffer range changes.  Add some assertion.

* src/treesit.c (treesit_ensure_parsed): Move
treesit_sync_visible_region in front of the check for need_reparse.
2022-11-28 14:34:12 -08:00
Gregory Heytings
56ab6203fa Do not enter locked narrowing when it would span the whole buffer
* src/xdisp.c (handle_fontified_prop):
* src/keyboard.c (safe_run_hooks_maybe_narrowed): Add condition.
2022-11-28 02:22:02 +01:00
Gregory Heytings
6d3cea2c8e Minor improvements to locked narrowing
* src/xdisp.c (get_locked_narrowing_begv)
(get_locked_narrowing_zv): Safer handling of negative values.
(handle_fontified_prop): Do not use locked narrowing if the region
size is <= 0.

* src/keyboard.c (safe_run_hooks_maybe_narrowed): Do not use
locked narrowing if the region size is <= 0.
2022-11-27 23:53:51 +01:00
Gregory Heytings
849223fba1 Merge branch 'feature/improved-locked-narrowing' 2022-11-27 22:19:41 +01:00
Eli Zaretskii
eaa823b9d6 ; * src/treesit.c (Ftreesit_parser_included_ranges): Doc fix. 2022-11-27 19:08:18 +02:00
Stefan Kangas
a175c42b3a ; Fix typo (Bug#59634)
* src/treesit.c (Ftreesit_parser_included_ranges): Fix typo.
2022-11-27 18:03:11 +01:00
Michael Albinus
1cbf2655db Extend memory-info for remote systems
* doc/lispref/files.texi (Magic File Names): Add memory-info.

* doc/lispref/internals.texi (Garbage Collection): memory-info can
also retrieve values from remote systems.

* etc/NEWS: Document changes in memory-info.  Fix typos.

* lisp/files.el (warn-maybe-out-of-memory): Ensure local memory info.

* lisp/net/tramp.el (tramp-handle-memory-info): New defun.
(tramp-file-name-for-operation)
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist)
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add 'memory-info'.

* lisp/net/tramp-sshfs.el (tramp-sshfs-handle-exec-path):
Let-bind `process-file-side-effects'.

* src/alloc.c (Fmemory_info): Support remote systems.
(Qmemory_info): Declare.

* test/lisp/net/tramp-tests.el (tramp-test31-memory-info): New test.
2022-11-27 16:57:03 +01:00
Po Lu
80bfd6dc5b Make frame synchronization more robust
* src/xterm.c (x_sync_wait_for_frame_drawn_event)
(x_sync_handle_frame_drawn): Only cancel frame synchronization
if hanging twice or more in a row.
* src/xterm.h (struct x_output, FRAME_X_DRAW_JUST_HUNG): New
flag.
2022-11-27 19:21:03 +08:00
Gregory Heytings
18fa159fa9 ; * src/xdisp.c (get_locked_narrowing_begv): Minor change. 2022-11-27 11:26:24 +01:00
Eli Zaretskii
8cda625b22 ; * src/treesit.c (Ftreesit_induce_sparse_tree): Doc fix. 2022-11-27 10:10:05 +02:00
Gregory Heytings
914b7903ad ; * src/editfns.c: Minor improvements in comments. 2022-11-27 02:02:47 +01:00
Gregory Heytings
bf4373f90a Simplify narrowing_locks_restore
* src/editfns.c (narrowing_locks_restore): Simplify.
2022-11-27 01:53:31 +01:00
Gregory Heytings
1d1a83ba56 Improve handling of killed buffers in locked narrowings
* src/editfns.c (narrowing_locks_add, narrowing_locks_remove):
New functions, factored out.
(narrowing_lock_push, narrowing_lock_pop)
(narrowing_locks_restore): Use the new functions.
(narrowing_lock_get_bound): Return NULL for killed buffers.
(reset_outermost_narrowings, unwind_reset_outermost_narrowing):
Remove killed buffers from the 'narrowing_locks' alist.
2022-11-27 01:27:05 +01:00
Yuan Fu
cc086f37e8
Add default limit for tree-sitter recursive tree-traversing function
This fixes bug#59426.

* src/treesit.c (treesit_search_dfs)
(treesit_build_sparse_tree): Remove no_limit parameter.
(Ftreesit_search_forward, Ftreesit_induce_sparse_tree): Use default
limit of 1000.

* doc/lispref/parsing.texi (Retrieving Nodes): Update manual.
2022-11-26 15:40:24 -08:00
Gregory Heytings
321d4e6155 Minor improvements for locked narrowing
* src/editfns.c (narrowing_lock_pop): Clarify comment, replace
assertion by return.
(narrowing_locks_restore): Add comments.

* lisp/subr.el (with-narrowing, internal--with-narrowing):
Simplify, use a single helper function with an optional argument.
2022-11-26 23:38:40 +01:00
Gregory Heytings
1bf0b72eb7 Docstring improvements
* src/xdisp.c (syms_of_xdisp):
* src/keyboard.c (syms_of_keyboard):
Docstring improvements.
2022-11-26 17:38:06 +01:00
Gregory Heytings
4b5e31bf02 Docstring improvements
* src/xdisp.c (syms_of_xdisp):
* src/keyboard.c (syms_of_keyboard):
* src/buffer.c (syms_of_buffer):
Docstring improvements.
2022-11-26 17:30:31 +01:00
Gregory Heytings
2ea4f97847 Further improvements to narrowing locks
* src/editfns.c:
(narrowing_lock_get_bound): Return a pointer to a struct
Lisp_Marker instead of a character position.  Suggested by Eli
Zaretskii.
(reset_outermost_narrowings, unwind_reset_outermost_narrowing)
(Fwiden, Fnarrow_to_region): Adapt accordingly.
(narrowing_lock_peek_tag, narrowing_lock_push)
(narrowing_lock_pop, narrowing_locks_save)
(narrowing_locks_restore): Use XCAR/XCDR/XSETCAR instead of
Fcar/Fcdr/Fsetcar.
2022-11-26 17:13:53 +01:00
Eli Zaretskii
d440ca47ed ; * src/treesit.c: Fix typos and wording in comments. 2022-11-26 17:50:36 +02:00
Gregory Heytings
558084c7f7 Improve locked narrowing around low-level hooks.
* src/buffer.c (syms_of_buffer): Two new variables,
'long-line-locked-narrowing-region-size' and
'long-line-locked-narrowing-bol-search-limit', to make the locked
narrowing around low-level hooks configurable.

Increase the default value of 'long-line-threshold'.  After
carefully considering the (few) bug reports about long line
optimizations, I concluded that the previous default value was too
low.

* src/xdisp.c (get_locked_narrowing_begv)
(get_locked_narrowing_zv): Two new functions.
(handle_fontified_prop, reseat): Use them.

* src/keyboard.c (safe_run_hooks_maybe_narrowed): Use them.

* src/dispextern.h (struct it): Add two new fields to store the
values returned by these functions.
Make them externally visible.

* src/editfns.c: (Fsave_restriction): Update docstring.
2022-11-26 15:10:17 +01:00
Po Lu
5281e85513 Reduce wasted cycles in x*.c
* src/xfns.c (compute_tip_xy, Fx_show_tip):
* src/xselect.c (x_own_selection, x_get_local_selection)
(x_clear_frame_selections): Call CAR and CDR, not Fcar and Fcdr.
2022-11-26 18:58:25 +08:00
Yuan Fu
0369dcacf3
Fix tree-sitter assertion error (bug#59574)
* src/treesit.c (treesit_sync_visible_region): Initialize
visible_beg/end when tree is NULL.
2022-11-25 19:00:22 -08:00
Yuan Fu
4ffca85f1e
Rename treesit_ensure_position_synced to treesit_sync_visible_region
* src/treesit.c: Rename to better convey the purpose of the function.
2022-11-25 19:00:22 -08:00
Yuan Fu
245366b18a
; Add comments in treesit.c and treesit.h
* src/treesit.c
* src/treesit.h: Add (and fix) comments.
2022-11-25 19:00:22 -08:00
Po Lu
123e90f6d3 Fix no-accept-focus handling for embedded frames
* src/xterm.c (handle_one_xevent): Don't focus embedded frames
on click if they have `no-accept-focus' set.
2022-11-26 08:47:25 +08:00
Gregory Heytings
16b8b0d1e0 Save and restore narrowing locks in 'save-restriction'.
* src/editfns.c: (Fsave_restriction): Save and restore narrowing
locks.  Suggested by Stefan Monnier.
(narrowing_locks_save, narrowing_locks_restore): Helper functions.

* lisp/subr.el (with-narrowing-1): Simplify.
2022-11-26 01:33:07 +01:00
Gregory Heytings
9dee6df39c Reworked locked narrowing.
* src/editfns.c: (narrowing_locks): New alist to hold the narrowing
locks and their buffers.
(narrowing_lock_get_bound, narrowing_lock_peek_tag)
(narrowing_lock_push, narrowing_lock_pop): New functions to access
and update 'narrowing_locks'.
(reset_outermost_narrowings, unwind_reset_outermost_narrowing):
Functions moved from src/xdisp.c, and rewritten with the above
functions.
(Fwiden): Use the above functions. Update docstring.
(Fnarrow_to_region, Fnarrowing_lock, Fnarrowing_unlock): Use the above
functions.
(syms_of_editfns): Remove the 'narrowing-locks' variable.

* src/lisp.h: Make 'reset_outermost_narrowings' externally visible.

* src/xdisp.c (reset_outermost_narrowings)
unwind_reset_outermost_narrowing): Functions moved to src/editfns.c.

* lisp/subr.el (with-locked-narrowing): Improved macro, with a helper
function.
2022-11-25 18:51:39 +01:00
Eli Zaretskii
98c69b2556 ; * src/sqlite.c (Fsqlite_version): Doc fix. 2022-11-25 15:00:07 +02:00
Mattias Engdegård
f35dc7058b Add sqlite library version string retrieval function (bug#58766)
* src/sqlite.c (sqlite3_libversion, load_dll_functions):
Make sqlite3_libversion available.
(Fsqlite_version): New.
(syms_of_sqlite): Define sqlite-version.
* doc/lispref/text.texi (Database): Document.
* test/src/sqlite-tests.el (sqlite-returning): `RETURNING` was added
in sqlite 3.35; skip the test for older versions.
2022-11-25 11:03:10 +01:00
Stefan Kangas
a7f8087d7f Remove unused parameter from image_create_pix_container
* src/image.c (image_create_pix_container): Remove unused
frame parameter. Update callers.
2022-11-25 10:18:11 +01:00
Paul Eggert
55f6f1c82a Work around lsp-mode compatibility bug
* src/timefns.c (Ftime_subtract): Respect current-time-list when
args are eq (Bug#59506).
2022-11-24 12:57:02 -08:00
Philip Kaludercic
697aaeb7b3 ; * src/emacs.c (usage_message): Fix typo
Author:
2022-11-24 20:08:36 +01:00
Philip Kaludercic
80ed35866e * src/emacs.c (usage_message): Add missing --init-directory entry 2022-11-24 19:50:18 +01:00
Gregory Heytings
ba9315b164 Merge master into feature/improved-locked-narrowing. 2022-11-24 14:21:30 +01:00
Po Lu
9fcff114b8 Fix reentrancy problem/crash in xterm.c
* src/xterm.c (x_ignore_errors_for_next_request)
(x_stop_ignoring_errors): Be paranoid and block input inside the
protected section.
(x_focus_frame): Block input around critical section.
2022-11-24 20:10:32 +08:00
Eli Zaretskii
8252211833 Avoid assertion violations in treesit.c when editing non-ASCII
* src/treesit.c (make_treesit_parser): Use byte positions when
initializing 'lisp_parser'.  This avoids assertion violations when
the buffer has non-ASCII characters.
2022-11-24 11:09:51 +02:00
Yuan Fu
31fe6b066c
; * src/treesit.c (treesit_predicate_match): Move use below check. 2022-11-23 19:48:28 -08:00
Yuan Fu
10f8f9a185
; * src/treesit.c: Minor comment improvement. 2022-11-23 13:27:56 -08:00
Eli Zaretskii
275bc78286 ; * src/pdumper.c (dump_buffer, dump_vectorlike): Update hashes. 2022-11-23 20:22:19 +02:00
Eli Zaretskii
43e616aca5 Improve documentation of locale-specific string comparison
* doc/lispref/strings.texi (Text Comparison):
* src/fns.c (Fstring_collate_equalp): Improve documentation of
'string-collate-equalp' and 'string-collate-lessp'.  (Bug#59275)
2022-11-23 16:54:01 +02:00