Commit graph

9850 commits

Author SHA1 Message Date
Stefan Monnier
2e16bcd8ed ad-activate-advised-definition: Use proper function objects
* lisp/emacs-lisp/advice.el (ad-activate-advised-definition):
Use interpreted functions rather than lambda lists.
2024-05-30 18:57:56 -04:00
Davide Pola
fd61cf3976 Rename comp-run.el and comp-cstr.el private functions
* lisp/emacs-lisp/comp-run.el (native-compile-async-skip-p)
(comp-async-runnings, comp-effective-async-max-jobs)
(comp-accept-and-process-async-output, comp-run-async-workers)
(comp-trampoline-search): rename using '--' separator convention for
private functions.
* lisp/emacs-lisp/comp-cstr.el
(comp-cstr-copy, comp-cstrs-homogeneous, comp-split-pos-neg)
(comp-normalize-valset, comp-union-valsets)
(comp-intersection-valsets, comp-normalize-typeset)
(comp-union-typesets, comp-intersect-two-typesets)
(comp-intersect-typesets, comp-range-union)
(comp-range-intersection, comp-range-negation, comp-cstr-add-2)
(comp-cstr-sub-2, comp-cstr-union-homogeneous-no-range)
(comp-cstr-union-homogeneous, comp-cstr-union-1-no-mem)
(comp-cstr-union-1, comp-cstr-union-make)
(comp-cstr-intersection-make): Likewise.
2024-05-29 17:43:23 +02:00
Stefan Monnier
fde8dc9287 Redirect calls to subr-native-elisp-p to native-comp-function-p
* test/src/comp-tests.el (comp-tests-bootstrap, lambda-return)
(lambda-return2, free-fun, free-fun2, free-fun-silly-name, speed--1)
(compile-forms, comp-test-defsubst, primitive-redefine-compile-44221)
(48029-1, 61917-1, tco, fw-prop-1, pure):
* test/lisp/help-fns-tests.el (help-fns-test-lisp-defun):
* lisp/subr.el (subr-primitive-p, primitive-function-p, symbol-file):
* lisp/help-fns.el (find-lisp-object-file-name):
* lisp/emacs-lisp/disass.el (disassemble-internal):
* lisp/emacs-lisp/comp.el (comp--call-optim-form-call):
* lisp/emacs-lisp/comp-run.el (comp-warn-primitives):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns):
* lisp/emacs-lisp/bytecomp.el (<trailer>): Rename `subr-native-elisp-p`
to `native-comp-function-p`.
2024-05-28 20:53:25 -04:00
Stefan Monnier
1a1170cde7 Rename subr-native-elisp to native-comp-function (bug#71123)
Now that this type name is displayed in *Help*, it is more
important to use a name that is less weird for the unsuspecting user.

* lisp/emacs-lisp/cl-preloaded.el (cl-functionp): Adjust to new name of
native function's type.
(subr-native-elisp-p): Redefine as an obsolete alias.
(native-comp-function): Rename from `subr-native-elisp`

* src/data.c (Fcl_type_of): Return `Qnative_comp_function` i.s.o
`Qsubr_native_elisp`.
(Fnative_comp_function_p): Rename from `Fsubr_native_elisp_p`.
(syms_of_data): Adjust accordingly.

* src/doc.c (Fsubr_documentation): Use new `Fnative_comp_function_p` name.
2024-05-28 20:52:40 -04:00
Andrea Corallo
509e7f877b * Rework 'comp-normalize-valset' (bug#71116)
* lisp/emacs-lisp/comp-cstr.el (comp-normalize-valset): Rework to
improve consistency.
2024-05-27 20:41:06 +02:00
Michael Heerdegen
804f36d5ab Don't let pp fall back to prin1 for conses
* lisp/emacs-lisp/pp.el (pp--insert-lisp): Don't `prin1' non-list
conses; use our pp function for cons and list printing
`pp--format-list' instead.
2024-05-27 19:51:39 +02:00
Michael Heerdegen
3580dc155c Don't try to pretty-print non-lists as binding list
* lisp/emacs-lisp/pp.el (pp--format-definition): Ensure that what we try
to print as a list of bindings has an appropriate format.  This avoids
raising an error for SEXPs like (let X Y) inside `pcase' forms where our
heuristic expects a binding list in the X position.
2024-05-27 18:44:48 +02:00
Michael Heerdegen
34fc71c004 Further tweak pp code printing
This fixes an aspect of Bug#70868.

* lisp/emacs-lisp/pp.el (pp--insert-lisp): Print characters with
`prin1-char'.  In all other cases consistently print with `prin1'.
2024-05-26 14:17:21 +02:00
Po Lu
74ceb6922c Address compilation errors and warnings on x86 Solaris 10 systems
* doc/misc/ede.texi (Extending EDE):

* doc/misc/flymake.texi (Top, Using Flymake): Insert punctuation
after xrefs.

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Print
number of files being scraped.

* src/dired.c (directory_files_internal):

* src/eval.c (Fmake_interpreted_closure, Fdefvaralias):

* src/fns.c (Fassoc): Work around optimizer failures.
2024-05-26 11:50:45 +08:00
Dmitry Gutov
2a12f39ffe Improve navigation to cl-defgeneric uses
* lisp/emacs-lisp/cl-generic.el
(cl--generic-find-defgeneric-regexp):
Use "symbol end" boundary (bug#71068).
2024-05-26 05:56:14 +03:00
Stefan Monnier
d8af7c99bb * lisp/emacs-lisp/pcase.el (pcase--subtype-bitsets): Fix bootstrap failure
`rm lisp/emacs-lisp/cl-preloaded.elc src/bootstrap-emacs`
followed by `make` ended up loading right after defining
`built-in-class-p` but before actually defining the
built-in-classes so the computation of bitsets failed.
2024-05-22 13:27:50 -04:00
Andrea Corallo
931663f123 Silence 3 warnings for non sqlite builds
* lisp/emacs-lisp/multisession.el (sqlite-commit)
(sqlite-transaction, sqlite-rollback): Declare.
2024-05-19 14:54:10 +02:00
Joost Kremers
4f27d763bb Make 'vtable-insert-object' more versatile
* lisp/emacs-lisp/vtable.el (vtable-insert-object): Rename
argument AFTER-OBJECT to LOCATION; allow use of index to
refer to the insertion position; add argument BEFORE.
(Bug#70664).

* etc/NEWS:
* doc/misc/vtable.texi (Interface Functions): Document the
change.

* test/lisp/emacs-lisp/vtable-tests.el
(test-vtable-insert-object): New test.
2024-05-18 11:52:33 +03:00
Stefan Monnier
acfb2c6163 (describe-package-1): Handle (nil . "string") in :maintainer
* lisp/emacs-lisp/package.el (describe-package-1): Refine the
check to distinguish the old single-maintainer format from the
new multi-maintainer format.  (bug#69712)
2024-05-16 11:04:50 -04:00
Andrea Corallo
1b622ff66e * Fix bootstrap with checking enabled
* lisp/emacs-lisp/comp.el (comp--limplify-top-level): Set function
safety.
2024-05-16 07:53:48 +02:00
Andrea Corallo
b87670b564 * Allow for optional function name parameter in 'ftype' declaration
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Allow for
optional function name parameter in 'ftype' declaration.
2024-05-14 11:17:25 +02:00
Andrea Corallo
6e1bb713f6 Change 'type' declaration to 'ftype'
* lisp/window.el (get-lru-window, get-largest-window)
(one-window-p): Update function type declaration.
* lisp/subr.el (ignore, error, zerop, fixnump, bignump, lsh)
(last, eventp, mouse-movement-p, log10, memory-limit)
(internal-pop-keymap): Likewise.
* lisp/simple.el (count-lines, mark, string-empty-p): Likewise.
* lisp/files.el (parse-colon-path): Likewise.
* lisp/env.el (getenv): Likewise.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt): Likewise.
* lisp/emacs-lisp/lisp.el (buffer-end): Likewise.
* lisp/emacs-lisp/comp.el (comp--final): Likewise.
* lisp/custom.el (custom-variable-p): Likewise.
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Rename 'type'
-> 'ftype'.
2024-05-14 11:17:25 +02:00
Eli Zaretskii
f6d060b39a ; Fix documentation of recently-installed changes
* lisp/emacs-lisp/bytecomp.el (compilation-safety): Doc fix.

* etc/NEWS: Fix wording of the 'compilation-safety' entry.

* doc/lispref/functions.texi (Declare Form): Fix cross-reference
and wording.
* doc/lispref/compile.texi (Native-Compilation Variables): Add the
missing @anchor.  Fix wording.
2024-05-14 08:51:13 +03:00
Andrea Corallo
04e7078d5e Add some 'compilation-safety' documentation
* lisp/emacs-lisp/bytecomp.el (compilation-safety): Better doc.
* doc/lispref/functions.texi (Declare Form): Add 'safety'.
* doc/lispref/compile.texi (Native-Compilation Variables): Add
'compilation-safety'.
2024-05-13 23:09:09 +02:00
Andrea Corallo
9e4e6d0fc9 Add 'safety' function declaration
* lisp/emacs-lisp/comp.el (comp-known-predicates): Use
'comp-func-safety'.
(comp-ctxt, comp-mvar-type-hint-match-p): New 'safety' slot.
(comp-c-func-name): New function.
(comp--spill-lap-function, comp--intern-func-in-ctxt): Update.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Spill safety.
* lisp/emacs-lisp/byte-run.el (byte-run--set-completion): New alias.
(defun-declarations-alist): Update.
2024-05-13 23:01:08 +02:00
Andrea Corallo
13ddfc2011 Introduce 'compilation-safety' variable
* lisp/emacs-lisp/bytecomp.el (compilation-safety): New customize.
* src/comp.c (comp_t): Add func_safety.
(emit_call_with_type_hint, emit_call2_with_type_hint): Make use of.
(compile_function): Set 'comp.func_safety'.
2024-05-13 23:01:08 +02:00
Andrea Corallo
595799edd3 * lisp/emacs-lisp/comp.el (comp--get-function-cstr): Fix it. 2024-05-13 16:49:29 +02:00
Mattias Engdegård
38091e43be Safer and faster string sorting
* lisp/emacs-lisp/cl-seq.el (cl-sort):
Don't use string mutation when sorting the characters in a string.
This avoids O(n^2) run time and makes it future-safe.
2024-05-12 14:58:38 +02:00
Mattias Engdegård
de5a89254c Don't mutate strings in cl-substitute
This fixes cl-substitute, cl-substitute-if, cl-substitute-if-not,
cl-nsubstitute, cl-nsubstitute-if and cl-nsubstitute-if-not,
when called with a string sequence argument.

* lisp/emacs-lisp/cl-seq.el (cl-nsubstitute):
Avoid running in O(n^2) time and make future-safe.
2024-05-08 16:38:40 +02:00
Po Lu
32b8c07817 Correct earlier change to map-ynp
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Don't call
set-text-conversion-style if not bound.
2024-05-08 20:26:08 +08:00
Eli Zaretskii
4b31074f5f ; * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Add commentary. 2024-05-07 15:00:31 +03:00
Po Lu
d4d9db8dc6 Disable text-conversion in map-ynp
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Bind
overriding-text-conversion-style to nil around read-event and
arrange that the input method be reset.
2024-05-07 09:02:00 +08:00
Stefan Monnier
f63615208a edebug.el: Fix edebug-remove-instrumentation (bug#70791)
* lisp/emacs-lisp/edebug.el (edebug-unwrap*): Traverse interpreted
functions.
2024-05-06 14:33:43 -04:00
Juri Linkov
4460317225 * lisp/emacs-lisp/warnings.el (display-warning): Add guardrails for window.
Check for non-nil 'window' returned from 'display-buffer' for the case when
users decide to use 'allow-no-window' in 'display-buffer-alist' (#70795).
2024-05-06 20:00:23 +03:00
Eli Zaretskii
e091967ce2 Revert "Disable text conversion in map-ynp"
This reverts commit f50a58123a.
Please don't make such changes without discussing them.
2024-05-06 15:02:37 +03:00
Eli Zaretskii
74ebd729c7 ; Avoid byte-compiler warning in comp.el
* lisp/emacs-lisp/comp.el (comp--symbol-func-to-fun): Move to
before its first use.
2024-05-06 13:54:19 +03:00
Po Lu
f50a58123a Disable text conversion in map-ynp
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Read response with
read-key, not read-char.
2024-05-06 15:59:48 +08:00
Andrea Corallo
f920959ac9 Remove unnecessary cons in function-type property
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec): Remove
unnecessary car.
* lisp/emacs-lisp/comp.el (comp--intern-func-in-ctxt): Likewise.
* lisp/emacs-lisp/byte-run.el (byte-run--set-function-type): Update
lambda list.
2024-05-05 23:58:31 +02:00
Andrea Corallo
77f87d4b48 Fix intra compilation unit function type declaration
* lisp/emacs-lisp/comp.el (comp-func): Add 'slot'.
(comp--intern-func-in-ctxt): Update.
(comp--get-function-cstr): Update.
2024-05-05 23:58:31 +02:00
Stefan Monnier
44036b32ba eglot.el: Require track-changes unconditionally
* lisp/emacs-lisp/track-changes.el: Bump version.

* lisp/progmodes/eglot.el: Require `track-changes` unconditionally.
(Package-Requires:): Add `track-changes`.
(eglot--track-changes-signal, eglot--signal-textDocument/didChange)
(eglot--managed-mode): Remove non-track-changes alternative code.
(eglot--before-change, eglot--after-change): Delete functions.
2024-05-05 17:23:29 -04:00
Stefan Monnier
c9b0e2bd8e * lisp/emacs-lisp/track-changes.el (track-changes-inconsistent-state-p): Typo 2024-05-03 16:39:29 -04:00
Stefan Monnier
b6d4e81a48 track-changes.el: Add a workaround for bug#70541
* lisp/emacs-lisp/track-changes.el (track-changes-inconsistent-state-p):
 New function.
* lisp/progmodes/eglot.el (eglot--track-changes-signal): Use it.
2024-05-03 13:23:00 -04:00
Andrea Corallo
da8b06bd61 Merge branch 'lisp-func-type-decls' into 'master' 2024-05-02 17:06:07 +02:00
Juri Linkov
592873a52d * lisp/emacs-lisp/warnings.el: Fix 'warning-display-at-bottom'.
(display-warning): Move point to the beginning of the last line
instead of its end for 'warning-display-at-bottom' (bug#69983).
2024-05-02 09:54:22 +03:00
Andrea Corallo
468f3f1cb4 (disassemble): Fix case of (byte-code ...) argument
* lisp/emacs-lisp/disass.el (disassemble): Handle (byte-code ...) here..
(disassemble-internal): ...instead of here.
(disassemble-1): Adjust text to reflect the existence of other
compiled functions.
2024-05-01 14:14:01 -04:00
Basil L. Contovounesios
65fa47e3fa Assume match before calling help-xref-button
help-xref-button fails if not preceded by a valid match, so a
preceding unconditional search should not be allowed to fail
silently.

* lisp/emacs-lisp/ert.el (ert-describe-test):
* lisp/help-fns.el (help-fns--compiler-macro)
(help-fns-function-description-header, describe-variable)
(help-fns--customize-variable, describe-face)
(help-fns--face-attributes, describe-keymap): Let unconditional
re-search-backward before help-xref-button fail early, as that would
indicate a logic bug, and the backtrace would more accurately point
to the actual source of the mistake.
2024-05-01 12:38:51 +02:00
Mattias Engdegård
c15d67ecfc * lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure): Simplify. 2024-04-30 16:22:48 +02:00
Mattias Engdegård
c3c2e3b4d3 * lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Simplify.
Remove the add-lambda argument.  All callers adapted.
2024-04-30 16:20:45 +02:00
Andrea Corallo
1087d55d27 * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Fix type declaration. 2024-04-30 09:19:31 +02:00
Mattias Engdegård
3000edc617 Use the nthcdr byte-op for drop, and raise open-code limit
* lisp/emacs-lisp/byte-opt.el (byte-optimize-nthcdr):
Open-code for any integral N<5.  Always use the byte-op otherwise.
2024-04-29 22:16:08 +02:00
Andrea Corallo
0757ea9865 Rename property 'declared-type' to 'function-type'
* lisp/emacs-lisp/byte-run.el (byte-run--set-function-type): Rename.
(defun-declarations-alist): Update.
* lisp/emacs-lisp/comp.el (comp--get-function-cstr): Likewise.
2024-04-29 20:41:11 +02:00
Stefan Monnier
ccb49acd2a (disassemble-internal): Handle new function values
* lisp/emacs-lisp/disass.el (disassemble-internal): Fix the
`interpreted-function` case.
2024-04-29 13:47:15 -04:00
Andrea Corallo
fa0bf96837 Move lisp function arg type declarations to the functions itself
* lisp/emacs-lisp/comp-common.el (comp-primitive-type-specifiers):
Remove type declaration of lisp functions.
* lisp/window.el (get-lru-window, get-largest-window)
(one-window-p): Declare type.
* lisp/subr.el (ignore, error, zerop, fixnump, bignump, lsh)
(last, eventp, mouse-movement-p, log10, memory-limit)
(interactive-p): Likewise.
* lisp/simple.el (count-lines, mark, lax-plist-get): Likewise.
* lisp/files.el (parse-colon-path): Likewise.
* lisp/env.el (getenv): Likewise.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt): Likewise.
* lisp/emacs-lisp/lisp.el (buffer-end): Likewise.
* lisp/emacs-lisp/comp.el (comp-hint-fixnum, comp-hint-cons): Likewise.
* lisp/custom.el (custom-variable-p): Likewise.
2024-04-29 19:27:28 +02:00
Andrea Corallo
d8c941df7d Make use of Lisp function declarations
* lisp/emacs-lisp/comp.el (comp-primitive-func-cstr-h): Rename.
(comp--get-function-cstr): Define new function.
(comp--add-call-cstr, comp--fwprop-call): Update.
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec): Update.
* lisp/help-fns.el (help-fns--signature): Mention when a type is
declared.
* lisp/emacs-lisp/comp.el (comp-primitive-func-cstr-h): Rename.
2024-04-29 19:27:23 +02:00
Stefan Monnier
7cf767ef54 (byte-compile): Fix interaction with old advice.el
* lisp/emacs-lisp/bytecomp.el (byte-compile): Handle symbols whose
function "value" is a bare lambda expression (bug#70368).
2024-04-29 13:14:31 -04:00