Po Lu [Sun, 6 Nov 2022 11:42:36 +0000 (19:42 +0800)]
Pacify -Wnull-dereference
* src/xdisp.c (extend_face_to_end_of_line): Use FACE_FROM_ID,
not FACE_FROM_ID_OR_NULL, when the next line proceeds to
immediately dereference the face.
Po Lu [Sun, 6 Nov 2022 11:37:02 +0000 (19:37 +0800)]
Write more commentary on XI2 device management
* src/xterm.c (xi_populate_device_from_info): Take dpyinfo.
Describe what master and slave devices are, how they represent
seats, and how they are used to multiplex user input. Also
simplify ifdefs and avoid looping over scroll classes on XI 2.0.
(x_cache_xi_devices, handle_one_xevent): Adjust accordingly.
(x_term_init): Set dpyinfo->xi2_version before calling
x_cache_xi_devices.
Eli Zaretskii [Sun, 6 Nov 2022 08:08:58 +0000 (10:08 +0200)]
Improve documentation of Edebug overwriting buffer point
* doc/lispref/edebug.texi (Edebug Display Update)
(Edebug Options): More details about Edebug changing buffer point
position. Reported by Alan Mackenzie <acm@muc.de>.
Stefan Monnier [Sat, 5 Nov 2022 21:22:37 +0000 (17:22 -0400)]
buffer.c: evaporate overlays in all indirect buffers
This fixes bug#58928. The patch works by moving the
`evaporate_overlays` check closer to `itree_delete_gap`.
* src/buffer.c (adjust_overlays_for_delete_in_buffer): New function,
integrating the functionality of `evaporate_overlays`.
(adjust_overlays_for_delete): Use it.
(evaporate_overlays): Delete function.
Matt Armstrong [Wed, 2 Nov 2022 02:40:20 +0000 (19:40 -0700)]
Add a test for overlay evaporation across indirect buffers
* test/src/buffer-tests.el (buffer-tests--overlays-indirect-evaporate):
Test evaporation of overlays triggered by deleting text in base
and in indirect buffers. Test doesn't pass at the moment.
Matt Armstrong [Fri, 4 Nov 2022 22:02:17 +0000 (15:02 -0700)]
Tweak the overlay related `insert-before-markers' tests
* test/src/buffer-tests.el (test-overlay-insert-before-markers-empty):
Move code down to the other tests related to insertion. Test all
front/rear insert combinations. To make the test more clear, at least
to me, hard code all character positions.
(test-overlay-insert-before-markers-at-start): For both front-advance
modes verify that `insert-before-markers' at and overlay's start
advances it.
(test-overlay-insert-before-markers-at-end): For both rear-advance
modes test that `insert-before-markers' at an overlay's end advances
it.
(test-overlay-insert-before-markers-non-empty): Delete, replaced by
the two tests above.
Eli Zaretskii [Sat, 5 Nov 2022 12:28:53 +0000 (14:28 +0200)]
Fix warnings in sqlite.c in the MS-Windows build
* src/sqlite.c (sqlite3_errstr) [WINDOWSNT]: Define and load from
the DLL only if the SQLite3 version is at least 3.7.15.
(sqlite_prepare_errdata) [SQLITE_VERSION_NUMBER >= 3007015]: Use
the original code if sqlite3_errstr is available.
Po Lu [Sat, 5 Nov 2022 11:09:42 +0000 (19:09 +0800)]
Simplify XI scroll class reporting code
* src/xterm.c (xi_populate_device_from_info): Use xnmalloc.
Avoid reading classes at all when the XI library only supports
2.0.
(xi_handle_new_classes): New function.
(xi_handle_device_changed): Move class parsing logic there to
avoid duplicating code.
F. Jason Park [Fri, 4 Nov 2022 12:01:35 +0000 (05:01 -0700)]
Offer completions for GET subcommand flags in erc-dcc
* lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): Add /DCC GET switches.
This is unfinished business from bug#54458.
* test/lisp/erc/erc-dcc-tests.el (erc-dcc-tests--pcomplete-common,
pcomplete/erc-mode/DCC--get-basic, pcomplete/erc-mode/DCC--get-1flag,
pcomplete/erc-mode/DCC--get-2flags,
pcomplete/erc-mode/DCC--get-2flags-reverse): Add helper and tests for
completing /DCC GET switches.
Stefan Kangas [Fri, 4 Nov 2022 15:25:21 +0000 (16:25 +0100)]
Use progress reporter in cpp.el
* lisp/progmodes/cpp.el (cpp-highlight-buffer): Use progress
reporter.
(cpp-progress-time, cpp-progress-message): Make obsolete in favor
of 'make-progress-reporter'.
(cpp-message-min-time-interval): Doc fix.
Paul Eggert [Fri, 4 Nov 2022 18:00:49 +0000 (11:00 -0700)]
Pacify gcc -Wanalyzer-null-dereference
This is for gcc 12.2.1 20220819 (Red Hat 12.2.1-2) x86-64
when Emacs is configured with --enable-gcc-warnings.
* src/buffer.c (Fmove_overlay): Prefer BASE_EQ to EQ in a place
where they’re equivalent because the only symbol allowed here is nil.
* doc/emacs/package.texi: Expand documentation and give example.
* etc/NEWS: Mention 'package-vc-selected-packages'.
* lisp/emacs-lisp/package-vc.el (package-vc--select-packages): Remove
function.
(package-vc-ensure-packages): Add function based on
'package-vc--select-packages'.
(package-vc-selected-packages): Call 'package-vc-ensure-packages' from
custom setter.
* test/manual/noverlay/Makefile.in: Add copyright notice.
(LIBS): Rename...
(PACKAGES): ...to this, to avoid confusion with Autoconf's LIBS.
All uses changed.
(CFLAGS): Break out -I flag...
(CPPFLAGS): ...into this new variable.
(LDFLAGS): Rename...
(LDLIBS): ...to this, which is expected to hold -l flags.
(top_builddir): New variable.
(EMACS): Define in terms of it.
(.PHONY): Add clean, distclean, and perf targets.
(have-libcheck): Remove redundant target. All uses updated.
(itree-tests.o): Remove redundant dependency on its source file.
(itree-tests): Remove redundant (and uncompilable) rule.
* test/manual/noverlay/check-sanitize.sh: Use /usr/bin/env. Add
copyright notice. Enable pipefail option, to propagate itree-tests
exit status to caller. Fix typo in usage message. Strip less
information from Check's error messages.
* test/manual/noverlay/emacs-compat.h: Add copyright notice.
Include stdlib.h.
(emacs_abort, eassert): Consistently use EXIT_FAILURE.
(eassume): Define when necessary.
* test/manual/noverlay/itree-tests.c: Add copyright notice. Include
standard headers before third-party ones. Use most narrowly
applicable ck_assert* macro for the types being checked,
e.g. ck_assert_ptr_* macros for pointer values. Replace removed
names and APIs with current ones, e.g. the itree_node field 'color'
is now called 'red'. Ensure preconditions of itree API are
satisfied before use, e.g. itree_node otick being set appropriately
before insertion, or global iterator being initialized
before (implicit) use (bug#58976). Make all functions static.
(DEF_TEST_SETUP): Remove all instances, replacing with...
(test_insert1_setup, test_insert2_setup, test_remove1_setup)
(test_remove2_setup): ...these new test fixtures.
(A, B, C, D, E, N_05, N_10, N_15, N_20, N_30, N_40, N_50, N_70)
(N_80, N_90, N_85, N_95): Define as static variables rather than
macros.
(test_get_tree4): Remove, inlining salient parts.
(shuffle): Move closer to users.
(test_create_tree): Accept itree_nodes as argument instead of
dynamically allocating them. All callers changed.
(FOREACH): Remove unused macro.
(N_BEG, N_END): Define in terms of itree_node_begin and
itree_node_end, respectively.
(test_gap_insert_1, test_gap_insert_2, test_gap_insert_3)
(test_gap_insert_5, test_gap_insert_7, test_gap_insert_11): Use
test_setup_gap_node_noadvance.
(basic_suite): Group unit tests into test cases and fixtures. Run
previously forgotten test_insert_14.
(main): Run suite as CK_ENV to allow specifying desired verbosity in
the environment.
Po Lu [Fri, 4 Nov 2022 11:21:22 +0000 (19:21 +0800)]
Avoid using too up-to-date values when restoring valuators
* src/xterm.c (xi_has_scroll_valuators): New function.
(xi_handle_device_changed): If the device changed event provides
scroll valuators, then use the values in there. (bug#58980)
Juri Linkov [Fri, 4 Nov 2022 07:47:06 +0000 (09:47 +0200)]
* lisp/tab-bar.el (tab-bar-fixed-width): New user option.
(tab-bar-fixed-width-max): New user option.
(tab-bar-fixed-width-min): New variable.
(tab-bar-fixed-width-faces): New variable.
(tab-bar--fixed-width-hash): New function.
(tab-bar-make-keymap-1): Use 'tab-bar-fixed-width'.
Jim Porter [Mon, 19 Sep 2022 00:42:09 +0000 (17:42 -0700)]
Only strip newlines when stringifying a value for Eshell
* lisp/eshell/esh-util.el (eshell-stringify): Use 'string-trim-right'
instead of stripping the last character of the result of
'pp-to-string' (bug#58810).
Juri Linkov [Thu, 3 Nov 2022 17:35:45 +0000 (19:35 +0200)]
Fix overlays order in Flyspell (bug#58970)
Flyspell relies on the sorting order of overlays from 'overlays-in'
that returned the overlays sorted by decreased 'overlay-start'.
But after the recent merge of the noverlay branch, the order was reversed.
So need to change the order back to the expected by Flyspell.
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-word):
Sort overlays returned from 'overlays-in' descending by 'overlay-start'.
Some names under the interval_* namespace were renamed under the
itree_* namespace in commits:
0. f421b58db5 of 2022-10-19
"Prefix all itree.h type names with itree_".
1. 37a1145410 of 2022-10-19
"Rename all exported itree.h functions with the itree_ prefix"
Further, some values still referenced in commentary were removed in
commits:
2. 258e618364 of 2022-10-17
"Delete the itree_null sentinel node, use NULL everywhere."
3. 2c4a3910b3 of 2022-10-02
"itree: Use a single iterator object"
* src/emacs.c (main): Allocate global itree iterator once and for
all.
* src/alloc.c (mark_overlay):
* src/buffer.c (set_overlays_multibyte):
* src/itree.c (itree_destroy): Update commentary.
(interval_stack_ensure_space, itree_insert_gap): Prefer
unsigned-to-unsigned comparisons over signed-to-unsigned.
(interval_stack_push_flagged, interval_tree_insert)
(interval_tree_contains, itree_iterator_start)
(itree_iterator_finish, itree_iterator_next, itree_iterator_narrow):
Improve assertions.
(itree_init): Rename...
(init_itree): ...to this, for consistency with other global init
functions.
(itree_create): Stop leaking a global iterator allocation on each
call.
(interval_tree_init): Complete renames of
interval_tree -> itree_tree and interval_tree_clear -> itree_clear.
(interval_tree_remove_fix): Fix indentation.
* src/itree.h: Declare init_itree.
(ITREE_FOREACH): Fix typo in commentary.
* src/pdumper.c [CHECK_STRUCTS]
(dump_interval_node): Use the correct name in the HASH condition
and #error message.
(dump_overlay, dump_buffer): Update HASH (bug#58975).
Po Lu [Thu, 3 Nov 2022 11:27:24 +0000 (19:27 +0800)]
Further simplify valuator reset code
* src/xterm.c (xi_reset_scroll_valuators_for_device_id): Minor
style adjustments.
(handle_one_xevent): Don't check frames; reset on all XI_Enter
and XI_Leave events.
Eli Zaretskii [Thu, 3 Nov 2022 09:25:50 +0000 (11:25 +0200)]
Fix 'text-property-search-backward' with 1-char long properties
* lisp/emacs-lisp/text-property-search.el
(text-property--find-end-backward): Don't miss the end of
text-property value at point. This fixes searches backward when
the property is on a single character position. (Bug#58937)
Paul Eggert [Wed, 2 Nov 2022 20:24:26 +0000 (13:24 -0700)]
Initialize child signal handling before posix_spawn too.
Problem reported by Tino Calancha (Bug#58960).
* src/callproc.c (call_process): Initialize SIGCHLD handling
before possibly creating a child with emacs_span. This need not
be in the critical section that calls emacs_spawn, so do it
outside the critical section.
* src/process.c (child_signal_init): Now extern.
Juri Linkov [Wed, 2 Nov 2022 18:22:10 +0000 (20:22 +0200)]
Add the parameter :noquery to open-network-stream (bug#58948)
* doc/lispref/processes.texi (Network): Add :noquery for open-network-stream.
* lisp/net/network-stream.el (open-network-stream): Pass the
parameter :noquery to make-network-process. Doc fix.
* lisp/progmodes/eglot.el (eglot--connect): Pass `:noquery t' to
eglot--inferior-bootstrap to use in open-network-stream call, like
`:noquery t' is passed to make-process in other places.