Eli Zaretskii [Wed, 30 Apr 2025 11:06:44 +0000 (14:06 +0300)]
Fix compilation errors in emacsclient.c with MinGW GCC 15
* lib-src/emacsclient.c (set_fg, get_wc): Declare using actual
function signatures.
(w32_give_focus): Cast return value of 'GetProcAddress' to correct
pointer types. (Bug#78160)
Sean Whitton [Wed, 30 Apr 2025 09:28:04 +0000 (17:28 +0800)]
cperl-mode-map: Don't bind C-j
* lisp/progmodes/cperl-mode.el (cperl-mode-map): Don't bind C-j.
The default global mode bindings will DTRT depending on whether
or not electric-indent-mode is on.
Juri Linkov [Tue, 29 Apr 2025 16:55:48 +0000 (19:55 +0300)]
Ignore parens in strings for outline headings in emacs-lisp-mode.
* lisp/outline.el (outline-font-lock-keywords): For non-nil
outline-search-function return a lambda that calls the function,
then sets the match data to the end of the line that is equivalent
to adding ".*" in the regexp. Then search functions don't need to
match ".*" themselves.
* lisp/progmodes/elisp-mode.el (elisp-outline-search):
New function to skip leading parens in strings when searching
for outline headings.
(emacs-lisp-mode): Set buffer-local 'outline-search-function' to
'elisp-outline-search'.
https://lists.gnu.org/archive/html/emacs-devel/2025-04/msg00934.html
João Távora [Tue, 29 Apr 2025 11:20:51 +0000 (12:20 +0100)]
Eglot: improve diagnostic-reporting performance
After a change in the buffer has occured, it is often the case
that Flymake is quicker to ask for diagnostics than the server
is to supply them to us. If we're still stuck with old outdated
diagnostics, don't forward them to Flymake, even if it eagerly
asks us for them.
* etc/EGLOT-NEWS (Changes in upcoming Eglot): Announce changes.
* lisp/progmodes/eglot.el
(eglot--diagnostics): Rework.
(eglot--report-to-flymake): Also take version.
(eglot-handle-notification textDocument/publishDiagnostics)
(eglot--managed-mode)
(eglot-flymake-backend): Tweak call to eglot--report-to-flymake.
Yuan Fu [Sat, 15 Mar 2025 05:56:18 +0000 (22:56 -0700)]
Update tree-sitter subroutine in Fsubst_char_in_region
Some explanation: Fsubst_char_in_region used to have a branch,
one branch path calls replace_range, one branch path modifies
the buffer directly. replace_range already calls
treesit_record_change within it, so we needed to make sure we
only call treesit_record_change in the other branch path.
After I added the call to treesit_record_change, some changes
are made to Fsubst_char_in_region, and the branch was removed.
So no wonder Stefan had the confusion and wrote the FIXME note.
Now that the branch is gone, we can indeed call
treesit_record_change in the end like signal_after_change.
* src/editfns.c (Fsubst_char_in_region): Move to end.
Sean Whitton [Mon, 28 Apr 2025 13:32:12 +0000 (21:32 +0800)]
New log-edit-maybe-show-diff option for log-edit-hook
* lisp/vc/log-edit.el (log-edit-maybe-show-diff): New function.
(log-edit-hook): Add it as an option.
(log-edit-diff-function):
* etc/NEWS: Document it.
* lisp/vc/log-edit.el (log-edit-diff-function): Document that
the function *should* leave the window selected when it returns.
(log-edit-diff-fileset):
* lisp/vc/vc.el (vc-modify-change-comment):
Don't use save-selected-window (bug#77946).
(vc-diff-patch-string):
Call pop-to-buffer, not display-buffer (bug#77946).
Fix various bugs, including bug#77718, by rewriting the way file
name completion handles environment variable expansion. Instead
of using completion-table-with-quoting to manipulate the string
being completed on, simply make the completion table itself
understand substitute-in-file-name.
Tests are updated: partial-completion now preserves unexpanded
environment variables. However, partial-completion no longer
works across environment variables containing delimiters; that's
an acceptable sacrifice.
* lisp/minibuffer.el (completion--sifn-boundaries): Add.
(completion--file-name-table): Rewrite to use
substitute-in-file-name explicitly. (bug#77718)
* test/lisp/minibuffer-tests.el (completion-table-test-quoting):
Update.
Spencer Baugh [Tue, 4 Jun 2024 14:35:10 +0000 (10:35 -0400)]
Don't escape "." in `prin1' when followed by a letter
Among other users, let-alist widely uses symbols which start with a ".".
Make those symbols print more nicely by tweaking the escaping rules in
print_object to not escape a leading "." followed by a letter. This is
a conservative change to avoid constraining future lexer changes.
This is a followup to 637dde4aba921435f78d0de769ad74c4f3230aa6, which
removed some unnecessary escaping of "." and "?" when printing symbols
in prin1. (Actually, if we always escaped "?" (which was the case
before 637dde4aba92) then "." only ever needs to be escaped when
string_to_number returns non-nil. So 637dde4aba92 could have just
dropped the escaping of "." with no other changes, if it didn't also
remove escaping of "?")
* src/print.c (print_object): Don't escape "." as the first
character in a symbol if followed by a letter. (bug#77656).
* test/src/print-tests.el (test-dots): Update for new behavior.
Stefan Monnier [Mon, 28 Apr 2025 17:35:09 +0000 (13:35 -0400)]
(Custom-dirlocals-mode): Let `define-derived-mode` do its job
* lisp/cus-edit.el (Custom-dirlocals-mode-map): Rename from
`custom-dirlocals-map`.
(Custom-dirlocals-menu): Adjust accordingly.
(Custom-dirlocals-mode): Let `define-derived-mode` do its job.
Use `run-mode-hooks`.
* lisp/progmodes/flymake.el (flymake--eol-overlay-summary):
Rework. Move to separate section.
(flymake--update-eol-overlays): Rework. Use 'display'. Move to
separate section.
(flymake--eol-draw-fancy-1, flymake--eol-draw-fancy): New helpers.
(flymake-end-of-line-diagnostics-face): Remove box.
Michael Shields [Sat, 19 Apr 2025 19:58:26 +0000 (12:58 -0700)]
Fix use-package :custom-face to set face-defface-spec (bug#77928)
By default, `face-set-spec' sets the override face spec, so face
attributes are combined with defaults rather than replacing them.
This was a behavior change that was an apparently unintended
consequence of commit 6b344a9.
Also set the `face-modified' property, which causes Customize to
flag the face as changed outside Customize.
Sean Whitton [Sun, 27 Apr 2025 03:45:54 +0000 (11:45 +0800)]
Improve syncing VC buffers before generating diffs
* lisp/vc/vc.el (vc-maybe-buffer-sync): Delete. Correct
handling of indirect buffers is now implicitly achieved by
vc-buffer-sync-fileset.
(vc-buffer-sync-fileset): Make NOT-ESSENTIAL argument optional,
new MISSING-IN-DIRS optional argument. Rewrite to handle
directories named in the fileset, not only files.
(vc-ediff): Replace call to vc-maybe-buffer-sync with a call to
vc-buffer-sync-fileset.
(vc-root-diff): Similarly replace call to vc-maybe-buffer-sync.
This means the user is prompted to save additional buffers, that
they likely want to save before generating the diffs.
* test/lisp/vc/vc-misc-tests.el: New file.
Sean Whitton [Sat, 26 Apr 2025 05:15:55 +0000 (13:15 +0800)]
vc-diff: Delete redundant call to vc-maybe-buffer-sync
This call is redundant with the subsequent call to
vc-buffer-sync-fileset. I believe this call to
vc-maybe-buffer-sync was reintroduced by accident -- the
changeset adding the call to vc-buffer-sync-fileset deleted a
call to vc-sync-fileset in the same place.
* lisp/vc/vc.el (vc-diff): Delete redundant call to
vc-maybe-buffer-sync.
* lisp/files.el (find-buffer-visiting): Note in docstring that
this function only ever returns base buffers.
csharp-mode.el: Improve fontification of string-interpolation exprs
* lisp/progmodes/csharp-mode.el
(csharp-ts-mode--font-lock-settings): Remove too wide selector,
causing non-string content to be fonitified as strings. Add
additional eselectors to highlight variables inside
interpolation-expressions too. (Bug#78008)
Paul Nelson [Mon, 21 Apr 2025 20:14:53 +0000 (22:14 +0200)]
Add "forward history" support for some debuggers
* lisp/progmodes/gud.el (gud-query-cmdline): Add an optional
default-list parameter to allow passing a list of "forward
history" suggestions to the minibuffer.
(perldb, pdb, guiler): Use buffer file name to suggest a default
debugging command via "forward history".
* doc/emacs/building.texi (Starting GUD): Document the new
feature.
Paul Nelson [Mon, 21 Apr 2025 14:25:06 +0000 (16:25 +0200)]
Don't consider "Grep finished" lines as matches for file names
* lisp/progmodes/grep.el
(grep-compilation-transform-finished-rules): New variable
containing rules to prevent "Grep finished" lines from being
misinterpreted as matches for file names.
(grep-mode): Add these rules to
'compilation-transform-file-match-alist' (bug#77732).
Liu Hui [Mon, 21 Apr 2025 04:46:55 +0000 (12:46 +0800)]
Fix filename completion in Python shell (bug#77853)
'comint-filename-completion' may complete the filename at
wrong locations. Users who want proper filename completion
should use specialized completion backends (e.g. Jedi).
* lisp/progmodes/python.el (inferior-python-mode): Remove
'comint-filename-completion' in 'comint-dynamic-complete-functions'.
Before d50c82f3e98e ("Simplify
'help-enable-variable-value-editing' using 'string-edit'"),
'help-fns-edit-variable' would open a buffer in 'emacs-lisp-mode'
and would not allow exiting that buffer with an invalid Lisp
expression. Restore that functionality by enhancing 'string-edit'
to allow choosing a major mode and allow passing a function to
validate the buffer contents before returning.
* lisp/help-fns.el (help-fns-edit-variable): Call 'string-edit',
passing 'emacs-lisp-mode' and 'read'.
* lisp/textmodes/string-edit.el (string-edit--read): Add.
(string-edit): Add :major-mode and :read arguments and avoid
passive voice.
(read-string-from-buffer): Avoid passive voice in docs.
(string-edit-mode-map, string-edit-minor-mode-map)
(string-edit-mode, string-edit-minor-mode): Move 'string-edit'
keybindings to a minor mode.
(string-edit-done): Call 'string-edit--read' before exiting.
(Bug#77834)
* lisp/progmodes/python.el (python-nav-cache)
(python-nav-cache-tick): New variables.
(python-nav-cache-get, python-nav-cache-set)
(python-nav-with-cache): New functions.
(python-nav-beginning-of-block, python-nav-end-of-block): New
wrapper functions.
(python-nav--beginning-of-block): Renamed from
'python-nav-beginning-of-block'.
(python-nav--end-of-block): Renamed from
'python-nav-end-of-block'. (Bug#77620)
Performance optimization of 'python-info-statement-ends-block-p'
* lisp/progmodes/python.el (python-info-statement-ends-block-p):
Add a comparison of the indentation of the next statement with
the indentation of the current statement. (Bug#77620)
Yuan Fu [Sat, 26 Apr 2025 00:38:58 +0000 (17:38 -0700)]
Add multivar indent style in typescript-ts-mode (bug#77803)
* lisp/progmodes/typescript-ts-mode.el:
(typescript-ts-mode-multivar-indent-style): New option.
(typescript-ts-mode--indent-rules): Support both styles.
Sean Whitton [Thu, 24 Apr 2025 07:38:34 +0000 (15:38 +0800)]
comment-indent: Handle BOL already within a multiline comment
* lisp/newcomment.el (comment-indent): Newly handle the case
that BOL is already within a multiline comment (bug#78003).
Thanks to Stefan Monnier for review and reworking the control
flow.