1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 23:10:47 -08:00
Commit graph

47707 commits

Author SHA1 Message Date
Eli Zaretskii
f93a5180a6 Update the documentation of overlays (bug#59996)
* src/buffer.c (Foverlay_recenter, Foverlay_lists): Update the doc
strings.

* lisp/subr.el (copy-overlay): Update comment.

* doc/lispref/internals.texi (Buffer Internals): Remove buffer
fields relevant to the old implementation; add the new interval
tree field.
* doc/lispref/display.texi (Overlays, Managing Overlays): Update
text to be consistent with the new implementation of overlays.
(Managing Overlays): Remove documentation of 'overlay-recenter'.

* etc/NEWS: Mention incompatible aspects of overlay
reimplementation.
2022-12-14 20:13:47 +02:00
Stefan Kangas
def51dd645 ; Fix typos 2022-12-13 18:44:41 +01:00
Eli Zaretskii
4ef8b9f544 Improve resetting face attributes when looking for suitable fonts
* src/xfaces.c (syms_of_xfaces)<face-font-lax-matched-attributes>:
Change the default value to t.  Update doc string.
(realize_gui_face): When 'Vface_font_lax_matched_attributes' is t,
reset the 3 default font attributes efficiently.  Call
'font_maybe_unset_attribute' only if the value is neither nil nor
t.  (Bug#59347)
2022-12-13 17:35:17 +02:00
Eli Zaretskii
58b8ed8b55 ; Avoid compilation warning on MS-Windows
* src/timefns.c (sys_clock): Declare, to avoid compilation
warning.
2022-12-12 20:01:23 +02:00
Po Lu
f4ce6fa7d3 Revert "Revert "Improve last change to xfaces.c" (05ece1eb8b)"
This reverts commit b8d2ec920f.

Not only does it make debugging Emacs harder for users, that change is
unsafe for the Haiku port.
2022-12-12 10:41:38 +08:00
Gregory Heytings
b8d2ec920f Revert "Improve last change to xfaces.c" (05ece1eb8b)
* src/xfaces.c: Revert 05ece1eb8b.

See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59347#331.
2022-12-12 02:12:09 +01:00
Eli Zaretskii
78ad33bb05 ; Minor cleanup of last change in xfaces.c. 2022-12-11 11:59:04 +02:00
Eli Zaretskii
2024ade271 ; Improve docs of relaxing face-font attribute match (bug#59347)
* src/xfaces.c (realize_gui_face): Fix typo and coding style.
(syms_of_xfaces) <face-font-lax-matched-attributes>: A better name.
2022-12-11 11:49:29 +02:00
Po Lu
05ece1eb8b Improve last change to xfaces.c
* src/xfaces.c (font_unset_attribute): New function.
(realize_gui_face): Improve commentary and use list instead of
bitmask.
(syms_of_xfaces): Get rid of bitmask.  Replace it by a list,
there is no reason any user should have to think about bitmasks
in Emacs lisp.
2022-12-11 09:32:47 +08:00
Gregory Heytings
7d787564c0 Actually improve detection of long lines
* src/xdisp.c (redisplay_window): Update condition.

* src/xdisp.c (mark_window_display_accurate_1):
* src/pdumper.c (dump_buffer):
* src/buffer.h (BUF_CHARS_UNCHANGED_MODIFIED):
(struct buffer_text):
* src/buffer.c (Fget_buffer_create):
Revert 1c837c42c2, which was misguided.
2022-12-11 00:16:27 +01:00
Gregory Heytings
30e3cb2135 Unset the weight/slant/width in the spec when realizing a font
Between commits bf0d3f76dc (2014) and 6b1ed2f2c9 (2022),
realize_gui_face called font_load_for_lface with an empty or
partly emptied font spec, i.e. it ignored a part of its attrs
argument.  The rationale given in bug#17973, which led to
bf0d3f76dc, is not clear.  However, 6b1ed2f2c9, which passes
the full font spec to font_load_for_lface and
font_find_for_lface, leads to suboptimal font choices, for
example when the font chosen for the default face has a
weight, slant or width that is not supported by other
available fonts on the system, such as 'medium' or 'heavy'.

If these attributes are not unset here, the call to
font_list_entities in font_find_for_lface arbitrarily limits
the candidate font list to those that are perfect matches for
these attributes, which means that the scoring mechanism is
bypassed.  Note that the size attribute in spec is also unset,
in font_find_for_lface.

Also allow unsetting the other attributes, for debugging purposes.

* src/xfaces.c (realize_gui_face): Unset the weight, slant and
width of the font spec.  Fixes bug#57555 and bug#59347.
(syms_of_xfaces): New variable
'realize-gui-face-ignored-spec-attributes'.
2022-12-10 23:46:16 +01:00
Yuan Fu
ebef8905b0
Make indirect buffers use tree-sitter parsers of their base buffer
Fix the problem described in bug#59693.

* src/treesit.c (treesit_record_change): Always use the base buffer.
(Ftreesit_parser_create): Always use the base buffer.  Also change the
for loop into FOR_EACH_TAIL (stylistic change).
(Ftreesit_parser_list): Always use the base buffer.

* doc/lispref/parsing.texi (Using Parser): Update manual.
* test/src/treesit-tests.el (treesit-indirect-buffer): New test.
2022-12-09 17:24:08 -08:00
Stefan Kangas
801c1c22de ; Prefer HTTPS to HTTP in some URLs 2022-12-09 15:31:41 +01:00
Po Lu
67ef92fb0e Revert "; * src/emacs.c (main): Improvements to last change."
This reverts commit c774e83e36.  It
causes crashes on GNU/Linux systems using libgmp, as there a shared
library initializer is used to set the malloc functions on startup, so
they are not dumped.
2022-12-09 09:25:42 +08:00
Po Lu
c774e83e36 ; * src/emacs.c (main): Improvements to last change. 2022-12-08 08:57:24 +08:00
Po Lu
508b0c1b22 Fix crash on Windows 9X
* src/emacs.c (main): Call init_bignum before init_window_once.
2022-12-08 08:57:24 +08:00
Yuan Fu
d31a253983
Improve parameter checking in tree-sitter functions
* src/treesit.c (treesit_check_position): Extract out new function.
(Ftreesit_node_first_child_for_pos)
(Ftreesit_node_descendant_for_range): Replace code with the new
function.
(Ftreesit_query_capture): Add missing check for node and parser.  Add
check for range for BEG and END.  Move treesit_initialize to the
beginning of the function.

* test/src/treesit-tests.el (treesit-node-api)
(treesit-query-api): Add tests for out-of-range error.
2022-12-07 12:01:37 -08:00
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