1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-08 04:30:45 -08:00
Commit graph

47889 commits

Author SHA1 Message Date
Eli Zaretskii
95ee5477e1 ; * src/lread.c (read0, skip_lazy_string): Fix commentary again. 2023-05-26 15:11:35 +03:00
Eli Zaretskii
f42de74ebe ; * src/lread.c (read0, skip_lazy_string): Fix commentary wording. 2023-05-26 12:30:40 +03:00
Mattias Engdegård
f535c0e49d Handle #@00 in new reader in a compatible way (bug#63722)
This was a regression from Emacs 28.

* src/lread.c (skip_lazy_string, read0): Make #@00 read as nil, which
is a quirk from the old reader that we preserve for compatibility.
* test/src/lread-tests.el (lread-skip-to-eof): Verify it.

Reported by Richard Newton.
2023-05-26 10:22:51 +02:00
Po Lu
4205268675 Don't mark selection request events
* src/pgtkterm.c (mark_pgtkterm): Prevent crash by not marking
selection request events, which don't have Lisp_Object members.
2023-05-26 08:43:18 +08:00
Eli Zaretskii
d292d28229 Fix rare crashes in 'try_window_reusing_current_matrix'
* src/xdisp.c (try_window_reusing_current_matrix): Make sure we
never use a mode-line glyph row to start displaying scrolled-in
rows.  (Bug#63711)
2023-05-25 20:50:46 +03:00
Eli Zaretskii
765edc204d ; Support SQLite3 extensions on macOS
* src/sqlite.c (Fsqlite_load_extension): Support *.dylib
extensions.  (Bug#63653)
2023-05-23 17:53:07 +03:00
Eli Zaretskii
5aadb87d6f Fix 'use-dialog-box-p' and friends
* lisp/subr.el (use-dialog-box-p): Use dialog boxes also when
invoked from some window-system gesture.  (Bug#63655)
(y-or-n-p): Fix the description in the doc string of conditions
under which a dialog box will be used.

* src/fns.c (Fyes_or_no_p): Use the same condition for dialog
boxes as in 'use-dialog-box-p'.  Fix the description in the doc
string of conditions under which a dialog box will be used.

* doc/lispref/minibuf.texi (Multiple Queries, Yes-or-No Queries):
Fix the description of conditions under which a dialog box will be
used.
2023-05-23 17:44:23 +03:00
Eli Zaretskii
a347b26cba Disable loading SQLite3 extensions when SQLite3 version is too old
* src/sqlite.c (HAVE_LOAD_EXTENSION): Define to 1 only if
enabling/disabling extension loading is supported as well.
(load_dll_functions, Fsqlite_load_extension): Condition on
HAVE_LOAD_EXTENSION, not on HAVE_SQLITE3_LOAD_EXTENSION.
(Bug#63653)
2023-05-23 14:30:31 +03:00
Eli Zaretskii
ead3a2abbf Fix loading SQLite extensions
* src/sqlite.c (sqlite3_db_config) [WINDOWSNT]: Load from the DLL.
(Fsqlite_load_extension): Use 'sqlite3_db_config' to enable and
disable loading of extensions.  Add a few free extensions to the
allow-list.  Fix testing for the ".dll" extension.  (Bug#63590)

* test/src/sqlite-tests.el (sqlite-load-extension): Fix the test
to require successful load if the extension does exist.
2023-05-20 15:43:44 +03:00
Aaron Jensen
f8d9e40d2c Attempt to fix redisplay problems on macOS
* src/nsterm.m (ns_scroll_run): Attempt to fix redisplay
artifacts.  (Bug#63187)
2023-05-18 14:20:18 +03:00
Gregory Heytings
dcf8c01102 Merge branch 'scratch/long-lines-cleanup' into 'emacs-29' 2023-05-13 00:13:44 +02:00
Gregory Heytings
1e3a66df45 Add an assertion in, and a commentary for, 'get_nearby_bol_pos'
* src/xdisp.c:
(get_nearby_bol_pos): Document the function, and add an assertion
on its return value.
2023-05-13 00:11:36 +02:00
Gregory Heytings
f0f08eeb05 Fix the return type of 'labeled_restrictions_get_bound'
* src/editfns.c:
(labeled_restrictions_get_bound): Return a Lisp_Object instead of
a pointer to a struct Lisp_Marker.
(unwind_reset_outermost_restriction, reset_outermost_restrictions)
(Fwiden, Fnarrow_to_region): Adapt to the new return type.
2023-05-13 00:11:33 +02:00
Eli Zaretskii
acf4763417 Fix mouse highlight with some fonts in Cairo builds
* src/ftcrfont.c (ftcrfont_draw): Don't set the
'background_filled_p' flag of the glyph string.  (Bug#63271)
2023-05-12 22:19:35 +03:00
Stefan Monnier
93005cd9dc with-display-message: Workaround for bug#63253
Running arbitrary ELisp code from an atimer is still dangerous,
at least because the regexp engine is not-reentrant, so let's patch up
the case we bumped into.  There are probably many other such holes :-(

* src/alloc.c (garbage_collection_inhibited): Make it non-static.

* src/xdisp.c (garbage_collection_inhibited): Declare it.
(set_message, clear_message): Use it as a proxy for "we're in
a dangerous context like within `probably_quit`".
2023-05-09 22:30:52 -04:00
Eli Zaretskii
d94ea9efca Avoid crashes in --without-all build trying to scale non-ASCII char
* src/fontset.c (face_for_char): Display a non-ASCII character as
glyphless if the ASCII face has no fontset.  (Bug#63283)
2023-05-09 08:20:57 +03:00
Alan Third
c1363a04bb Fix crash when creating a child frame in NS (bug#63107)
* src/nsterm.m ([EmacsView initFrameFromEmacs:]): Have a second go at
creating the toolbar.
([EmacsWindow createToolbar:]): If there is already a toolbar or the
EmacsView's layer is not an EmacsLayer, then do nothing.

(cherry picked from commit 3adc1e7f37)
2023-05-08 09:49:03 +01:00
Po Lu
b1bda8228e More fixes for NetBSD/vax
* src/sysdep.c (init_signals) [__vax__]: Treat SIGILL
as a floating point error on VAXen.
Otherwise, (log 0.0) crashes Emacs.
2023-05-05 14:15:23 +08:00
Eli Zaretskii
46392c1623 Fix vertical-motion when tab-line is displayed in a window
* src/xdisp.c (try_window, try_window_id): Account for tab-line,
if present, when converting scroll-margin at the top of the window
to vertical pixel coordinate.  (Bug#63201)
2023-05-01 15:27:21 +03:00
Eli Zaretskii
ca43435816 Fix redisplay of mode line after its format changes from nil
* src/dispnew.c (update_window): Make sure a mode-line's row of
the current glyph matrix is disabled when the mode line is not
being displayed.  (Bug#63186)
2023-04-30 16:24:05 +03:00
Eli Zaretskii
b4f2f49978 Fix documentation of libxml-parse-* functions
* doc/lispref/text.texi (Parsing HTML/XML):
* src/xml.c (Flibxml_parse_html_region, Flibxml_parse_xml_region):
Update the documentation regarding the use of BASE-URL argument.
(Bug#63125)
2023-04-29 09:39:15 +03:00
Eli Zaretskii
5dd784961d ; * src/treesit.c (syms_of_treesit): Fix error messages. 2023-04-28 21:14:32 +03:00
Po Lu
a40f181623 Fix two crashes upon startup
* src/image.c (image_create_bitmap_from_data)
(image_create_bitmap_from_file): Specify a Window or a Pixmap
describing the screen, not a back buffer drawable which may not exist.
Otherwise, Emacs crashes on startup when a bitmap icon is in use.
2023-04-28 11:47:46 +08:00
Eli Zaretskii
98c6cfcbe4 Don't support versioned grammar libraries on MS-Windows
* src/treesit.c (treesit_load_language_push_for_each_suffix):
Don't append ".0.0" on WINDOWSNT.
2023-04-24 21:46:35 +03:00
Yuan Fu
8f71c1546d
Accept versioned tree-sitter language grammar files
By discussion on emacs-devel, titled "Versioned Tree-sitter parser
libraries".

* src/treesit.c (Vtreesit_str_dot_0): New variable.
(treesit_load_language_push_for_each_suffix): Additionally look for
lib_base_name.0 and lib_base_name.0.0.
(syms_of_treesit): Initialize Vtreesit_str_dot_0.
2023-04-24 10:38:40 -07:00
Eli Zaretskii
9a0f10b5f8 Fix line-number-at-pos when POSITION is out of narrowing
* src/fns.c (Fline_number_at_pos): Don't signal an error when
ABSOLUTE is nil and POSITION is outside of the narrowing, like the
original Lisp implementation did.  Minor speedup by using the byte
position where it is available from the get-go.  (Bug#62857)
2023-04-22 19:27:16 +03:00
Eli Zaretskii
3899acbb33 ; * src/fringe.c: Fix description of large circle. (Bug#62961) 2023-04-20 13:06:24 +03:00
Eli Zaretskii
329304c23f ; * src/term.c (init_tty): Fix last change. (Bug#62877) 2023-04-16 11:16:45 +03:00
Eli Zaretskii
9686b015a0 Fix strike-through attribute support on TTY frames
* src/term.c (init_tty): Fix setting the strike-through capability
with "smxx".  (Bug#62265)
2023-04-16 09:19:15 +03:00
Eli Zaretskii
39035fbfc5 Avoid crashes in 'describe-keymap' due to shadowing
* src/keymap.c (describe_vector): Handle shadowing by something
other than a symbol.  (Bug#62867)
2023-04-16 08:51:22 +03:00
Eli Zaretskii
14e809ddff Fix style and unwinding code in treesit.c
This was supposed to be a cherry-pick from master, but
isn't, due to the unnecessary rush to fix master without
cleaning up the mess first and without separating changes
that can and cannot be backported.
* src/treesit.c (treesit_traverse_cleanup_cursor): Fix indentation
style.
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Fix specpdl unwinding.  (Bug#62823)
Do not merge to master.
2023-04-14 09:21:05 +03:00
Yuan Fu
759cdf1e51 Catch signals produced by PRED in tree-sitter search functions
Earlier we switched to using cursors rather than nodes to traverse the
parse tree.  Because cursors need cleanup, we have to catch signals
thrown by the predicate functions and free the cursor. Failing to do
this will result in leaking the cursor whenever the predicate function
signals in a search function.  This change fixes the leak.
* src/treesit.c (treesit_traverse_cleanup_cursor): New function.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Catch signals.  (Bug#62823)

(cherry picked from commit a5eb9f6ad4)
2023-04-14 09:07:46 +03:00
Eli Zaretskii
864a4dc236 Fix compilation of w32.c with old MinGW system headers
* src/w32.c (CONSOLE_FONT_INFO): Make sure the definition is not
visible for MinGW versions whose w32api's version is before 5.2.0.
(Bug#52792)
2023-04-13 08:18:33 +03:00
Daniel Martín
b36c21e27d Change cursor color on NS port when it matches the face background
* src/macfont.m (CG_SET_FILL_COLOR_WITH_FRAME_CURSOR): New macro.
(CG_SET_FILL_COLOR_WITH_FRAME_BACKGROUND): New macro.
(macfont_draw): When the cursor's color matches the face background,
set the fill color of the cursor to the face foreground.
* src/nsterm.m (ns_maybe_dumpglyphs_background): When dumping the
background of a glyph string, apply the logic mentioned
above.  (Bug#62573)
2023-04-08 14:35:30 +03:00
Gregory Heytings
c0b9530862 Another final fix to last changes
* src/xdisp.c (get_small_narrowing_begv): Refine the value of 'bol_pos'.
2023-04-02 01:07:51 +02:00
Gregory Heytings
0cc8d6826a Three final fixes to last changes
* src/xdisp.c (get_nearby_bol_pos): Initialize 'bol' to BEGV - 1
instead of 0 (which fixes cursor motion commands in the presence
of a narrowing), adapt the return condition accordingly, and do
not restart the loop when BEGV has been reached.
(get_small_narrowing_begv): Use correct type.
2023-04-01 23:42:23 +02:00
Gregory Heytings
097c5ee8f5 Two further fixes to last changes
* src/xdisp.c (get_narrowed_width): Use FRAME_WINDOW_P instead of
Fterminal_live_p.  Also take WINDOW_LEFT_FRINGE_WIDTH into
account.
2023-04-01 18:56:01 +02:00
Gregory Heytings
dce08cf05c Improve and fix last changes
* src/xdisp.c (get_narrowed_width): Use WINDOW_RIGHT_FRINGE_WIDTH,
which works both for character-only terminals and for GUI frames
without fringes.
(get_nearby_bol_pos): Instead of searching for BOL in
[pos-500000..pos], gradually extend the region, starting with
[pos-500..pos].  This is much faster in buffers with some long
lines in the middle of lots of short lines.
2023-04-01 16:17:05 +02:00
Shynur
10918fc9d2 Fix scrolling window when point moves up
This fixes the case when both 'scroll-conservatively' and
'scroll-step' are customized to non-default values.
* src/xdisp.c (try_scrolling): Fix precedence between
'scroll-step' and 'scroll-conservatively' when scrolling with
'previous-line'.  (Bug#62530)

Copyright-paperwork-exempt: yes
2023-03-30 09:43:00 +03:00
Andrea Corallo
ab4273056e Comp fix calls to redefined primtives with op-bytecode (bug#61917)
* test/src/comp-tests.el (61917-1): New test.
	* src/comp.c (syms_of_comp): New variable.
	* lisp/loadup.el: Store primitive arities before dumping.
	* lisp/emacs-lisp/comp.el (comp--func-arity): New function.
	(comp-emit-set-call-subr): Make use of `comp--func-arity'.
2023-03-29 22:25:04 +02:00
Gregory Heytings
2093e010dc Fix cursor motion in character-only terminals
* src/xdisp.c (get_narrowed_width): Subtract 1 from
window_body_width to account for the '\' line wrapping indication.
2023-03-29 16:50:21 +02:00
Gregory Heytings
974e4f3333 Make get_medium_narrowing_begv/zv static
* src/xdisp.c (get_medium_narrowing_begv):
(get_medium_narrowing_zv): Make these two functions static, they
are only used in xdisp.c.

* src/dispextern.h: Remove the prototypes.
2023-03-29 01:12:47 +02:00
Gregory Heytings
afc2c6c13c Improve accuracy of cursor motion commands in long lines
* src/xdisp.c (get_nearby_bol_pos): New function.
(get_small_narrowing_begv): Use it.  This makes cursor motion
commands much more accurate in the first 500K characters of each
long line.
2023-03-29 01:12:39 +02:00
Gregory Heytings
7e26a5c774 Remove labeled restrictions before calling Fwiden
* src/editfns.c (labeled_restrictions_remove_in_current_buffer):
New function.

* src/lisp.h: Make it externally visible.

* src/xdisp.c (display_count_lines_logically):
* src/lread.c (readevalloop):
* src/indent.c (line_number_display_width):
* src/fileio.c (write_region):
* src/callproc.c (Fcall_process_region):
* src/buffer.c (Ferase_buffer): Use it.
2023-03-29 01:12:36 +02:00
Gregory Heytings
85ed1c9ca6 Code cleanup for long line optimizations
This commit does not change any code, it merely renames functions
and clarifies the documentation, to make the code hopefully easier
to grasp.

* src/dispextern.h (struct it): Rename the 'narrowed_begv',
'narrowed_zv', 'locked_narrowing_begv', 'locked_narrowing_zv' to
'medium_narrowing_begv', 'medium_narrowing_zv',
'large_narrowing_begv', 'large_narrowing_zv'.  Clarify the
comments.
Update the prototypes of the functions renamed in xdisp.c.

* src/lisp.h: Update the prototypes of the functions renamed in
editfns.c.  Remove the prototype of
'safe_run_hooks_maybe_narrowed', which is used only in keyboard.c.

* src/xdisp.c
(get_small_narrowing_begv): Renamed from
'get_closer_narrowed_begv'.
(get_medium_narrowing_begv): Renamed from 'get_narrowed_begv'.
(get_medium_narrowing_zv): Renamed from 'get_narrowed_zv'.
(get_large_narrowing_begv): Renamed from 'get_locked_narrowing_begv'.
(get_large_narrowing_zv): Renamed from 'get_locked_narrowing_zv'.
(SET_WITH_NARROWED_BEGV): Use the new field names.
(handle_fontified_prop): Use the new function and new field names.
(back_to_previous_line_start): Use the new field name.
(back_to_previous_visible_line_start): Use the new field name.
(reseat): Use the new function and new field names.
(get_visually_first_element): Use the new field name.
(move_it_vertically_backward): Use the new function name.
(redisplay_internal): Use the new function name.
Also add a large comment to explain how Emacs deals with long lines.

* src/keyboard.c:
(safe_run_hooks_maybe_narrowed): Use the new function names from
xdisp.c and editfns.c.  Make the function static, and add a
prototype.

* src/editfns.c:
(labeled_restrictions): Renamed from 'narrowing_locks'.
(labeled_restrictions_add): Renamed from 'narrowing_locks_add'.
(labeled_restrictions_remove): Renamed from
'narrowing_locks_remove'.
(labeled_restrictions_get_bound): Renamed from
'narrowing_lock_get_bound'.
(labeled_restrictions_peek_label): Renamed from
'narrowing_lock_peek_tag'.
(labeled_restrictions_push): Renamed from 'narrowing_lock_push'.
(labeled_restrictions_pop): Renamed from 'narrowing_lock_pop'.
(unwind_reset_outermost_restriction): Renamed from
'unwind_reset_outermost_narrowing'.
(reset_outermost_restrictions): Renamed from
'reset_outermost_narrowings'.
(labeled_restrictions_save): Renamed from 'narrowing_locks_save'.
(labeled_restrictions_restore): Renamed from
'narrowing_locks_restore'.
(unwind_labeled_narrow_to_region): Renamed from
'unwind_narrow_to_region_locked'.
(labeled_narrow_to_region): Renamed from
'narrow_to_region_locked'.
(Finternal__label_restriction): Renamed from
'Finternal__lock_narrowing'.
(Finternal__unlabel_restriction): Renamed from
'Finternal__unlock_narrowing'.
(Fwiden): Use the new function names.
(Fnarrow_to_region): Use the new function names.
(save_restriction_save): Use the new function names.
(syms_of_editfns): Use the new function names.
<outermost-restriction>: Renamed from 'outermost-narrowing'.

* lisp/subr.el (internal--with-restriction): Use the new internal
function name.
(internal--without-restriction): Use the new internal function
name.

* src/composite.c (composition_compute_stop_pos):
(find_automatic_composition): Use the new function name.

* doc/lispref/positions.texi (Narrowing): Add index entry.
2023-03-29 01:12:31 +02:00
Phil Sainty
59b7086838 Improve docs for global-mode-string / %M construct
* src/xdisp.c (global-mode-string): Update docstring.
* doc/lispref/modes.texi: Update manual.
2023-03-26 23:44:06 +13:00
Phil Sainty
207176e6b1 * src/buffer.c (mode-line-format): Document %o and %q constructs
Missed from commit b0b02ca7f3.
2023-03-26 23:44:01 +13:00
Phil Sainty
9cfae822fb * src/buffer.c (mode-line-format): Remove docs for obsolete %t construct
This documentation had been previously removed in 1999 in [1]
but was subsequently restored again in a different form in 2006
in [2] as the construct was still supported on some systems.
However it looks like it hasn't done what that documentation
indicated since [3] in 2011, and the final remnant of this
functionality was removed in [4] in 2013; so it seems clear that
it's no longer supported and shouldn't be documented now.

[1] commit 08de620019
[2] commit dafbe726b8
[3] commit 05c6525173
[4] commit 8549f9e89b
2023-03-26 23:43:54 +13:00
Eli Zaretskii
accb387166 Fix system time sampling on MS-Windows
* src/timefns.c (emacs_localtime_rz) [WINDOWSNT]: Unconditionally
call tzset to make sure we pick up all the changes of time zone,
working around the MS CRT caching.
2023-03-24 14:10:30 +03:00
Yuan Fu
33d436eefa
Fix treesit_ensure_parsed (bug#62333)
* src/treesit.c (treesit_ensure_parsed): Check for need_reparse after
treesit_sync_visible_region runs, because as the comment says,
treesit_sync_visible_region might modify need_reparse.
2023-03-24 00:18:19 -07:00