Alan Mackenzie [Tue, 8 Nov 2022 14:55:40 +0000 (14:55 +0000)]
CC Mode: Improve accuracy of recognition of bitfields
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): When we've got two
identifiers followed by a colon, additionally check for a number (or
identifier) followed by a semicolon or comma before concluding we have a
bitfield.
Alan Mackenzie [Tue, 8 Nov 2022 11:53:37 +0000 (11:53 +0000)]
CC Mode: Stabilize the fontification in the presence of "register" keywords
This fixes bug #58883.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): New variable
unsafe-maybe. Set it in CASE 10 rather than setting c-record-type-identifiers
to nil. Near the end of the function, when unsafe-maybe is set, bind
c-promote-possible-types to 'just-one rather than t around the call to
c-forward-type.
* etc/NEWS (EUDC): Document eudc-ignore-options-file.
* doc/misc/eudc.texi (The Server Hotlist): Likewise
* lisp/net/eudc-vars.el (eudc-ignore-options-file): New variable.
(eudc-options-file): Mention new variable.
* lisp/net/eudc.el: Warn on load if eudc-ignore-options-file is
set but the options file exists.
(eudc-set-server): Support
eudc-ignore-options-file.
(eudc-bookmark-server): Likewise.
(eudc-save-options): Likewise. (Bug#56154)
Alan Mackenzie [Mon, 7 Nov 2022 12:20:07 +0000 (12:20 +0000)]
CC Mode: Fix infinite loop in c-brace-stack-at.
This fixes bug #59038. The infinite loop occurred with a buffer containing
Base-64 encoded text rather than appropriate C Mode text.
* lisp/progmodes/cc-engine.el (c-update-brace-stack): Don't execute
c-beginning-of-current-token unless the previous c-syntactic-re-search-forward
has succeeded at least once.
Stefan Monnier [Mon, 7 Nov 2022 05:38:43 +0000 (00:38 -0500)]
(itree_insert_gap, itree_delete_gap): Minor optimization
`limit` can get smaller in either of the two children of a node.
It can also happen that the root node itself has a low enough limit
that the loop can be interrupted right away.
The previous code only checked `limit` when going down to a left
child, which is not wrong, but tests suggest that it is also very
common to reach this limit when going to a right child, so move the
test accordingly.
* src/itree.c (itree_insert_gap, itree_delete_gap): Check `limit` for
all nodes, rather than only when following a `left` pointer.
Eli Zaretskii [Sun, 6 Nov 2022 14:45:30 +0000 (16:45 +0200)]
; Avoid compiler warnings in 'extend_face_to_end_of_line'
* src/xdisp.c (extend_face_to_end_of_line): Return if no
default_face is cached or could be realized. This avoids
compilation warnings about NULL pointer dereferences.
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.
Eli Zaretskii [Fri, 4 Nov 2022 13:12:29 +0000 (15:12 +0200)]
; Improve documentation of character classes in regexps
* doc/lispref/searching.texi (Char Classes): Add notes about the
dependence of character classes on case and syntax tables specific
to buffers and modes. (Bug#58992)
* 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'.