1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00
Commit graph

10268 commits

Author SHA1 Message Date
Eli Zaretskii
62014576dc Fix 'save-some-buffers' when file name has embedded '%'
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Don't assume the
prompt will never include the '%' character.  (Bug#78715)
2025-06-07 16:35:42 +03:00
Eli Zaretskii
9629ade0b0 Teach checkdoc about (:this that) in cl-defun
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Support more complex keyword args.  (Bug#78543)
2025-06-07 12:15:33 +03:00
Mattias Engdegård
8b0f5b0597 Fix function arity check for noncompiled callees (bug#78685)
This is a regression from Emacs 29.

* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition):
Make it work for functions that aren't compiled.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--f):
(bytecomp-tests--warn-arity-noncompiled-callee): Add test.
2025-06-05 18:18:05 +02:00
Stefan Monnier
1903b0062b (cl-deftype): Silence spurious warnings in xcb-types.el
* lisp/emacs-lisp/cl-macs.el (cl-deftype): Don't warn if the predicate
doesn't use its argument, e.g. when the type is equivalent to `t`.
2025-06-04 19:27:08 -04:00
Thierry Volpiatto
eb788fd8fd (lisp-imenu-generic-expression): Add oclosure-define
* lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression):
Add `oclosure-define` alongside the other type definition forms.
2025-06-03 16:03:27 -04:00
Eli Zaretskii
056ba8c569 Merge from origin/emacs-30
df9636f892 ; * doc/misc/use-package.texi (Hooks): Fix typo (bug#77609).
36afdd2f6f Fix documentation of use-package's ':hook' keyword
d0c90bc9bf * test/infra/gitlab-ci.yml (.job-template): Make it more ...
b8f24cbdbb ; * lisp/emacs-lisp/find-func.el (find-function): Doc fix.
e0c6f3e765 Fix todo-mode item insertion bug (bug#78506)
328b316764 Add support for Pyrefly LSP for Python
2025-05-24 06:55:24 -04:00
Eli Zaretskii
b8f24cbdbb ; * lisp/emacs-lisp/find-func.el (find-function): Doc fix. 2025-05-22 09:43:45 +03:00
Lin Sun
cb1b65f392 * lisp/emacs-lisp/find-func.el: Fix Eager macro-expansion failure
Bug#78446
2025-05-21 13:18:06 -04:00
Eli Zaretskii
bd57055a58 Merge from origin/emacs-30
299d3a4401 Fix saving abbrevs by 'abbrev-edit-save-buffer'
399d05332e ; Remove confusing text from ELisp manual
feecb1fbc6 ; * doc/emacs/cmdargs.texi (General Variables): More accu...
18e1aabbea ; Improve documentation of the -L command-line option
c80fbe3f23 typescript-ts-mode: align ternary-chain branches (bug#78187)
16bfbc6fe3 ; Tramp test fixes
f0ac271da3 ; Time Stamps doc: Clearer customize recipe
49c06df224 ; * doc/lispref/variables.texi (Default Value): Update.
cbea5997c0 ; * lisp/mh-e/mh-e.el: Commentary: link to The MH-E Manual
0bf956235e Improve Tramp test
eaf01d034c * lisp/autorevert.el (auto-revert-remote-files): Adapt do...
e32bb816ad ; Improve documentation of ls-lisp.el
2d5f243470 ; * lisp/emacs-lisp/comp.el (native-compile-prune-cache):...
bb73533165 Improve Electric Pair mode documentation (bug#78021)
2025-05-17 06:52:01 -04:00
Stefan Monnier
81cbff70f2 lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type): Fix corner case 2025-05-13 22:38:15 -04:00
David Ponce
b8f23179da lisp/emacs-lisp/cl-macs.el (cl--define-derived-type): Fix thinko 2025-05-13 22:32:55 -04:00
Stefan Monnier
dfafe1830f lisp/emacs-lisp/cl-macs.el (cl--define-derived-type): Fix partial bootstrap 2025-05-11 01:30:01 -04:00
Eli Zaretskii
2d5f243470 ; * lisp/emacs-lisp/comp.el (native-compile-prune-cache): Doc fix. 2025-05-10 22:23:27 +03:00
Stefan Monnier
ceba490da9 cl-types: Improve error messages
* lisp/emacs-lisp/cl-extra.el (cl--derived-type-generalizers):
Check that the type is valid and fully defined.

* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers) <derived-type>:
Don't delegate to another method just because the type is invalid.

* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Minor simplification, and improvement to an error message.
2025-05-08 17:11:05 -04:00
Stefan Monnier
322ed637b4 cl-lib.el (cl-generic-generalizers): Fix partial bootstrap
* lisp/emacs-lisp/cl-lib.el (cl-generic-generalizers): Tweak the
bootstrap hack to avoid a problem when dumping `bootstrap-emacs` when
`cl-lib.el` has already been compiled.

* lisp/emacs-lisp/cl-macs.el (list): Move out of `static-if` test.
2025-05-07 23:34:48 -04:00
Stefan Monnier
777da8c3f9 (cl-deftype): Precompute the predicate function
Always define a `cl-deftype-satisfies` predicate (if possible), so
we only need `cl-typep` to "interpret" a type specifier when we use
a compound type but never for the atomic types (e.g. never
in `cl-types-of`).

* lisp/emacs-lisp/cl-macs.el (cl-typep): Test `cl-deftype-satisfies` first.
Don't handle `real` here any more.
(base-char, character, command, keyword, natnum, real): Define with
`c-deftype`.
(cl-deftype): Precompute the predicate for the atomic derived type,
if applicable.

* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Add argument for the precomputed predicate function.

* lisp/emacs-lisp/cl-extra.el (cl-types-of): Use `cl-deftype-satisfies`
instead of `cl-type-p`.
2025-05-07 23:18:09 -04:00
Stefan Monnier
1590a2b3d5 Merge branch 'cl-types' 2025-05-07 14:56:49 -04:00
Stefan Monnier
9f50fdf1e7 (cl-deftype): Don't set cl-deftype-handler directly
In order to make it easier to change that in the future, let
`cl--define-derived-type` take care of storing the derived
type's function into `cl-deftype-handler`.

* lisp/emacs-lisp/cl-preloaded.el (cl--define-derived-type):
Change calling convention.  Set `cl-deftype-handler`.
* lisp/emacs-lisp/cl-macs.el (cl-deftype): Don't set `cl-deftype-handler`,
instead pass the function to `cl--define-derived-type`.
2025-05-07 13:54:47 -04:00
Stefan Monnier
d7459da58d lisp/emacs-lisp/cl-types.el: Delete file 2025-05-07 13:24:58 -04:00
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
Philip Kaludercic
f41ab0b425
Preserve directory structure of local packages
* lisp/emacs-lisp/package.el (package-unpack): Re-create the
directory structure of the source directory and copy the files
in the right place.
(package-dir-info): Try to find package info in files closer to
the specified package source root.

(Bug#78017)
2025-05-03 23:40:57 +02:00
Roi Martin
d164116aa5 Fix 'Skip' behavior in erts files (bug#76839)
* lisp/emacs-lisp/ert.el (ert-test--erts-test): Fix 'Skip'
behavior in erts files, so only the test case where it is
specified is skipped.
* test/lisp/emacs-lisp/ert-tests.el (ert-test-erts-skip-one)
(ert-test-erts-skip-last): Add test cases.
2025-05-03 10:31:04 +03:00
Sean Whitton
f180e4c9cb Improve native--compile-skip-on-battery-p
* lisp/emacs-lisp/comp-run.el
(native--compile-skip-on-battery-p): Look at %L, %b and %B
format characters.  Add commentary.
2025-05-03 10:32:42 +08:00
Sean Whitton
6b11687555 New user option native-comp-async-on-battery-power
* lisp/emacs-lisp/comp-run.el
(native-comp-async-on-battery-power): New option.
(battery-status-function): Declare.
(native--compile-skip-on-battery-p): New function.
(comp--run-async-workers): Call it.
* etc/NEWS: Announce the new option.
2025-05-02 12:04:26 +08:00
Sean Whitton
7ae8607423 ; * lisp/emacs-lisp/package.el (dired-get-marked-files): Declare. 2025-05-01 20:56:36 +08:00
Philip Kaludercic
15e77fe03a
; Fix invalid 'expand-file-name' call from 4226eb2b
* lisp/emacs-lisp/package-vc.el (package-vc--main-file)
(package-vc--unpack-1): Provide a fallback value if the package
specification has no :lisp-dir.
2025-05-01 09:50:12 +02:00
Philip Kaludercic
d6755ff1e1
Allow selecting what to copy when installing a local package
* lisp/emacs-lisp/package.el (package-unpack, package-dir-info):
Check the marked files if in a Dired buffer, and otherwise
fallback on the previous behaviour or if there was no selection.
(package-install-from-buffer): Document the feature.
* etc/NEWS: Mention the change.

(Bug#78017)
2025-04-30 23:40:16 +02:00
Philip Kaludercic
ef5c7ec499
Improve detection of VC package revisions
* lisp/emacs-lisp/package-vc.el (package-vc-commit): If the
package specification lists a :lisp-dir, use that to search for
Lisp files.
2025-04-30 23:40:16 +02:00
Philip Kaludercic
4226eb2b20
Avoid using symbolic links when installing local VC packages
* lisp/emacs-lisp/package-vc.el (package-vc--main-file): Use
`expand-file-name' to support :lisp-dir entries outside of the
elpa directory.
(package-vc--unpack-1): Same as above.
(package-vc-install-from-checkout): Instead of creating a
symlink to the requested directory, create an empty directory
and use autoload indirections, analogously to checkouts with
Lisp code in a subdirectory.

(Bug#78017)
2025-04-30 23:40:04 +02:00
Philip Kaludercic
b81f937e60
Do a deep-copy when installing a package from a local package
* lisp/emacs-lisp/package.el (package-unpack, package-dir-info):
Call 'directory-files-recursively' with appropriate arguments.

(Bug#78017)
2025-04-30 23:39:38 +02:00
Stefan Monnier
b1407b41a1 register.el: Remove bogus deftypes and fix associated methods
* lisp/register.el (frame-register, kmacro-register): Remove bogus deftypes.
(register--type) <oclosure>: Fix kmacro method and generalize it to
any OClosure.
(register--type) <frameset-register>: Fix method and move it to ...
* lisp/frameset.el (register--type) <frameset-register>: ... here,
where `frameset-register` is defined.
2025-04-29 16:05:14 -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
Roi Martin
3098d34bfd * Fix missing lexical-binding cookie warning on async compilation (bug#77918)
* lisp/emacs-lisp/comp-run.el (comp--run-async-workers): Fix missing
lexical-binding cookie warning on async compilation.
2025-04-25 22:36:06 +02:00
Sean Whitton
4808f785cc Revert addition of electric-block-comment-mode & follow-up commits
As presently under discussion in bug#77823, the intended new
functionality is not really about comments at all.
Remove it for now to allow us to redesign from a clean slate,
and to deal with the regression reported in bug#77823.

This reverts the following three changesets:

Author:     Elías Gabriel Pérez <eg642616@gmail.com>
AuthorDate: Mon Mar 17 12:56:52 2025 -0600

  New minor mode: `electric-block-comment-mode'

Author:     Elías Gabriel Pérez <eg642616@gmail.com>
AuthorDate: Mon Mar 31 17:58:16 2025 -0600

  Add block-comment-start and block-comment-end to supported modes

Author:     Elías Gabriel Pérez <eg642616@gmail.com>
AuthorDate: Sun Apr 13 12:26:08 2025 -0600

  Add block-comment variables to cc-mode
2025-04-22 20:47:56 +08:00
Stefan Monnier
ae1d01328f (eieio-backward-compatibility): Set to warn (bug#77612)
* lisp/emacs-lisp/eieio-base.el (make-instance) <eieio-named>:
Really skip backward compatibility when `eieio-backward-compatibility`
is nil and emit message if it's `warn`.
(eieio-persistent-make-instance): Warn when an obsolete name is used.

* lisp/emacs-lisp/eieio-core.el (eieio-backward-compatibility):
Change default to `warn`.
(eieio-defclass-internal): Warn when the *-list-p function is called
(eieio--slot-name-index): Warn when a initarg is used to access a slot.

* lisp/emacs-lisp/eieio.el (defclass): Warn when a class-slot is
accessed via the obsolete method.
(make-instance, clone) <eieio-default-superclass>: Really skip backward
compatibility when `eieio-backward-compatibility` is nil and emit
message if it's `warn`.
2025-04-17 00:04:04 -04:00
Elías Gabriel Pérez
74842b4cb2 Add block-comment variables to cc-mode.
* lisp/progmodes/cc-cmds.el (c-indent-new-comment-line):
Add block-comment-start and block-comment-end
* lisp/progmodes/cc-mode.el (c-basic-common-init):
Declare block-comment-start and block-comment-end buffer-local.
* lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables): Move
block-comment variables ...
(lisp-mode): ... to here.  (Bug#77424)
2025-04-15 16:16:34 +03:00
Stefan Monnier
19913b1567 (cl-generic-define-method): Try and fix bug#77464
* lisp/emacs-lisp/cl-generic.el (cl-generic-define-method): Don't set
the function to `dummy`, even temporarily.
2025-04-13 12:45:54 -04:00
Elías Gabriel Pérez
4c6b1712a4 Add block-comment-start and block-comment-end to supported modes
* lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables):
Add block-comment-start and block-comment-end from here...
* lisp/newcomment.el (block-comment-start, block-comment-end):...
* lisp/nxml/nxml-mode.el (nxml-mode):...
* lisp/progmodes/c-ts-common.el (c-ts-common-comment-setup):...
* lisp/progmodes/go-ts-mode.el (go-work-ts-mode):...
* lisp/progmodes/js.el (js--mode-setup):...
* lisp/progmodes/json-ts-mode.el (json-ts-mode):...
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode):...
* lisp/progmodes/opascal.el (opascal-mode):...
* lisp/progmodes/pascal.el (pascal-mode):...
* lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode):...
* lisp/textmodes/css-mode.el (css-base-mode, scss-mode):...
* lisp/textmodes/sgml-mode.el (sgml-mode): ... to here.
(Bug#77424)
2025-04-13 11:12:59 +03:00
Sean Whitton
3b841700a8 vc-do-async-command: Ellipse later lines in multiline arguments
* lisp/emacs-lisp/cl-print.el (cl-print-expand-ellipsis): Bind
inhibit-read-only to t.
* lisp/vc/vc-dispatcher.el (require): Require cl-print at
compile time.
(vc-do-async-command): When printing command arguments that
contain multiple lines, use cl-prin1 with cl-print-string-length
bound in order to ellipse lines other than the first.
Switch the outer quotation marks to single quotation marks.
2025-04-12 10:05:57 +08:00
Eli Zaretskii
cb9aded6d9 ; Fix an error in 'package-quickstart-refresh'
* lisp/emacs-lisp/package.el (package-quickstart-refresh): Fix a
thinko.  (Bug#77701)
2025-04-10 16:46:00 +03:00
Eli Zaretskii
50947fd512 Avoid warnings about lexbind cookies where they aren't needed
* lisp/emacs-lisp/warnings.el (warning-inhibit-types): New variable.
(display-warning): If TYPE matches 'warning-inhibit-types', don't
display the warning, even if it's emitted during startup.
* lisp/startup.el (normal-top-level):
* lisp/savehist.el (savehist-mode):
* lisp/url/url-cookie.el (url-cookie-parse-file):
* lisp/recentf.el (recentf-load-list):
* lisp/abbrev.el (read-abbrev-file): Bind 'warning-inhibit-types'
to avoid warning about missing lexbind cookie when loading files
that Emacs itself generates.
2025-04-10 14:36:43 +03:00
Spencer Baugh
40b0c83988 Use relative names where possible in package-quickstart.el
package-quickstart.el hardcodes many absolute file names, which
makes it break if user-emacs-directory moves, or in other
situations.  To be slightly more robust to this, use relative
file names to packages that are located in the same directory as
package-quickstart.el.

* lisp/emacs-lisp/package.el (package--quickstart-dir,
package--quickstart-rel): Add.
(package-quickstart-refresh): Use package--quickstart-rel on
file names.  (bug#77468)
2025-04-08 14:39:44 -04:00
Stefan Monnier
9663c959c7 eieio: Improve some obsolecence warnings and fix #<CLASS CLASS-XX> names
* lisp/emacs-lisp/eieio.el (eieio--constructor-macro): Improve message.
(eieio-object-name-string): Avoid repeated class name in the output of
`eieio-object-name`.
(make-instance, clone): Improve message.

* lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload): Use the same
obsolescence warning as elsewhere.
2025-04-07 12:48:18 -04:00