Commit graph

99097 commits

Author SHA1 Message Date
Aaron Jensen
16a7051888 Fix indentation of keyword argument arrays/hashes in ruby-mode
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Check for ':' and
'=>' as previous tokens, and handle symbols ending with ':' to
properly indent keyword argument arrays and hashes when
ruby-bracketed-args-indent is nil.

* lisp/progmodes/ruby-ts-mode.el (ruby-ts--parent-call-or-bol):
Handle arrays/hashes that are children of 'pair' nodes (keyword
arguments) to ensure consistent indentation.

* test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb:
Add test cases for keyword argument arrays and hashes with both
symbol-colon and hash-rocket syntax.

When ruby-bracketed-args-indent is nil, arrays and hashes used as
keyword argument values now indent by ruby-indent-level from the
line start, matching the documented behavior and fixing inconsistent
indentation (bug#74517).

(https://lists.gnu.org/archive/html/emacs-devel/2025-11/msg00939.html)
2025-11-26 01:31:12 +02:00
Sean Whitton
47aec3cbc9 Make it easier to enable Abbrev mode by default
* lisp/cus-start.el: Make 'abbrev-mode' customizable.
* doc/emacs/abbrevs.texi (Abbrev Concepts):
* etc/NEWS:
* src/buffer.c (syms_of_buffer): <abbrev-mode>: Document
enabling Abbrev mode by default in all buffers by customizing
'abbrev-mode' to a non-nil value.
2025-11-25 22:08:19 +00:00
Sean Whitton
158bf5da77 Refine VC-Dir mass mark changes
* lisp/vc/vc-dir.el (vc-dir-mark-file): Prompt before unmarking
all subitems.  Use y-or-n-p and user-error instead of
yes-or-no-p and error.
(vc-dir-unmark-file): Use y-or-n-p instead of yes-or-no-p.
(vc-dir-allow-mass-mark-changes): Update docs.
2025-11-25 21:37:27 +00:00
Sean Whitton
304d4435b1 Make diff-revert-and-kill-hunk consider an active region
* lisp/vc/diff-mode.el (diff-revert-and-kill-hunk): When the
region is active, operate on all hunks it overlaps.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change.
2025-11-25 21:07:04 +00:00
Sean Whitton
f5953186ef ; * lisp/emacs-lisp/pcase.el (pcase-setq): Fix parameter names. 2025-11-25 21:05:50 +00:00
Sean Whitton
39e9f96ba0 ; * lisp/emacs-lisp/cond-star.el: Tidy up dummy macro definitions. 2025-11-25 20:30:21 +00:00
Sean Whitton
449e15de5b ; * lisp/vc/diff-mode.el (diff-goto-source): Revise docstring again. 2025-11-25 15:53:15 +00:00
Sean Whitton
59e8b7267f Make diff-apply-hunk consider an active region
* lisp/vc/diff-mode.el (diff-apply-buffer): New 'no-save'
meaning for fourth optional argument.  Reserve other non-nil
values for this argument.  Use ngettext for one message.
(diff-apply-hunk): If the region is active, apply all hunks that
the region overlaps, like diff-apply-buffer.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change to diff-apply-hunk.
2025-11-25 14:53:19 +00:00
Sean Whitton
1844ce4a0f * lisp/emacs-lisp/cond-star.el (pcase*): New dummy definition. 2025-11-25 14:22:58 +00:00
Sean Whitton
3f6c7d1bfb ; diff-mode-el: Improve docstrings re diff-jump-to-old-file. 2025-11-25 14:06:29 +00:00
Alan Mackenzie
9b505dd8d4 CC Mode: update Version: header. Add a comment about it
* lisp/progmodes/cc-defs.el (c-version): Add a comment
encouraging maintainers to keep cc-mode.el's Version: header
the same.

* lisp/progmodes/cc-mode.el (top level): Update the Version:
  header to 5.35.2.
2025-11-25 12:00:55 +00:00
Po Lu
0d1bb23d8c Fix mouse dragging on touch screens
* lisp/mouse.el (mouse-position-for-drag-line): New function;
return position of active touch screen tool if a sequence is
being translated into mouse movement events, and the last mouse
position otherwise.
(mouse-drag-line): Invoke `mouse-position-for-drag-line' rather
than reading the mouse position manually.

* lisp/touch-screen.el (touch-screen-current-tool): New 10th
field holding the frame-relative last attested position of this
tool.
(touch-screen-relative-xy): Clarify doc string.
(touch-screen-handle-point-update): Update the said field with
POSN's position relative to its frame.
(touch-screen-handle-touch): Initialize the 10th field of new
tool lists with such a position.
(touch-screen-last-drag-position): New function.
2025-11-25 10:48:56 +08:00
Philip Kaludercic
c767928997
Only search for package descriptors in package root
See the following thread for a background on this change:
https://mail.gnu.org/archive/html/emacs-devel/2025-08/msg00332.html.
This change reverts b81f937e.

* lisp/emacs-lisp/package.el (package-dir-info): Do not
recursively try to find all Lisp files that might have package
metadata.  (Bug#79742)
2025-11-24 20:53:22 +01:00
Philip Kaludercic
c3604c3224
; Fix issue when installing packages from Dired
* lisp/emacs-lisp/package.el (package-dir-info, package-unpack):
Force Dired to return list of packages explicitly marked for
installation.  Without the optional argument, Dired will return
the file under the current point if no files are selected.
2025-11-24 20:53:22 +01:00
Philip Kaludercic
4ea81f359c
Replace underscores in bind-and* with fresh symbols
* lisp/emacs-lisp/cond-star.el (cond*-convert-condition): Bind
unused values to fresh symbols, to avoid the compiler warning
that a symbol starting with an underscore is accessed later on.
This mirrors the behaviour of `if-let*' and family.
2025-11-24 20:53:22 +01:00
Juri Linkov
33d813c63b Fix query-replace-regexp for using '^' with calculated replacement '\,'
* lisp/replace.el (replace--push-stack): Add new args
'next-replacement' and 'match-again' and push them to the stack.
(perform-replace): Restore the previous already calculated values
of 'next-replacement' and 'match-again' from the stack for the
'backup' ('^') key (bug#79811).

* test/lisp/replace-tests.el (query-replace-tests): Add tests.
2025-11-24 20:14:15 +02:00
Stefan Monnier
b852555401 Don't apply EditorConfig files to themselves
* lisp/international/mule.el (auto-coding-alist): Add entry for
`.editorconfig` files.
2025-11-24 11:42:27 -05:00
Sean Whitton
4cc42911ed Persist Log View mode marks across buffer revert
* lisp/vc/log-view.el (vc-exec-after): Autoload.
(log-view--restore-marks): New function.
(log-view-mode): Add it to revert-buffer-restore-functions.
2025-11-24 16:04:42 +00:00
Stefan Monnier
e233513d28 editorconfig-core-handle.el: Fix silent misparse
See https://github.com/editorconfig/editorconfig-emacs/issues/380

* lisp/editorconfig-core-handle.el (editorconfig-core-handle--parse-file):
Fix regexp to not inadvertently match LF.  Remove an O(N²) complexity.
Use `line-number-at-pos`.

* lisp/editorconfig.el (editorconfig--get-coding-system): Don't let
errors propagate.
2025-11-24 10:26:21 -05:00
Stephen Gildea
1f2a161f93 ; * lisp/time-stamp.el: Reformat some doc strings. 2025-11-23 18:32:41 -08:00
Stephen Gildea
435c3948a4 ; * lisp/time-stamp.el: Minor code changes
autoloads: quote function names with #'
(time-stamp-filtered-buffer-file-name): 'member' -> 'memq'
(time-stamp-conv-warn): don't call the formats "forms".
2025-11-23 18:11:18 -08:00
Sean Whitton
11b68c6223 New commands to rewind decentralized VCS branches
* lisp/vc/vc.el (vc--remove-revisions-from-end): New function.
(vc-uncommit-revisions-from-end, vc-delete-revisions-from-end):
* lisp/vc/log-view.el (log-view-uncommit-revisions-from-end)
(log-view-delete-revisions-from-end): New commands (bug#79408).
(log-view-mode-map): Bind them.
* doc/emacs/maintaining.texi (VC Change Log):
* doc/emacs/vc1-xtra.texi (VC Auto-Reverting):
* etc/NEWS: Document them.
2025-11-23 18:36:22 +00:00
Ulf Jasper
dcc909917b Add 'newsticker--treeview-handle-url' (Bug#79849)
* lisp/net/newst-treeview.el (newsticker--treeview-url-keymap)
(newsticker--treeview-handle-url): Add 'newsticker--treeview-handle-url'
to replace 'newsticker-handle-url' in newsticker-treeview (Bug#79849).
2025-11-23 13:58:43 +01:00
Eli Zaretskii
bb1f70c901 Fix 'd' command in 'query-replace' in buffers not visiting files
* lisp/vc/diff.el (diff-file-local-copy): Use proper coding-system
when writing a local copy of a non-file visiting buffer.

* lisp/misearch.el (coding-system--for-buffer-diff): New variable.
(multi-file-replace-as-diff): Bind it to 'utf-8-emacs'.
(multi-file-diff-no-select): Use proper coding-system when reading
output of Diff.  (Bug#79761)
2025-11-23 10:33:49 +02:00
Elías Gabriel Pérez
6c30c6c87d ; hideshow: Rename 'hs--discard-overlay-after-change'.
* lisp/progmodes/hideshow.el (hs--discard-overlay-after-change):
Rename function and update docstring.
(hs-make-overlay): Update.
2025-11-23 09:48:27 +02:00
Sean Whitton
cd86307f26 vc-resynch-window: Restore always using vc-revert-buffer-internal
* lisp/vc/vc-dispatcher.el (auto-revert-buffers): Delete.
(vc-resynch-window): Always call vc-revert-buffer-internal.
Calling auto-revert-buffers will not necessarily revert the
current buffer, but we want it to happen synchronously.
2025-11-22 13:50:22 +00:00
Stefan Monnier
24c09c68dd lisp/ldefs-boot.el: Update generated presumably by lisp/Makefile.in (?) 2025-11-22 08:44:40 -05:00
Sean Whitton
75c09b03ed Default split-window-preferred-direction to 'longest'
* lisp/window.el (split-window-preferred-direction): Change
default value to 'longest'.
2025-11-22 13:20:05 +00:00
Sean Whitton
54775983ac vc-git-revision-published-p: Resolve REV
* lisp/vc/vc-git.el (vc-git-revision-published-p): Resolve REV
before using it, using vc-git--rev-parse.
2025-11-22 12:46:16 +00:00
Sean Whitton
748c3b2645 New command alias vc-restore
* lisp/vc/vc.el (vc-restore): New alias.
* etc/NEWS: Announce it.
2025-11-22 12:45:55 +00:00
Stefan Monnier
46d0f1fef1 (loaddefs-generate--make-autoload): Fix bug#79852
As JD Smith <jdtsmith@gmail.com> said we had 3 paths:

1. macro has `autoload-macro expand` and is already loaded: expand
2. macro has `autoload-macro expand` but is /not/ yet loaded: shortcut
3. macro does not have `autoload-macro expand`: shortcut

and the co-existence of 1 and 2 is a problem because it means
that same macro is sometimes handled one way and sometimes
another, with different results.
Remove number 2 by removing from the shortcut all the remaining
macros that have `autoload-macro expand`.

The immediate effect is that `make autoloads` now (auto)loads three
more files:

    [...]
    loaddefs-gen: loading file frameset (for cl-defun)
    Loading frameset...
      INFO     Scraping 1547 files for loaddefs...10%
      INFO     Scraping 1547 files for loaddefs...20%
    loaddefs-gen: loading file semantic/analyze (for define-overloadable-function)
    Loading semantic/analyze...
      INFO     Scraping 1547 files for loaddefs...30%
      INFO     Scraping 1547 files for loaddefs...40%
      INFO     Scraping 1547 files for loaddefs...50%
      INFO     Scraping 1547 files for loaddefs...60%
      INFO     Scraping 1547 files for loaddefs...70%
    loaddefs-gen: loading file tramp-adb (for tramp--with-startup)
    Loading tramp-adb...
      INFO     Scraping 1547 files for loaddefs...80%
    loaddefs-gen: loading file grep (for define-compilation-mode)
    Loading grep...
    [...]

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros):
Remove macros that are marked `autoload-macro expand`, even if they are
not predefined.
(loaddefs-generate--make-autoload): Simplify accordingly.
2025-11-22 06:56:46 -05:00
Stefan Monnier
b193a78a6f (loaddefs--defining-macros): Weed out a few more entries
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros):
Remove `define-skeleton`, `define-derived-mode`, and
`define-generic-mode` since their `autoload-macro expand` property is
now preloaded.
2025-11-22 06:56:46 -05:00
Stefan Monnier
10961728dc : Update ldefs-boot.el 2025-11-22 06:56:46 -05:00
Stefan Monnier
74087e252f loaddefs-gen: Weed out some elements from the shortcut path
The predefined macros marked as `autoload-macro expand` can't
get to the shortcul path, so simplify it accordingly.
Mark a few more macros from the shortcut path as `autoload-macro expand`
but don't remove them yet from the shortcut path (need to update
`ldefs-boot.el`).

* lisp/progmodes/compile.el (define-compilation-mode):
* lisp/emacs-lisp/generic.el (define-generic-mode):
* lisp/emacs-lisp/derived.el (define-derived-mode):
* lisp/cedet/mode-local.el (define-overloadable-function):
* lisp/skeleton.el (define-skeleton): Mark as `autoload-macro expand`
so as to make the "shortcut" path in `loaddefs-gen.el` redundant.

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros):
Remove the easy-mmode.el macros since they are already marked as
`autoload-macro expand` and they are always defined, so we never check
them against that list.
(loaddefs-generate--make-autoload): Remove handling of the
`easy-mmode.el` macros as well as `defun` and `defmacro` from the
shortcut path since we can never get there with them anyway.
2025-11-22 06:56:46 -05:00
Reuben Thomas
e1f851e840 Fix ispell’s handling of comment-end when adding local words
* lisp/textmodes/ispell.el (ispell-add-per-file-word-list): Deal
with `comment-end' in a way that works for comments that don’t
nest.

We proceed as follows: when `comment-end' is non-empty, we only
ever insert one start and one end comment, the first time we add
a local word.  This works with both C-style (which don’t nest)
and Rust-style comments (which do).

If we’re using line comments (i.e. comments that only have a
`comment-start'), then continue to insert one on each line.

* test/lisp/textmodes/ispell-tests/ispell-tests.el
(ispell/ispell-add-per-file-word-list/nxml): Adjust test.

Bug#79871
2025-11-22 13:15:45 +02:00
john muhl
959e67ec4f Fix non-interactive use of 'lua-start-process'
* lisp/progmodes/lua-mode.el (lua-process-init-code): Add newline.
(lua-start-process): Use 'process-send-string' to avoid starting
two processes.  Flatten 'switches' argument since rest arguments
get added to a list.  Replace 'switch-to-buffer' with
'pop-to-buffer' so that the process window behavior can be
customized with 'display-buffer-alist'.  Expand docstring and
update it to match the code.  (Bug#79853)
2025-11-22 13:03:24 +02:00
Protesilaos Stavrou
dd1d85ebdd Make Flymake fringe indicators use dedicated faces
* lisp/progmodes/flymake.el (flymake-error-bitmap)
(flymake-warning-bitmap, flymake-note-bitmap): Define new faces.
(flymake-error-fringe, flymake-warning-fringe)
(flymake-note-fringe): Use the new faces by default.
(Bug#79785)
2025-11-22 13:01:18 +02:00
Ahmed Khanzada
bc0f662573 Add `toolkit-theme' and 'toolkit-theme-set-functions'
* etc/NEWS: Document `toolkit-theme' and
'toolkit-theme-set-functions'
* lisp/frame.el: Add 'toolkit-theme-set-functions'
* src/frame.c: Add `toolkit-theme' Elisp variable
* src/gtkutil.c: (xg_update_dark_mode_for_all_displays): Set
`toolkit-theme' and call 'toolkit-theme-set-functions'
* src/w32fns.c: (w32_applytheme): Send WM_EMACS_SET_TOOLKIT_THEME
message to Lisp thread.
* src/w32term.h: Declare WM_EMACS_SET_TOOLKIT_THEME
* src/w32term.c: (w32_read_socket): Receive
WM_EMACS_SET_TOOLKIT_THEME message and set `toolkit-theme' and call
'toolkit-theme-set-functions'
2025-11-22 12:57:53 +02:00
Pip Cet
e5130bdecc The --script option now enforces lexical binding (bug#79760)
* etc/NEWS: Document the change.
* lisp/startup.el (command-line--load-script): Set 'lexical-binding';
if we delete the first line, insert a new line to preserve line
numbers.
(command-line--eval-script): Set 'lexical-binding'.
2025-11-22 10:45:56 +00:00
RadioNoiseE
ce0d851614 Fix XML indentation for CDATA section content
* lisp/nxml/nxml-mode.el (nxml-merge-indent-context-type):
Handle 'cdata-section' type to prevent it from returning 'mixed'.
* lisp/nxml/nxml-mode.el (nxml-compute-indent-in-delimited-token):
Preserve existing indentation for CDATA section content.
(bug#79817)

Copyright-paperwork-exempt: yes
2025-11-22 12:03:16 +02:00
Ana
dfa646096a csharp-mode : Fix typos and remove duplicated declaration
* lisp/progmodes/csharp-mode.el (csharp-vsemi-unknown): Rename
to 'csharp-vsemi-unknown-p'.  The code was calling a function that
does not exist due to this typo.
(c-class-decl-kwds): Remove duplicated declaration for csharp.
(csharp-ts-mode--font-lock-settings): Remove duplicated declaration
of 'escape-sequence'.
2025-11-22 11:53:22 +02:00
Sean Whitton
37d4f523d3 ; * lisp/vc/vc.el (vc-revert): Use length< and ngettext. 2025-11-20 20:54:56 +00:00
Sean Whitton
0bf1eb692b Fix '(vc-revert-file (vc-git-root)'
* lisp/vc/vc-git.el (vc-git--file-list-is-rootdir):
Merge into vc-git-command.
(vc-git-command): When operating on the repository root, first
bind default-directory to that root.  When operating on the
repository root with 'git checkout', pass "." as FILE-OR-LIST.
2025-11-20 20:42:21 +00:00
Juri Linkov
f4d353f9c9 Show the diff buffer with replacements by typing 'd' in 'query-replace'
* doc/emacs/search.texi (Query Replace): Mention new key 'd'.

* lisp/replace.el (query-replace-help): Mention the key 'd'.
(query-replace-map): Bind the key 'd' to 'diff'.
(perform-replace): When 'def' is equal to 'diff',
call 'multi-file-replace-as-diff' to show the diff buffer
with replacements (bug#79761).
2025-11-20 20:39:29 +02:00
Juri Linkov
ae5c361d32 Support buffers in FILES arg of multi-file-replace-as-diff (bug#79761)
* lisp/misearch.el (multi-file-replace-as-diff): Allow providing
a list of buffers in the argument FILES.  Add autoload cookie.
(replace-regexp-as-diff): Provide the current buffer to
'multi-file-replace-as-diff' when 'buffer-file-name' is nil.
2025-11-20 20:31:12 +02:00
Sean Whitton
855aad48fa vc-exec-after: Drop passing zero timeout to accept-process-output
This reverts this change:

    Author:     Sean Whitton <spwhitton@spwhitton.name>
    AuthorDate: Thu Oct 30 20:45:31 2025 +0000
    Commit:     Sean Whitton <spwhitton@spwhitton.name>
    CommitDate: Fri Nov 7 15:40:25 2025 +0000

      vc-exec-after: Pass zero timeout to accept-process-output

      * lisp/vc/vc-dispatcher.el (vc-exec-after): Pass zero timeout to
      accept-process-output.
      Fix due to Spencer Baugh <sbaugh@janestreet.com>.

See thread starting at
<https://lists.gnu.org/archive/html/emacs-devel/2025-11/msg00263.html>
2025-11-20 18:15:24 +00:00
Vincenzo Pupillo
5cef0f9c2f Use documentation mark-up face for 'tag_name' node in document block.
Embedded documentation mark-up should be used for 'tag_name' in
documentation blocks (thanks to Protesilaos Stavrou).

* lisp/progmodes/c-ts-common.el
(c-ts-mode-doxygen-comment-font-lock-settings):
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--phpdoc-font-lock-settings): Replace 'font-lock-constant-face'
with 'font-lock-doc-markup-face' (bug#79856).
2025-11-20 19:48:41 +02:00
Elías Gabriel Pérez
bbd9727aa8 hideshow: Add modification hooks to remove the hidden blocks
bug#79865

* lisp/progmodes/hideshow.el (hs--discard-overlay-after-change):
New function.
(hs-make-overlay): Use the new function.
2025-11-20 19:42:01 +02:00
Stefan Monnier
4681042493 Editorconfig: Cherrypick from commit fbd078ad6478 from upstream
* lisp/editorconfig-core-handle.el (editorconfig-core-handle--parse-file):
Bump limits beyond the spec's minimum.
Cherrypick from commit fbd078ad6478 from upstream.
* lisp/editorconfig-fnmatch.el (editorconfig-fnmatch--do-translate):
Hoist `push` out of the `cl-case`.
2025-11-20 06:58:39 -05:00
Spencer Baugh
784d5b4954 Fix implicit usage of the current window-width in vtable.el
Previously, many functions in vtable.el called 'vtable--cache',
which computed 'vtable--cache-key' based on the current selected
window and frame; this could cause vtable functions to fail or
misbehave if they were not called from the selected window and
frame that 'vtable-insert' was last called in.

Now, the vtable cache is stored with the text of the vtable, so
that functions which need to interact with some vtable text can
do so reliably without having to use the same selected window
and frame.

Also, 'vtable-update-object' has always required TABLE to be
present at point in the current buffer; now its docstring states
this.

* lisp/emacs-lisp/vtable.el (vtable--current-cache)
(vtable--cache-widths, vtable--cache-lines): Add.
(vtable-insert): Save cache in 'vtable-cache.
(vtable--ensure-cache, vtable--recompute-cache): Inline into
'vtable-insert'.
(vtable--widths, vtable--cache): Delete.
(vtable-update-object): Use 'vtable--current-cache' and
update docstring.  (Bug#69837)
(vtable-remove-object, vtable-insert-object): Use
'vtable--current-cache' and save cache in 'vtable-cache'.
(vtable--sort, vtable--alter-column-width)
(vtable-previous-column, vtable-next-column): Use
'vtable--current-cache'.
2025-11-19 17:26:50 +02:00