1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00
Commit Graph

49743 Commits

Author SHA1 Message Date
Eli Zaretskii
48024096fe Avoid crashes when scrolling images under winner-mode
* src/window.c (window_scroll_pixel_based): Fix calculation of a
window's vscroll.  (Bug#73933)
2024-10-21 20:42:01 +03:00
Eli Zaretskii
681f70ea04 * src/lread.c (READ_AND_BUFFER): Reject negative chars (bug#73914). 2024-10-20 22:39:53 +03:00
Mattias Engdegård
e5d600006e ; * src/doc.c (Ftext_quoting_style): Make doc string agree with code. 2024-10-17 18:23:58 +02:00
Eli Zaretskii
ae75ea6232 ; * src/fileio.c (Ffile_newer_than_file_p): Fix wording (bug#73709). 2024-10-13 18:29:34 +03:00
Eli Zaretskii
d664227f81 ; More accurate documentation of 'file-newer-than-file-p'
* doc/lispref/files.texi (File Attributes):
* src/fileio.c (Ffile_newer_than_file_p): Say the comparison uses
the last-modification times.  (Bug#73709)
2024-10-10 11:03:48 +03:00
Eli Zaretskii
f520008744 Avoid segfaults in Rmail-MIME
Rmail-MIME decodes text of email, including removal of
CR characters, but that can segfault if the text of some
MIME part is empty.
* src/coding.c (decode_coding_raw_text):
* lisp/mail/rmailmm.el (rmail-mime-insert-decoded-text): Don't
attempt to decode empty text region.
2024-10-09 16:22:52 +03:00
Eli Zaretskii
8f265b49e3 ; Fix last change
* doc/lispref/lists.texi (Building Lists):
* src/fns.c (Fappend): Fix last change (bug#73427).  Suggested by
Mattias Engdegård <mattias.engdegard@gmail.com>.
2024-09-23 17:13:31 +03:00
Eli Zaretskii
c8ed48b990 ; Improve documentation of 'append'
* doc/lispref/lists.texi (Building Lists):
* src/fns.c (Fappend): Improve documentation of 'append'.  (Bug#73427)
2024-09-23 14:41:34 +03:00
Eli Zaretskii
eced135120 Fix 'replace-regexp' in WDired
* src/search.c (Freplace_match): Revert the search.c part of the
change from Apr 7, 2024, which aims to fix bug#65451, but causes
bug#73018.  Do not merge to master.

* test/src/editfns-tests.el
(editfns-tests--before/after-change-functions): Expect this test
to fail.
2024-09-21 12:26:24 +03:00
Po Lu
7ef805d6a4 Disable fontset-related workaround on non-Android systems
* src/fontset.c (fontset_find_font) [!HAVE_ANDROID]: Don't
refuse to cache font objects whose registries do not agree with
the font specs.  (bug#73363)

Do not merge to master.
2024-09-20 22:30:07 +08:00
Andrea Corallo
956f14ae5e * src/treesit.c (treesit_debug_print_parser_list): Fix compiler warning. 2024-09-19 10:28:34 +02:00
Robert Pluim
300d05ecb4 Type-check argument to network-lookup-address-info
* src/process.c (Fnetwork_lookup_address_info): Check that the
"name" argument is a string, and mention 'puny-encode-domain'.
(Bug#73337)
2024-09-19 09:23:58 +02:00
Yuan Fu
f0daa2f215
Conservative heuristic for tree-sitter parser ranges (bug#73324)
* src/treesit.c (treesit_sync_visible_region): If the parser's original
ranges don't overlap with visible region, give it a zero range, rather
than don't set any range.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): Test new
behavior.
2024-09-17 21:18:28 -07:00
Yuan Fu
035024b4e5
; Fix treesit.c printing
* src/treesit.c (treesit_debug_print_parser_list): Use PRIuPTR so 32bit
systems compile without warnings.
2024-09-17 20:54:40 -07:00
Mattias Engdegård
4c6f45fa8e Re-enable GC mark trace buffer by default
Enable GC_REMEMBER_LAST_MARKED by default (it was disabled in Emacs 29)
to make it easier to debug difficult-to-reproduce GC problems
encountered by users.  This increases GC costs by about 5 %, which can
be avoided by turning the mark trace buffer back off using the new
--disable-gc-mark-trace option.

See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2024-09/msg00240.html

* configure.ac (--disable-gc-mark-trace): New config option.
* etc/NEWS: Mention it.
* src/alloc.c: Enable it by default and avoid a compiler warning.
2024-09-17 13:27:35 +02:00
Po Lu
c607701589 ; * src/haiku_support.cc: Correct last change. 2024-09-15 16:28:54 +08:00
Yuan Fu
460b9d705a
Fix treesit_sync_visible_region's range fixup code (bug#73264)
new_ranges_head
      |
      v
( )->( )->( )->( )->( )
           ^    ^
           |    |
           |    lisp_ranges (loop head)
           |
           prev_cons -> set cdr to nil to cut of the rest

result:

     ( )->( )

* src/treesit.c (treesit_sync_visible_region): Cut off this cons and the
rest, not set the current range's end to nil.
* test/src/treesit-tests.el:
(treesit-range-fixup-after-edit): Add tests for all cases.
2024-09-15 00:31:40 -07:00
Po Lu
709ce2aff1 Port to Haiku R1/beta5
* src/haiku_support.cc (keysym_from_raw_char): Use revised names
for B_HANGUL and B_HANGUL_HANJA.
2024-09-15 08:52:46 +08:00
Yuan Fu
6a6d7925c9
Fix range handling so it works for multibyte buffer (bug#73204)
Here by multibyte buffer I mean buffer that includes non-ASCII
characters.

The problem is illustrated by this comment, which I copied from the
source:

======================================================================
(ref:bytepos-range-pitfall) Suppose we have the following buffer
content ([ ] is a unibyte char, [    ] is a multibyte char):

    [a][b][c][d][e][ f  ]

and the following ranges (denoted by braces):

    [a][b][c][d][e][ f  ]
    {       }{    }

So far so good, now user deletes a unibyte char at the beginning:

    [b][c][d][e][ f  ]
    {       }{    }

Oops, now our range cuts into the multibyte char, bad!
======================================================================

* src/treesit.c (treesit_debug_print_parser_list): Minor fix.
(treesit_sync_visible_region): Change the way we fixup ranges, instead
of using the bytepos ranges from tree-sitter, we use the cached lisp
charpos ranges.
(treesit_make_ts_ranges): New function.
(Ftreesit_parser_set_included_ranges): Refactor out the new function
treesit_make_ts_ranges.
(Ftreesit_parser_included_ranges): Rather than getting the ranges from
tree-sitter, just return the cached lisp ranges.

* src/treesit.h (Lisp_TS_Parser): Add some comment.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): New test.
2024-09-14 00:28:23 -07:00
Yuan Fu
76faf7e609
Revert "Read more on each call to treesit's buffer reader"
This reverts commit bf23382f1f.

We move around the gap, narrow regions, ralloc, etc, and don't have a
way to invalidate previously given range.  So tree-sitter can't be given
the full range.
2024-09-14 00:28:23 -07:00
Po Lu
11e7ae3964 Fix bug#72254
* src/pgtkselect.c (Fpgtk_get_selection_internal): If requesting
TARGETS with just one result, return it as a vector.
(bug#72254)
2024-09-12 08:23:13 +08:00
Eli Zaretskii
9019536ea6 Fix use of Uniscribe font driver in MinGW build
This was inadvertently broken when Windows 9X support was
fixed in June 2024.
* src/w32uniscribe.c (syms_of_w32uniscribe_for_pdumper): Set
'uniscribe_available' non-zero in non-Cygwin builds.  (Bug#73159)
2024-09-10 15:14:47 +03:00
Eli Zaretskii
5c55c860db Avoid crashes in redisplay in batch-mode testing
* src/xdisp.c (try_window_id): Don't crash for "initial" frame.
(Bug#72765)
2024-09-10 14:43:52 +03:00
Eli Zaretskii
03e5698167 Clarify the semantics of 'string-pixel-width'
* doc/lispref/display.texi (Size of Displayed Text):
* lisp/emacs-lisp/subr-x.el (string-pixel-width):
* src/xdisp.c (Fwindow_text_pixel_size, Fbuffer_text_pixel_size):
Doc fixes.  (Bug#73129)
2024-09-09 14:28:12 +03:00
Eli Zaretskii
9f0603207b ; * src/treesit.c: Minor cleanups of recent changes. 2024-09-09 14:03:15 +03:00
Andrea Corallo
e0d3f74395 * src/treesit.c (treesit_debug_print_parser_list): Fix format string. 2024-09-09 09:09:48 +02:00
Yuan Fu
bed38ded73
; * src/treesit.c (treesit_debug_print_parser_list): Fix formatting. 2024-09-08 21:14:00 -07:00
Yuan Fu
18c6487dbd
; * src/treesit.c: Add a prototype so there's no warning about it. 2024-09-08 21:04:29 -07:00
Yuan Fu
bf23382f1f
Read more on each call to treesit's buffer reader
* src/treesit.c (treesit_read_buffer): Read until the gap or visible
end, instead of reading a single char.
2024-09-08 20:52:20 -07:00
Yuan Fu
3435464452
Fix the range handling in treesit.c
1. In treesit_sync_visible_region, reduce the ranges for a parser so it
doesn't go beyond the visible range.

2. To avoid possible infinite recursion, add a within_reparse field to
parsers.  Previously we were using the need_reparse field to avoid
infinite recursion, but lisp programs in a parser's after change hook
might make some buffer edit which turns need_reparse to true. To avoid
that, we now use an explicit field.  If a parser's after change function
makes a buffer edit, lisp program ends up with a desynced parse tree,
but that's better than possible infinite recursion.  Also after change
function shouldn't edit the buffer.

3. In treesit_make_ranges, use parser's visible_beg instead of buffer's
BEGV.  I mean technically whenever we make ranges, buffer's BEGV should
be equal to parser's visible_beg, but better not take that uncertainty,
also makes the code more readable.

4. In Ftreesit_parser_included_ranges, move visible region sync code
before the body of the function.

* src/treesit.c (treesit_sync_visible_region): Minimally fix ranges so
it doesn't exceed parser's visible range.
(treesit_call_after_change_functions): Update calling sigature to
treesit_make_ranges.
(treesit_ensure_parsed, make_treesit_parser): Use the new field
within_reparse.
(treesit_make_ranges): Use parser's visible_beg instead of buffer's
BEGV.
(Ftreesit_parser_included_ranges): Move visible region check before
function body.
* src/treesit.h (Lisp_TS_Parser): Add new field within_reparse.
2024-09-08 20:52:20 -07:00
Yuan Fu
3fcec09f75
Add debugging function for treesit.c
* src/treesit.c (treesit_debug_print_parser_list): New function.
2024-09-08 20:52:20 -07:00
Mattias Engdegård
e55e2e1c6b Make json-serialize always return a unibyte string (bug#70007)
The JSON format is defined as a byte sequence and will always be used as
such, so returning a multibyte string makes little sense.

* src/json.c (json_out_to_string): Remove.
(Fjson_serialize): Return unibyte string.
* test/src/json-tests.el (json-serialize/roundtrip)
(json-serialize/roundtrip-scalars, json-serialize/string):
Update tests.
* doc/lispref/text.texi (Parsing JSON): Document.
* etc/NEWS: Announce.
2024-09-08 20:02:34 +02:00
Eli Zaretskii
4f044d0d3d ; Improve documentation of 'suspend-emacs'
* doc/lispref/os.texi (Suspending Emacs):
* src/keyboard.c (Fsuspend_emacs): Document possible failures
in sending STUFFSTRING to the shell.  (Bug#73100).
2024-09-07 18:38:40 +03:00
Eli Zaretskii
13f69f254c Fix rare segfaults due to freed fontsets
* src/xfaces.c (recompute_basic_faces): Force complete
recalculation of non-ASCII faces and their fontsets if any
non-ASCII faces are in the frame's face cache.  (Bug#72692)
2024-08-29 12:56:27 +03:00
Eli Zaretskii
9b299dd79c Revert a recent change that caused redisplay slowdown
* src/xfaces.c (recompute_basic_faces): Revert the change which
caused recalculation of all the faces, as it made cursor motion
too slow.  Reported by Juri Linkov <juri@linkov.net> (bug#72692).
2024-08-25 21:43:59 +03:00
Eli Zaretskii
4211d85eec Fix rare segfaults due to freed fontsets
* src/xfaces.c (recompute_basic_faces): Force complete
recalculation of all the faces.  (Bug#72692)
2024-08-24 12:07:02 +03:00
Martin Rudalics
25f5372166 Avoid putting a dead buffer in the minibuffer window (Bug#72487)
* src/minibuf.c (minibuffer_unwind): Make sure that the buffer
referenced by the first element of the list of previous buffers
of the minibuffer window is live before assigning it to the
minibuffer window (Bug#72487).
* src/window.c (set_window_buffer): Assert that BUFFER is live.
2024-08-23 10:27:12 +02:00
Po Lu
3419e7ea52 Correct Android failure to open an old CJK font
* src/sfnt.c (sfnt_read_cmap_format_2): Properly compute
subtable count, and append the empty table at position 0.
(sfnt_lookup_glyph_2): Update commentary.
2024-08-20 21:56:41 +08:00
Eli Zaretskii
fc7581ae2e ; Fix documentation of secure-hash functions
* src/fns.c (Fsecure_hash):
* doc/lispref/text.texi (Checksum/Hash):
* lisp/subr.el (sha1): Fix documentation wrt to the number of
bytes 'secure-hash' and its variants return when BINARY is
non-nil.  Reported by Pip Cet <pipcet@protonmail.com>.
2024-08-19 17:51:50 +03:00
Eli Zaretskii
9e7c2d3816 Avoid rare crashes due to clobbering of input events
* src/keyboard.c (read_char): Declare C 'volatile', to prevent
clobbering it by setjmp/longjmp.  Do not merge to master.
(Bug#71744)
2024-08-17 21:35:08 +03:00
Po Lu
5397808e5b ; Eliminate more C++ comments
* lib-src/movemail.c:

* nt/preprep.c (main):

* src/unexw32.c (unexec): Convert C++-style comments to C.
2024-08-17 22:04:01 +08:00
Po Lu
8d5f88d326 Backport ed305c4b98 to emacs-30
* src/xterm.c (x_construct_mouse_click): `||' → `|'.
Typo found by clang 18.1.6 -Wbool-operation.  Do not
merge to master.
2024-08-17 21:53:30 +08:00
Peter Oliver
8a072d1f05 Apply --display kluge for PGTK too
* src/emacs.c (main): The --display option needs the same handling
with the PGTK backend as it does with the X11 backends.  (Bug#72118)
2024-08-17 11:04:43 +03:00
Andrea Corallo
9a04b99b3d ; * src/data.c (Fsubrp): Improve docstring. 2024-08-15 10:54:26 +02:00
Gerd Möllmann
6d55e94996 macOS: Wrong frame rectangle after wake (bug#71912)
* src/nsterm.m ([EmacsView windowDidBecomeKey]):
Call adjustEmacsFrameRect.
2024-08-12 05:11:00 +02:00
Pip Cet
5c3d340e00 Fix format 2 cmap handling in sfnt.c
This code is untested as no font with a format 2 cmap could be found.

* src/sfnt.c (sfnt_lookup_glyph_2): Fix typos.  Assume single-byte
encodings use character codes 0, 1, ..., 255 rather than 0, 256, ...,
65280.
2024-08-11 10:22:46 +00:00
Pip Cet
8e925d582a Fix coordinate transformations in sfnt.c
Backport.

* src/sfnt.c (sfnt_transform_coordinates):
(sfnt_transform_f26dot6): Fix calculation of transformed coordinates in
the very rare case of arbitrary transformation matrices.
2024-08-11 10:22:19 +00:00
Gerd Möllmann
bd6dfb97ff NS: Fix scroll-bar setting code (bug#72331)
* src/nsterm.m (ns_set_vertical_scroll_bar): Use
WINDOW_SCROLL_AREA_WIDTH instead of NS_SCROLL_BAR_WIDTH.
(ns_set_horizontal_scroll_bar): Use WINDOW_SCROLL_AREA_HEIGHT
instead of NS_SCROLL_BAR_HEIGHT. Clear area differently if vertical
scroll bars are present.
* src/nsterm.h (NS_SCROLL_BAR_WIDTH, NS_SCROLL_BAR_HEIGHT): Remove.
2024-08-09 07:21:28 +02:00
Po Lu
679f7ccc49 Prevent accesses to /content files without a GUI connection
* src/androidvfs.c (android_content_name): Hide all
subdirectories when `android_init_gui' is not set.
2024-08-07 09:17:57 +08:00
Eli Zaretskii
f1e37ae423 Avoid crashes in very large buffers with long lines
* src/xdisp.c (get_large_narrowing_begv, get_large_narrowing_zv)
(get_medium_narrowing_begv, get_medium_narrowing_zv): Use
'ptrdiff_t' instead of 'int', to prevent integer overflow in
large buffers.  (Bug#72497)
2024-08-06 21:19:49 +03:00