Po Lu [Sat, 12 Nov 2022 10:52:36 +0000 (18:52 +0800)]
Handle request serial wraparound more correctly
* src/xterm.c (X_COMPARE_SERIALS): Remove macro.
(x_is_serial_more_than, x_is_serial_more_than_or_equal_to)
(x_is_serial_less_than, x_is_serial_less_than_or_equal_to): New
functions.
(x_find_error_handler, x_request_can_fail)
(x_clean_failable_requests, x_stop_ignoring_errors): Use those
functions to perform request serial comparison.
Only send notifications of interest, as determined by the optional LSP
FileSystemWatcher.kind bitmask provided by the server.
When the FileSystemWatcher.kind property is omitted, use the default
value of 7, which is computed from taking the bitwise OR operation
WatchKind.Create (1) | WatchKind.Change (2) | WatchKind.Delete (4).
Stefan Kangas [Fri, 11 Nov 2022 12:55:11 +0000 (13:55 +0100)]
eglot: Remove menu entry for manual
* lisp/progmodes/eglot.el (eglot-manual): Make obsolete. Open the
eglot info manual instead of the less exhaustive README.
(eglot-menu): Remove entry for reading the manual. (Bug#58892)
Po Lu [Fri, 11 Nov 2022 02:31:14 +0000 (10:31 +0800)]
Slightly adjust EWMH frame activation code for child frames
* src/xterm.c (x_get_toplevel_parent): New function.
(x_focus_frame): Do not use EWMH activation in two cases: focus
transfers to child frames (this is not guaranteed to work if the
focus and the child frame do not share the same toplevel) or
focus transfers from child frames to their toplevel parents.
dannyfreeman [Thu, 3 Nov 2022 13:39:16 +0000 (09:39 -0400)]
Eglot: Only handle URIs with the file:// scheme (bug#58790)
Eglot will not attempt to parse URIs that are not file:// type at all.
Instead let 'file-name-handler-alist' entries to deal with those. Not
parsing them at all allows the 'file-name-handler-alist' regexps to
identify them more accurately.
By also checking if Eglot received a URI in 'eglot--path-to-uri',
'file-name-handler-alist' can provide the non-file type URI back to
the lsp server, which presumably will know how to handle them since it
is also giving them out to clients.
This issue originated with clojure-lsp sending clients "jar:" type
URIs that Emacs is unable to handle out of the box. Before this
change, "jar:" URIs were parsed once, but since they contain a nested
URI, this resulted in a file being dispatched with a partially parsed
path that looked like "file://path/to.jar!/path/in/jar".
* lisp/progmodes/eglot.el (eglot--path-to-uri): Noop if already an
URI. (eglot--uri-to-path): Only handle file:// URIs
João Távora [Thu, 10 Nov 2022 21:06:33 +0000 (21:06 +0000)]
Improve Eglot's docstrings and manual
The examples in the manual can now be copy-pasted to user's init
files as-is.
* doc/misc/eglot.texi (Setting Up LSP Servers): Use
`with-eval-after-load'. Add eglot-alternatives example.
(Customizing Eglot): Use 'require and fix a typo.
* lisp/progmodes/eglot.el (eglot-server-programs): Mention
eglot-alternatives in eglot-server-program's docstring.
Evgeni Kolev [Thu, 10 Nov 2022 17:17:44 +0000 (17:17 +0000)]
Ignore errors when shutting down all LSP servers (bug#59146)
eglot-shutdown-all has a bug that results in partially stopping
servers: when a server shutdown timeouts (1.5s), an error is
propagated and eglot-shutdown-all does not try to shutdown the rest of
the servers.
* eglot.el (eglot-shutdown-all): Ignore errors when shutting down
servers, converting errors to messages.
Matt Armstrong [Fri, 4 Nov 2022 19:43:30 +0000 (12:43 -0700)]
Rewrite the `kill-buffer-delete-auto-save' tests (bug#59028)
These tests had been annoying to me when run in interactive mode.
They failed to bind `kill-buffer-delete-auto-save' as needed, so they
depended on the user's settings, and they failed to mock out the
"Buffer modified, save?" prompt.
* test/src/buffer-tests.el (test-kill-buffer-auto-save): New helper
function that mocks the two different kinds of prompts that occur when
killing modified buffers that visit a file. Tests fail if expected
prompts are not issued.
(test-kill-buffer-auto-save-default): Use it, and explicitly bind
`kill-buffer-delete-auto-save' to nil.
(test-kill-buffer-auto-save-delete): Delete it.
(test-kill-buffer-auto-save-delete-yes): New test for the "yes" half
of the old `test-kill-buffer-auto-save-delete'.
(test-kill-buffer-auto-save-delete-yes): Ditto for the "no" half.
Po Lu [Thu, 10 Nov 2022 05:25:28 +0000 (13:25 +0800)]
Be a little more paranoid about XI 2.0 implementations
* src/xterm.c (xi_populate_device_from_info):
(xi_disable_devices): Do not restore valuator values if the
valuator info has a mode of Relative and a value of 0.0.
* lisp/bs.el (bs-visit-tags-table): Verify that the
buffer holds a tags-table file before using it as
such. This is identical to bug#54133 affecting
Buffer-menu, and this fix is copied from the one
by Eli Zaretskii in commit 794fbd1c07 of 2022-02-24.
Thanks to Bob Rogers <rogers@rgrjr.com> for noticing.
F. Jason Park [Wed, 13 Jul 2022 08:54:19 +0000 (01:54 -0700)]
Teach thing-at-point to recognize bracketed IPv6 URLs
* lisp/thingatpt.el (thing-at-point-bounds-of-url-at-point): Allow
IPv6 addresses as hosts. Overshoots in the case of bracketed markup
but is rescued by `thing-at-point--bounds-of-well-formed-url'.
* test/lisp/thingatpt-tests.el (thing-at-point-test-data): Add cases
for IPv6 URLs. Bug#56514.
Po Lu [Wed, 9 Nov 2022 12:41:17 +0000 (20:41 +0800)]
"Fix" iconification handling on PGTK
* src/pgtkterm.c (pgtk_iconify_frame): Write some more comments
and refrain from setting the frame as iconified here.
(map_event): Remove redundant braces.
(window_state_event): Remove useless code and manage frame
visibility as correctly as possible under Wayland while
iconified. (bug#55836)
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.