Commit graph

10285 commits

Author SHA1 Message Date
Andrea Corallo
baf0c82202 * Make native comp use lexbinding for sync compilations (bug#78818)
* lisp/emacs-lisp/comp.el (comp--final): Use lexical-binding in the temp file.
2025-06-23 22:04:05 +02:00
Stefan Monnier
08fba517f6 (smerge-refine-shadow-cursor): New variable and face (bug#78806)
* lisp/vc/smerge-mode.el (smerge-refine-shadow-cursor): New variable
and face.
(smerge-refine-regions): Add `cursor-sensor-functions` property
to the covering overlays.
(smerge--refine-at-right-margin-p, smerge--refine-shadow-cursor):
New functions.
(smerge--refine-other-pos): New function, extracted from
`smerge-refine-exchange-point`.
(smerge-refine-exchange-point): Use it.
(smerge--refine-highlight-change): Add thin
highlighted space for insertion/deletion positions.

* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect):
Run functions for `moved` events.  Demote errors.
(cursor-sensor-mode): Adjust docstring accordingly.

* doc/lispref/text.texi (Special Properties) <cursor-sensor-functions>:
Mention the new `moved` direction.
2025-06-23 00:00:38 -04:00
Eli Zaretskii
e66428a0d2 ; Fix last change
* lisp/emacs-lisp/package.el (package-mark-install-line)
(package-mark-delete-line): Doc fixes.  (Bug#78794)
2025-06-22 11:08:04 +03:00
Elías Gabriel Pérez
be0b44e4ed Pretiffy package-menu (Bug#78794)
Add package-menu mode-line which displays information about:
total number of packages installed, total number of packages
from all the packages archive, total number of packages to
upgrade and total number of new packages available.
Highlight packages marked for installation or deletion.
* lisp/emacs-lisp/package.el (package-menu-mode): Add package-menu
mode-line format to 'mode-line-misc-info'.
(package-mark-install-line, package-mark-delete-line): New faces.
(package-menu--overlay-line, package-menu--remove-overlay)
(package-menu--set-mode-line-format): New functions.
(package-menu-mark-delete, package-menu-mark-install)
(package-menu-mark-unmark, package-menu-backup-unmark)
(package-menu-mark-obsolete-for-deletion): Tweak for set/unset the
overlays.
(package-menu-mode-line-format, package-menu-mode-line-info): New
buffer-local variables.
(list-packages): Add 'package-menu--set-mode-line-format' to
'package--post-download-archives-hook'.

* etc/NEWS: Announce changes.
2025-06-22 11:04:51 +03:00
Eli Zaretskii
31febb1a28 Merge from origin/emacs-30
a2bfce5d2a ; Fix customization and doc strings in pp.el
2025-06-21 06:26:10 -04:00
Zach Shaftel
075ebed98f Fix byte-compilation of defalias with a constant macro cons pair
* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defalias):
Quote the function name in '(macro . function-name), since we eval
it later.
* test/lisp/emacs-lisp/bytecomp-tests.el
(test-eager-load-macro-expand-defalias): New test.
(Bug#78792)
2025-06-21 11:40:17 +03:00
Pip Cet
b6cf7c0942 Make cl-random behave consistently for unusual arguments (bug#75105)
The old behavior was for (cl-random -1.0e+INF) to return NaN in about
one in eight million calls, and -1.0e+INF otherwise.  Other unusual
arguments were handled inconsistently as well.

* lisp/emacs-lisp/cl-extra.el (cl-random): Handle positive finite
arguments consistently, error for nonpositive or infinite arguments.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-random): New
test.
2025-06-20 06:09:24 +00:00
Michael Albinus
e3e0be8786 ; Fix last change 2025-06-18 21:08:30 +02:00
Michael Albinus
5310083ba0 Show test name in ERT progress bar
* lisp/emacs-lisp/ert.el
(ert--results-progress-bar-button-help-echo): New defun.
(ert--results-progress-bar-button): Use it.
2025-06-18 20:12:55 +02:00
Pip Cet
af68c6e825 Remove eieio's ...-list-p predicate (bug#78782)
There seem to be no remaining callers of this function, which has not
been working for a while.

* lisp/emacs-lisp/eieio-core.el (eieio-backward-compatibility): Don't
mention "-list-p" predicate.
(eieio-defclass-autoload): Don't autoload predicate.
(eieio-defclass-internal): Remove code to generate list-p predicate.
2025-06-18 11:41:43 +00:00
Mattias Engdegård
3f72004961 Fix function arity check for noncompiled callees (bug#78685)
This fixes a regression from Emacs 29, and is the second attempt after
the later reverted 8b0f5b0597.

* 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-17 20:18:53 +02:00
Andrea Corallo
f38e969e47 Make nativecomp don't error when encountering undeclared types (bug#6573)
* test/src/comp-resources/comp-test-funcs.el (comp-test-76573-1-f): New
function.
* lisp/emacs-lisp/comp-cstr.el (comp-supertypes): Don't error if 'type'
is unknown.
2025-06-17 09:22:32 +02:00
Eli Zaretskii
a2bfce5d2a ; Fix customization and doc strings in pp.el
* lisp/emacs-lisp/pp.el (pp-default-function): Fix :tag's.
(pp-29, pp-28): Doc fixes.  (Bug#78801)
2025-06-16 10:00:41 +03:00
Jim Porter
90c0c9a01e Clean up text properties in 'visual-wrap-prefix-mode'
Before refontifying a region, remove any text properties we care about
so that we don't end up with stray properties.  Additionally, make sure
to remove all the properties when deactivating the mode.

* lisp/emacs-lisp/subr-x.el (add-remove--display-text-property): New
function, extracted from...
(add-display-text-property): ... here.
(remove-display-text-property): New function.

* lisp/visual-wrap.el (visual-wrap--remove-properties): New function...
(visual-wrap-prefix-function, visual-wrap-prefix-mode): ... call it.

* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x-test-remove-display-text-property): New test.

* test/lisp/visual-wrap-tests.el
(visual-wrap-tests/wrap-prefix-stickiness, visual-wrap-tests/cleanup):
New tests.

* doc/lispref/display.texi (Display Property): Document
'remove-display-text-property'.

* etc/NEWS: Announce 'remove-display-text-property' (bug#76018).
2025-06-10 22:09:26 -07:00
Jim Porter
24e6cd4233 Improve documentation for display property functions
Specifically, use the term "display specification" more consistently to
distinguish from "display property", which is the full value of the
'display' text property.

* src/xdisp.c (find_display_property): Rename PROP to SPEC.
(Fget_display_property): Rename PROP to SPEC and improve docstring.

* lisp/emacs-lisp/subr-x.el (add-display-text-property): Rename PROP to
SPEC and improve docstring.

* doc/lispref/display.texi (Display Property): Reword documentation to
more-consistently refer to display specifications.
2025-06-10 22:09:26 -07:00
Jim Porter
4a3c8e6e1d Don't delete in-place when replacing a display property
When calling 'add-display-text-property' on a region of text that
already contains PROP, we first delete the old display specification
from the region.  If the region's 'display' property is a list of
display specifications, we need to avoid destructively modifying the
list; other regions of text could be using the same list object.  (For a
'display' property that's a vector or a single display spec, this
doesn't matter since we first make a new list in the code.)

In addition, be more careful when working with a display property like
((margin ...) ...).  This is a single display specification, not a list
of display specs.

* lisp/emacs-lisp/subr-x.el (add-display-text-property): Don't delete
in-place for list values.  Handle (margin ...) display specification
type correctly.

* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x-test-add-display-text-property): Update test.
2025-06-10 22:09:26 -07:00
Mattias Engdegård
7f6244364b Revert "Fix function arity check for noncompiled callees (bug#78685)"
This reverts commit 8b0f5b0597.

This change wasn't quite right; the solution requires greater care.
2025-06-09 12:56:46 +02:00
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