Problem reported by Zhengyi Fu (bug#80844).
* lisp/server.el (server--process-filter-1, server-return-error)
(server-edit-abort): Append newline to -error commands, too.
Otherwise emacsclient has no reliable way to find the end of the
error command’s argument, except to wait for EOF which is
undesirable since the Emacs server keeps the socket open
for a while, waiting for emacsclient to exit.
Also add more bindings to M-x eglot-list-connections
* lisp/progmodes/eglot.el (eglot-list-connections-mode-map): Add
bindings for e, w, RET.
(eglot-events-buffer-of-listed-connection)
(eglot-show-workspace-configuration-of-listed-connection)
(eglot-describe-listed-connection): New commands.
(eglot-describe-connection): New command.
* doc/misc/eglot.texi: Document new keys and eglot-describe-connection.
* etc/EGLOT-NEWS: Announce.
* lisp/vc/vc.el (vc-rename-file): Replace broken attempted use
of vc-dir-status-files with walking OLD using vc-file-tree-walk.
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--rename-directory):
Assert that the files are registered or not as appropriate. New
test case in which there are only registered files.
* lisp/emacs-lisp/ert-x.el (ert-play-keys): new defun.
* test/lisp/simple-tests.el (undo-test-kill-c-a-then-undo)
(undo-test-point-after-forward-kill): Use new function
`ert-play-keys' and `(ert-with-test-buffer (:selected t) ...)'
rather (with-temp-buffer (switch-to-buffer (current-buffer) ...)'.
* test/lisp/erc/erc-scenarios-spelling.el
(erc-scenarios-spelling--auto-correct): Use new function
`ert-play-keys' and `(ert-with-buffer-selected ...)' rather than
`execute-kbd-macro' and `(with-current-buffer
... (set-window-buffer nil (current-buffer) ...)'.
* doc/misc/ert.texi (Helper Functions): Document ert-play-keys,
and differences between ert-simulate-command, ert-simulate-keys
& ert-play-keys.
* test/lisp/emacs-lisp/ert-x-tests.el
(ert-x-tests-play-keys)
(ert-x-tests-simulate-command, ert-x-tests-simulate-keys): New
tests.
* lisp/progmodes/eglot.el (eglot-list-connections-mode-map): New
defvar.
* lisp/progmodes/eglot.el (eglot--list-connections-entries): New
function, extracted from eglot-list-connections.
* lisp/progmodes/eglot.el (eglot--list-connections-cmd): New macro.
* lisp/progmodes/eglot.el (eglot-shutdown-listed-connection)
(eglot-reconnect-listed-connection): New commands.
* lisp/progmodes/eglot.el (eglot-list-connections): Use
eglot--list-connections-entries.
* doc/misc/eglot.texi: Document eglot-list-connections and new keys.
* etc/EGLOT-NEWS: Announce.
Some LSP servers prefer to canonicalize all document URIs to
their "true name", chasing all fs symbolic links. If the user
is visiting a project under a symlink, say ~/myprojects/foo
which points to /data/true/projects/foo. When visiting a
~/myprojects/foo/f.c and trying to jump to a nearby file f.h via
LSP 'xref-find-definitions', the path should probably be
~/myproject/foo/f.h, not /data/true/projects/foo/f.h.
Even though Emacs can recognize that the two files are the same,
'buffer-file-name' is not. This confuses tools like C-x C-f,
ibuffer, and ultimately the users themselves who probably
oblivious to the true place of the project. After all they
started Eglot under a syminked file.
* lisp/progmodes/eglot.el (eglot-lsp-server): Add trueroot slot.
(eglot-uri-to-path): Rework to consider trueroot and project root.
* lisp/progmodes/compile.el
(compilation-error-regexp-alist-alist): Make leading '|'
optional when there are leading spaces (bug#80681).
* etc/compilation.txt (GNU style): New error with two leading
spaces.
* test/lisp/progmodes/compile-tests.el
(compile-test-error-regexps): Increment expected
compilation-num-errors-found.
(compile-tests--test-regexps-data): New error test case for
'gnu' with two leading spaces. Change expected match for
'cucumber' to match again 'gnu'.
Copyright-paperwork-exempt: yes
* lisp/vc/vc.el (vc-rename-file): Don't call into the backend if
moving a directory containing only untracked files.
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--rename-directory):
New test for this case.
* lisp/vc/vc.el (vc-delete-file): New NOCONFIRM parameter.
(vc-rename-file): New OK-IF-ALREADY-EXISTS parameter.
* lisp/dired-aux.el (dired-rename-file): Pass it.
* test/lisp/vc/vc-tests/vc-tests.el (vc-test--rename-file): Test
it. Also test moving files into an existing directory.
This is intended to parallel the 'mode-line-active/inactive'
and 'header-line-active/inactive' distinction.
* doc/emacs/display.texi (Standard Faces): Document the new faces.
* lisp/faces.el (tab-line-active, tab-line-inactive): Add new faces.
* lisp/tab-line.el (tab-line-faces): Add new faces
to MEMBERS arg of 'defgroup'.
(tab-line-auto-hscroll): Use one of the faces
depending on 'mode-line-window-selected-p'.
* src/dispextern.h (CURRENT_TAB_LINE_ACTIVE_FACE_ID_3)
(CURRENT_TAB_LINE_ACTIVE_FACE_ID): New macros
based on header-line equivalents.
(CURRENT_TAB_LINE_HEIGHT): Use CURRENT_TAB_LINE_ACTIVE_FACE_ID.
(face_id): Use TAB_LINE_ACTIVE_FACE_ID and
TAB_LINE_INACTIVE_FACE_ID instead of TAB_LINE_FACE_ID.
* src/xdisp.c (window_box_height, pos_visible_p, init_iterator)
(window_text_pixel_size, display_mode_lines, display_mode_line)
(format-mode-line): Replace all uses of TAB_LINE_FACE_ID with
either a new macro or the new face IDs.
* src/xfaces.c (lookup_basic_face, realize_basic_faces):
Map new face IDs to their lisp symbols.
(syms_of_xfaces): New lisp symbols.
Many regexps do not pay attention to syntax tables at all
because they don't use things like \s, \b, \<, or \_<.
So delay the actual initialization of the machinery for
`syntax-table` properties (especially the call to `syntax-propertize`)
until the first time we actually need to consult the syntax of
a character.
* src/syntax.c (uninitialized_interval): New constant.
(RE_SETUP_SYNTAX_TABLE_FOR_OBJECT, SETUP_SYNTAX_TABLE):
Set `forw/backward_i` to that new constant to indicate they haven't
actually be initialized yet.
Set `start` and `stop` fields right away, instead of delegating it to
`update_syntax_table`, so that `e_property` and `b_property`
can be set independently.
(update_syntax_table): Remove the `init` argument. Instead, discover
the need for initialization based on the fact that `forw/backward_i`
are uninitialized. Presume `start` and `stop` fields have been
set already.
(parse_sexp_propertize): Update call accordingly.
(update_syntax_table_forward): Remove the `init` argument.
* src/syntax.h (update_syntax_table, update_syntax_table_forward):
Remove the `init` argument.
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD):
Update calls accordingly.
* nt/gnulib-cfg.mk (getdelim, getline): Do not omit. It is now
needed for 'emacsclient', but MinGW64 doesn't have it in its runtime
libraries (mingw.org's MinGW does have it). (Bug#80770)
Do not mishandle long lines, or lines containing NUL,
when receiving data.
* lib-src/emacsclient.c (check_socket_timeout, main):
Use ssize_t for return values from recv,
since in theory the value could exceed INT_MAX now.
(main): Do not use a fixed-size buffer for receiving data;
instead, grow the buffer as needed (admittedly unlikely).
When a partial line is received via recv, do not discard its data;
instead, keep reading, possibly with a grown buffer.
Do not ignore received data after a null byte is received.
Add a comment about when received data is ignored due to a goto.
Do not mishandle long lines, or lines containing NUL,
when getting configuration or sending data.
* lib-src/emacsclient.c (send_to_emacs_len, quote_argument_len):
New functions, generalizing the old send_to_emacs and quote_argument.
Rewrite the old functions to use the new ones.
(get_server_config): Do not mishandle long lines in the config file.
(set_tcp_socket): No longer a need to null-terminate auth string.
(main): Do not mishandle long lines from stdin, or lines with NUL.