Commit graph

178181 commits

Author SHA1 Message Date
Stefan Monnier
b13044dae3 cl-types: The big renaming to "derived types"
`cl-defstruct` also defines a type and is also in CL, so
"cl-type" is not precise enough to talk about those types
defined with `cl-deftype`.  Use the term "derived type" to be
more clear, as is done in the HyperSpec.

* doc/misc/cl.texi (Derived types): Move `cl-deftype` to this
new subsection.  Document the use of derived types as method specializers.

* lisp/emacs-lisp/cl-extra.el (cl--types-of-memo): Rename from
`cl--type-unique`.
(cl--derived-type-dispatch-list): Rename from `cl--type-dispatch-list`.
(cl--derived-type-generalizer): Rename from `cl--type-generalizer`.
(cl--derived-type-generalizers): Rename from `cl--type-generalizers`.

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) <derived-types>:
Rename from <cl-types-of>.  Catch but don't hide errors when a derived
type cannot be used as an atomic type specifier.

* lisp/emacs-lisp/cl-preloaded.el (cl--derived-type-list): Rename from
`cl--type-list`.
(cl-derived-type-class): Rename from `cl-type-class`.
(cl--derived-type-class-make): Rename from `cl--type-class-make`.
(cl--define-derived-type): Rename from `cl--type-deftype`.
2025-05-07 13:24:07 -04:00
David Ponce
f6f35644b7 (cl-types-of): Fix two plain bugs
* lisp/emacs-lisp/cl-extra.el (cl-types-of): Fix error handling.
Don't mutate `found` since it's stored as key in the hash-table.
2025-05-07 12:24:00 -04:00
Stefan Monnier
2eb90d43e6 (cl-generic-generalizers): Fix typo in last change 2025-05-06 23:04:46 -04:00
Stefan Monnier
147113b3b5 (cl-generic-generalizers): Skip types that need arguments
* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) "cl-types-of":
make sure the atomic derived type is valid.
2025-05-06 22:53:01 -04:00
Stefan Monnier
fc4d8ce951 cl-types: Integrate into CL-Lib
* lisp/emacs-lisp/cl-extra.el (cl--type-unique, cl-types-of)
(cl--type-dispatch-list, cl--type-generalizer): Move to `cl-extra.el`.
(cl--type-generalizers): New function extracted from "cl-types-of"
method of `cl-generic-generalizers`.

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers): New method to
dispatch on derived types.  Use `cl--type-generalizers`.

* lisp/emacs-lisp/cl-macs.el (cl-deftype): Move from `cl-types.el`
and rename from `cl-deftype2`.
(extended-char): Tweak definition to fix bootstrapping issues.

* lisp/emacs-lisp/cl-preloaded.el (cl--type-list, cl-type-class)
(cl--type-deftype): Move from `cl-types.el`.

* lisp/emacs-lisp/oclosure.el (oclosure): Don't abuse `cl-deftype` to
register the predicate function.

* test/lisp/emacs-lisp/cl-extra-tests.el: Move tests from
`cl-type-tests.el`.
2025-05-05 23:18:56 -04:00
Stefan Monnier
68a50324a7 cl-types: Simplify a bit further
Mostly, get rid of `cl--type-flag` and rely only on the presence/absence
of the type on `cl--types-list` to "flag" erroring-types.
Also, don't try and catch errors during dispatch.

* lisp/emacs-lisp/cl-types.el (cl--type-dispatch-list): Move to the
relevant section.
(cl--type-parents): Inline into sole caller.
(cl--type-deftype): Add `arglist` argument.
Don't signal an error if the type already existed but wasn't in
`cl--type-list` since that's normal and we can fix it.
Don't touch `cl--type-flag` any more.
Don't add to `cl--type-list` if it can't be used without arguments.
(cl-deftype2): Adjust call accordingly.
(cl--type-error): Inline into sole caller.
(cl-types-of): Be more careful to preserve ordering of types
before passing them to `merge-ordered-lists`.
Add `types` argument for use by dispatch.
Don't bother skipping the `root-type` since that's a built-in type,
so it should never happen anyway.
Don't catch errors if called from dispatch.
Don't bother with `cl--type-flag`.
(cl--type-generalizer): Use new arg of `cl-types-of` instead of
let-binding `cl--type-list`, in case `cl-types-of` ends up (auto)loading
a file or some such thing which needs to use/modify `cl--type-list`.
(cl--type-undefine): Move to end of file.

* test/lisp/emacs-lisp/cl-types-tests.el (cl-types-test): Remove DAG
test since we don't detect such errors any more.
Relax ordering test when the order is not guaranteed
by parent-relationships.
2025-05-05 14:57:05 -04:00
David Ponce
8f649c4270 cl-types.el: Speed up deftype and dispatch
* lisp/emacs-lisp/cl-types.el (cl--type-list): Doc string.
(cl--type-dispatch-list): New variable.
(cl--type-parents): Make it a plain defun.
(cl--type-children, cl--type-dag): Remove.
(cl--type-undefine): Remove duplicate test for `cl--type-p'.  Use
`cl--class-children'.  Clear `cl--type-flag' instead of
`cl--type-error'.  Also remove type from the dispatch list.
(cl--type-deftype): Doc string.  Remove useless safeguard of
data on error.  Fix some error messages.  Clear `cl--type-flag'
when a type is (re)defined.  Just push new types on
`cl--type-list'.
(cl--type-error): Set `cl--type-flag' to the symbol `error' and
remove type in error from the dispatch list.
(cl-types-of): Doc string.  Remove useless check for
`cl-type-class-p'.  Skip types which we are sure will not match.
Simplify creation of the DAG.
(cl--type-generalizer): In the tagcode-function, check only types
that can be dispatched.
(cl-generic-generalizers): Populate the dispatch list.
2025-05-05 11:03:56 -04:00
David Ponce
4323ff209f (cl-types-of): Speed up by caching more of its work
* lisp/emacs-lisp/cl-types.el (cl--type-parents): Make it a proper function.
(cl--type-children): Use `cl--class-children` and make it a `defsubst`.
(cl--type-dag): η-reduce and make it a `defsubst`.
(cl--type-undefine): Also reset `cl--type-error`.
(cl--type-deftype): Modify `cl--type-list` atomically so we never need
to restore it upon error.  Don't test bogus parent here.
(cl-deftype2): Test bogus parent here instead.  Also, better preserve
the declarations for the lambda.
(cl-types-of): Do less uncached work.
2025-04-29 10:48:37 -04:00
Stefan Monnier
dfbeb7478e lisp/emacs-lisp/cl-types.el: New file
* test/lisp/emacs-lisp/cl-types-tests.el: Also, new file.
2025-04-28 15:47:46 -04:00
Spencer Baugh
509cbe1c35 Improve env var handling in read-file-name
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.
2025-04-28 14:00:27 -04:00
Spencer Baugh
21e340494a 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 637dde4aba, which
removed some unnecessary escaping of "." and "?" when printing symbols
in prin1.  (Actually, if we always escaped "?" (which was the case
before 637dde4aba) then "." only ever needs to be escaped when
string_to_number returns non-nil.  So 637dde4aba 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.
2025-04-28 13:46:40 -04:00
Stefan Monnier
a0f26f3eaf (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`.
2025-04-28 13:35:09 -04:00
Michael Albinus
c801856820 ; Fix previous change
* test/lisp/url/url-parse-tests.el
(url-generic-parse-url/ms-windows-file-uri-handling): Rename.
2025-04-28 08:22:09 +02:00
Sebastián Monía
bc5afe421b url-parse.el: correct code for Windows paths (bug#76982)
* lisp/url/url-parse.el (url-recreate-url): Handle empty filenames
without errors.

* test/lisp/url/url-parse-tests.el
(url-generic-parse-url/ms-windows-file-uri-hanlding): Add one
more test for the scenario above.
2025-04-28 08:19:06 +02:00
Sean Whitton
c0491a8b80 ; project-vc-include-unregistered: Add FIXME about renaming. 2025-04-28 10:46:48 +08:00
Sean Whitton
56baa23e1a ; * doc/emacs/maintaining.texi (VC-Aware Project Backend): Copyedit. 2025-04-28 10:46:10 +08:00
Tim Landscheidt
4765a3b3f2 Fix ruby lint output regexps
* doc/misc/flymake.texi (An annotated example backend):
Fix regexp.

* lisp/progmodes/ruby-mode.el (ruby-flymake-simple)
(ruby-flymake-rubocop): Fix regexp
(https://lists.gnu.org/archive/html/emacs-devel/2025-04/msg00851.html).
2025-04-28 03:05:41 +03:00
Dmitry Gutov
568a4894a8 * doc/emacs/maintaining.texi (VC-Aware Project Backend):
* doc/emacs/maintaining.texi (VC-Aware Project Backend):
New node (bug#77974).
(Projects): Use "backend" instead of "back-end".
2025-04-28 01:43:23 +03:00
Po Lu
74e3755eb6 Merge from savannah/emacs-30
aa1b55d521 Fix the Android build
2025-04-27 21:09:29 +08:00
Po Lu
5478e3bb20 ; Merge from savannah/emacs-30
The following commit was skipped:

d394cd73d1 Avoid infinite recursion under 'rectangle-mark-mode'
2025-04-27 21:09:29 +08:00
Po Lu
d87cde3177 Merge from savannah/emacs-30
b5967dda32 ; * doc/misc/ert.texi (Introduction): Be more Lisp-specific.
be4819bd57 Include additional version metadata during Windows install
2025-04-27 21:09:29 +08:00
Po Lu
aa1b55d521 Fix the Android build
* java/README.res: Move from java/res/README, as the AAPT does
not permit non-resource files in resource directories.
2025-04-27 21:08:48 +08:00
João Távora
0262e3e158 Flymake: Experimental 'fancy' flymake-show-diagnostics-at-end-of-line
* doc/misc/flymake.texi (Customizable variables): Describe new
flymake-show-diagnostics-at-end-of-line.

* etc/NEWS: Mention 'flymake-show-diagnostics-at-end-of-line'.

* lisp/progmodes/flymake.el
(flymake-show-diagnostics-at-end-of-line): Update docstring.

* 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.
2025-04-27 13:03:19 +01:00
Michael Shields
ebcde0f90f 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.

* doc/misc/use-package.texi (Faces): Document the behavior.
* lisp/use-package/use-package-core.el (use-package-handler/:custom-face):
(use-package): Improve docstring to reflect implementation.
* test/lisp/use-package/use-package-tests.el
(use-package-test/:custom-face-1): (use-package-test/:custom-face-2):
(use-package-test/:custom-face-3): (use-package-test/:custom-face-4):
Add tests.
2025-04-27 10:48:55 +03:00
Eli Zaretskii
d394cd73d1 Avoid infinite recursion under 'rectangle-mark-mode'
* lisp/rect.el (rectangle--region-beginning)
(rectangle--region-end): Avoid infinite recursion.  Patch by Alcor
<alcor@tilde.club>.  Do not merge to master.  (Bug#77973)
2025-04-27 10:08:38 +03:00
Adam Sjøgren
0c55cd0e17 Improve documentation of 'insert-kbd-macro'
* lisp/macros.el (insert-kbd-macro): Update documentation
of what happens when no macro name is supplied.

* doc/emacs/kmacro.texi (Save Keyboard Macro): Document
saving 'last-kbd-macro'.  (Bug#77317)
2025-04-27 09:52:25 +03:00
Sean Whitton
925ac2ef70 Mark vc-dav.el as obsolete (bug#77626)
* lisp/vc/vc-dav.el: Move from here ...
* lisp/obsolete/vc-dav.el: ... to here (bug#77626).
Add Obsolete-since header.
* etc/NEWS: Announce the obsoletion.
2025-04-27 12:30:41 +08:00
Sean Whitton
b5967dda32 ; * doc/misc/ert.texi (Introduction): Be more Lisp-specific. 2025-04-27 11:59:17 +08:00
Sean Whitton
07c2b169ed 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.
2025-04-27 11:52:53 +08:00
Sean Whitton
d047a89e76 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.
2025-04-27 11:52:53 +08:00
Sean Whitton
6b204c2d16 Rename vc-buffer-sync's argument to NOT-ESSENTIAL
* lisp/vc/vc-dispatcher.el (vc-buffer-sync):
* lisp/vc/vc.el (vc-maybe-buffer-sync, vc-diff)
(vc-buffer-sync-fileset, vc-ediff, vc-root-diff):
Rename argument from NOT-URGENT to NOT-ESSENTIAL.
2025-04-27 11:52:53 +08:00
Sean Bright
be4819bd57 Include additional version metadata during Windows install
* admin/nt/dist-build/emacs.nsi: Add DisplayIcon, DisplayVersion, and
  Publisher values to the Uninstall registry key.

Copyright-paperwork-exempt: yes
2025-04-26 14:21:21 -05:00
Eli Zaretskii
191b4cd9a7 ; Fix compilation warning in string-edit.el
* lisp/textmodes/string-edit.el (string-edit): Avoid shadowing the
global 'major-mode'.
2025-04-26 18:01:42 +03:00
Eli Zaretskii
86211172e3 Merge from origin/emacs-30
1f520db97b * doc/emacs/files.texi (Time Stamp Customization): Typo.
d824b66c24 ; * doc/emacs/search.texi (Isearch Yank): Improve flow.
62b284f915 ; * etc/DEBUG: Say that debugging code compiled w/ -Og ca...
49ea1f64c7 ; Improve documentation of 'modifier-bar-mode'
a975232c0f ; * doc/emacs/programs.texi (Matching): Fix wording (bug#...
29142dab31 ; * doc/misc/efaq-w32.texi (MinGW-w64): Fix punctuation (...
4cd4a801d8 ; * java/res/README: Note origin of emacs_wrench.png.
2025-04-26 10:57:33 -04:00
Eli Zaretskii
09f4818eba ; Merge from origin/emacs-30
The following commit was skipped:

cc52c1e1d0 Backport: fix flymake margin indicator fallback logic
2025-04-26 10:53:24 -04:00
Eli Zaretskii
1c7fe501fe Fix 'kill-ring-deindent-mode'
* lisp/indent-aux.el
(kill-ring-deindent-buffer-substring-function): Fix deindenting
for modes which set 'indent-tab-mode' to nil.  (Bug#77981)
2025-04-26 17:30:20 +03:00
Eli Zaretskii
f7aad714d2 Avoid signaling errors in 'cursor-face-highlight-mode'
* lisp/simple.el (redisplay--update-cursor-face-highlight): Don't
go beyond the accessible portion of the buffer.  (Bug#77747)
2025-04-26 17:20:01 +03:00
Jens Schmidt
ec8075219d ; Fix previous arc-mode-test commit
* test/lisp/arc-mode-tests.el (define-arc-mode-test-on-type): Doc fix.
("7z"): Use archiver executable "7z" on all ports.
2025-04-26 17:09:00 +03:00
Manuel Giraud
af22c9292d Reuse calendar temporary faces
* lisp/calendar/calendar.el (calendar-make-temp-face): Reuse
temporary face produced by calendar.  (Bug#78036)
2025-04-26 17:05:16 +03:00
Eli Zaretskii
98776ebd39 Fix thai-pattachote input method
* lisp/leim/quail/thai.el (thai-pattachote): Add missing
characters instead of duplicate ones.  Suggested by Robert
Nikander <robert.nikander@icloud.com>.  (Bug#77998)
2025-04-26 16:46:34 +03:00
Jostein Kjønigsen
67e8351bdb 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)
2025-04-26 16:25:11 +03:00
Paul Nelson
f808f637f5 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.

(Bug#77989)
2025-04-26 16:21:21 +03:00
Paul Nelson
dd3429526a 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).
2025-04-26 15:34:54 +03:00
Eli Zaretskii
406f30c985 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2025-04-26 15:32:16 +03:00
Sean Whitton
19b6c94566 log-edit-insert-message-template: Reorder headers
* lisp/vc/log-edit.el (log-edit-insert-message-template): Put
Author before Summary when both are to be inserted.
2025-04-26 20:28:23 +08:00
Sean Whitton
30b7318a8f ; comment-indent: Leave point where we used to. 2025-04-26 20:04:43 +08:00
Liu Hui
46776cae05 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'.
2025-04-26 14:59:48 +03:00
Spencer Baugh
8f58f55551 Improve help-fns-edit-variable for Lisp editing
Before d50c82f3e9 ("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)
2025-04-26 14:53:18 +03:00
Sean Whitton
5b635d8bd6 ; mode-line-collapse-minor-modes: Tweak wording. 2025-04-26 19:48:49 +08:00
Pengji Zhang
643ebbcac9 Make lighter for collapsed minor modes customizable (bug#77361)
* lisp/bindings.el (mode-line-collapse-minor-modes-to): New
option for the collapsed lighter of minor modes.
(mode-line-collapse-minor-modes): Mention that the collapsed
lighter can be customized.
(mode-line--minor-modes): Use the new option.
2025-04-26 19:47:33 +08:00