aboutsummaryrefslogtreecommitdiffstats
path: root/test (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use a dedicated type to represent interpreted-function valuesscratch/interpreted-functionStefan Monnier2024-04-183-30/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change `function` so that when evaluating #'(lambda ...) we return an object of type `interpreted-function` rather than a list starting with one of `lambda` or `closure`. The new type reuses the existing PVEC_CLOSURE (nee PVEC_COMPILED) tag and tries to align the corresponding elements: - the arglist, the docstring, and the interactive-form go in the same slots as for byte-code functions. - the body of the function goes in the slot used for the bytecode string. - the lexical context goes in the slot used for the constants of bytecoded functions. The first point above means that `help-function-arglist`, `documentation`, and `interactive-form`s don't need to distinguish interpreted and bytecode functions any more. Main benefits of the change: - We can now reliably distinguish a list from a function value. - `cl-defmethod` can dispatch on `interactive-function` and `closure`. Dispatch on `function` also works now for interpreted functions but still won't work for functions represented as lists or as symbols, of course. - Function values are now self-evaluating. That was alrready the case when byte-compiled, but not when interpreted since (eval '(closure ...)) signals a void-function error. That also avoids false-positive warnings about "don't quote your lambdas" when doing things like `(mapcar ',func ...)`. * src/eval.c (Fmake_interpreted_closure): New function. (Ffunction): Use it and change calling convention of `Vinternal_make_interpreted_closure_function`. (FUNCTIONP, Fcommandp, eval_sub, funcall_general, funcall_lambda) (Ffunc_arity, lambda_arity): Simplify. (funcall_lambda): Adjust to new representation. (syms_of_eval): `defsubr` the new function. Remove definition of `Qclosure`. * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): Change calling convention and use `make-interpreted-closure`. * src/data.c (Fcl_type_of): Distinguish `byte-code-function`s from `interpreted-function`s. (Fclosurep, finterpreted_function_p): New functions. (Fbyte_code_function_p): Don't be confused by `interpreted-function`s. (Finteractive_form, Fcommand_modes): Simplify. (syms_of_data): Define new type symbols and `defsubr` the two new functions. * lisp/emacs-lisp/cl-print.el (cl-print-object) <interpreted-function>: New method. * lisp/emacs-lisp/oclosure.el (oclosure): Refine the parent to be `closure`. (oclosure--fix-type, oclosure-type): Simplify. (oclosure--copy, oclosure--get, oclosure--set): Adjust to new representation. * src/callint.c (Fcall_interactively): Adjust to new representation. * src/lread.c (bytecode_from_rev_list): * lisp/simple.el (function-documentation): * lisp/help.el (help-function-arglist): Remove the old `closure` case and adjust the byte-code case so it handles `interpreted-function`s. * lisp/emacs-lisp/cl-preloaded.el (closure): New type. (byte-code-function): Add it as a parent. (interpreted-function): Adjust parent (the type itself was already added earlier by accident). * lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function): Adjust to new representation. (byte-compile): Use `interpreted-function-p`. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust to new representation. (side-effect-free-fns): Add `interpreted-function-p` and `closurep`. * src/profiler.c (trace_hash, ffunction_equal): Simplify. * lisp/profiler.el (profiler-function-equal): Simplify. * lisp/emacs-lisp/nadvice.el (advice--interactive-form-1): Use `interpreted-function-p`; adjust to new representation; and take advantage of the fact that function values are now self-evaluating. * lisp/emacs-lisp/lisp-mode.el (closure): Remove `lisp-indent-function` property. * lisp/emacs-lisp/disass.el (disassemble-internal): Adjust to new representation. * lisp/emacs-lisp/edebug.el (edebug--strip-instrumentation): Use `interpreted-function-p`. * lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers): Add `closurep` and `interpreted-function-p`. * test/lisp/help-fns-tests.el (help-fns-test-lisp-defun): Adjust to more precise type info in `describe-function`. * test/lisp/erc/resources/erc-d/erc-d-tests.el (erc-d--render-entries): Use `interpreted-function-p`. * test/lisp/emacs-lisp/macroexp-resources/vk.el (vk-f4, vk-f5): Don't hardcode function values. * doc/lispref/functions.texi (Anonymous Functions): Don't suggest that function values are lists. Reword "self-quoting" to reflect the fact that #' doesn't return the exact same object. Update examples with the new shape of the return value. * doc/lispref/variables.texi (Lexical Binding): * doc/lispref/lists.texi (Rearrangement): * doc/lispref/control.texi (Handling Errors): Update examples to reflect new representation of function values.
* Don't error on tabbing to a widget at BOB (bug#69943)Stephen Berman2024-04-181-1/+7
| | | | | | | | | * lisp/wid-edit.el (widget-move): Don't move backward when at beginning of buffer, and keep point on widget's left side. * test/lisp/wid-edit-tests.el (widget-test-widget-move): Test that moving to a widget at beginning of buffer does not signal a beginning-of-buffer error.
* Avoid unnecessary escaping in 'url-build-query-string'Dagfinn Ilmari Mannsåker2024-04-181-1/+5
| | | | | | | | | * lisp/url/url-util.el (url-query-key-value-allowed-chars): New defconst. (url-build-query-string): Use it to escape only those characters that need it in keys and values. * test/lisp/url/url-util-tests.el (url-util-tests): Add new test cases. (Bug#70312)
* Adapt tree-sitter job on EMBAMichael Albinus2024-04-161-1/+7
| | | | | * test/infra/gitlab-ci.yml (.tree-sitter-template) (test-tree-sitter): Adapt tree-sitter job.
* ; Fix last change to secrets-tests.el.Basil L. Contovounesios2024-04-151-1/+1
|
* GC-mark temporary key values created when sorting (bug#69709)Mattias Engdegård2024-04-141-0/+21
| | | | | | | | | Bug reported and fix proposed by Aris Spathis. * src/sort.c (merge_markmem): Mark heap-allocated temporary key values. (tim_sort): Delay key function calls to after marking function has been registered. * test/src/fns-tests.el (fns-tests-sort-gc): New test.
* Recognize multicite macros from biblatexArash Esbati2024-04-131-0/+22
| | | | | | | | | * lisp/textmodes/reftex-cite.el (reftex-all-used-citation-keys): Match the citation keys used with multicite macros provided by biblatex. (bug#38249) * test/lisp/textmodes/reftex-tests.el (reftex-all-used-citation-keys): Adjust test accordingly.
* peg-tests.el: Fix test failuresStefan Monnier2024-04-131-8/+27
| | | | | | | | | | | | | * lisp/progmodes/peg.el (peg-parse): Refine heuristic since unknown terminals are resolved at run-time rather than compile-time now. (peg--macroexpand) <stack-action>: Avoid generating a `let` with an empty body. (peg--translate-rule-body): Adjust to name change of `macroexp-warn-and-return` and the fact that it's always available. * test/lisp/progmodes/peg-tests.el (peg-parse-string): Add `indent` declaration. (peg-test): Check that the compiler emits the warnings we expect.
* Merge branch 'track-changes'Stefan Monnier2024-04-131-0/+156
|\
| * lisp/emacs-lisp/track-changes.el: New file (bug#70077)Stefan Monnier2024-04-131-0/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new package provides an API that is easier to use right than our `*-change-functions` hooks. The patch includes changes to `diff-mode.el` and `eglot.el` to make use of this new package. * lisp/emacs-lisp/track-changes.el: New file. * test/lisp/emacs-lisp/track-changes-tests.el: New file. * doc/lispref/text.texi (Tracking changes): New subsection. * lisp/progmodes/eglot.el: Require `track-changes`. (eglot--virtual-pos-to-lsp-position): New function. (eglot--track-changes): New var. (eglot--managed-mode): Use `track-changes-register` i.s.o `after/before-change-functions` when available. (eglot--track-changes-signal): New function, partly extracted from `eglot--after-change`. (eglot--after-change): Use it. (eglot--track-changes-fetch): New function. (eglot--signal-textDocument/didChange): Use it. * lisp/vc/diff-mode.el: Require `track-changes`. Also require `easy-mmode` before the `eval-when-compile`s. (diff-unhandled-changes): Delete variable. (diff-after-change-function): Delete function. (diff--track-changes-function): Rename from `diff-post-command-hook` and adjust to new calling convention. (diff--track-changes): New variable. (diff--track-changes-signal): New function. (diff-mode, diff-minor-mode): Use it with `track-changes-register`.
* | Fix Icalendar export with ISO datesEli Zaretskii2024-04-131-0/+3
| | | | | | | | | | | | | | | | | | | | * lisp/calendar/icalendar.el (icalendar--datestring-to-isodate): Accept dashes in ISO-style numeric dates. Patch by Erwan Hingant <erwan.hingant@mailo.com>. (Bug#69894) * test/lisp/calendar/icalendar-tests.el (icalendar--datestring-to-isodate): Add a test for dashes in ISO-style numeric dates.
* | (elisp-tests-syntax-propertize): New test for bug#24542Stefan Monnier2024-04-121-0/+9
| | | | | | | | | | * test/lisp/progmodes/elisp-mode-tests.el (elisp-tests-syntax-propertize): New test.
* | Improve D-Bus byte-array conversionMichael Albinus2024-04-122-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/dbus.texi (Type Conversion): Adapt dbus-byte-array-to-string. * etc/NEWS: D-Bus byte array conversion works over raw UTF-8 bytes. Fix typos. * lisp/net/dbus.el (dbus-string-to-byte-array) (dbus-byte-array-to-string): BYTE-ARRAY must be an UTF-8 raw bytes sequence. Make optional argument MULTIBYTE obsolete. (Bug#70301) (dbus-call-method-handler, dbus-register-signal) (dbus-escape-as-identifier): Use `length=' and `length>'. * test/lisp/net/dbus-tests.el (dbus--test-method-handler) (dbus-test09-get-managed-objects): Use `length='. (dbus-test01-type-conversion): Extend test. * test/lisp/net/secrets-tests.el (secrets-test03-items): Extend test.
* | ; Fix whitespace in editfns-tests.elEli Zaretskii2024-04-111-1/+1
| | | | | | | | | | * test/src/editfns-tests.el (editfns-tests--before/after-change-functions): Fix whitespace.
* | (en/decode_coding_object): Fix `after-change-functions`Stefan Monnier2024-04-101-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For `en/decode-coding-string/region`, `after-change-functions` were either not run at all, or run only after deleting the text but not after inserting it. * src/coding.c (decode_coding_object, encode_coding_object): Run the after-change-functions after inserting the result. * test/src/editfns-tests.el (sanity-check-change-functions-with-op): New macro. (sanity-check-change-functions-errors): New function. (editfns-tests--before/after-change-functions): Use them to add cases for `en/decode-coding-string/region`.
* | Fix 'format-seconds' when all values are zero and %z is usedEli Zaretskii2024-04-101-1/+4
|/ | | | | | | * lisp/calendar/time-date.el (format-seconds): Fix all-zero time. * test/lisp/calendar/time-date-tests.el (test-format-seconds): Add two new tests. (Bug#70322)
* (test-replace-match-modification-hooks): Delete testStefan Monnier2024-04-091-17/+19
| | | | | * test/src/search-tests.el (test-replace-match-modification-hooks): Delete, this is testing a functionality we can't really support.
* ; Avoid byte-compiler warnings in 'ls-lisp-test-bug70271'.Eli Zaretskii2024-04-091-1/+2
|
* ; Fix the test in last change.Eli Zaretskii2024-04-091-0/+3
|
* Support more long time options in 'ls-lisp'Lin Sun2024-04-091-0/+36
| | | | | | | | * lisp/ls-lisp.el (ls-lisp--sanitize-switches): Support '--time' and '--sort=time'. (Bug#70271) * test/lisp/ls-lisp-tests.el (ls-lisp-test-bug70271): New test case.
* * Fix out of date comp pass names in comp-tests.elAndrea Corallo2024-04-081-5/+5
| | | | | * test/src/comp-tests.el (comp-tests-tco, comp-tests-fw-prop-1) (comp-tests-pure): Update out of date pass names.
* Make tree-sitter thing feature public and remove obsolete functionsYuan Fu2024-04-071-3/+3
| | | | | | | | | | | | | | | | | * lisp/treesit.el (treesit--things-around): Remove function. (treesit-forward-sexp): (treesit-beginning-of-thing): (treesit-end-of-thing): (treesit-navigate-thing): (treesit-thing-at-point): (treesit-outline-search): Use public version of thing-functions. (treesit--thing-prev): (treesit--thing-next): (treesit--thing-at): (treesit--navigate-thing): Make public. * test/src/treesit-tests.el (treesit--ert-test-defun-navigation): Use public version of thing-functions.
* Allow updating of /IGNORE timeouts in ERCF. Jason Park2024-04-072-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc.el (erc--read-time-period, erc--decode-time-period): Move body of former, now a superficial wrapper, to latter, a new function. (erc--format-time-period): New function. (erc--get-ignore-timer-args): New function. (erc--find-ignore-timer): New function to search through `timer-list' to find matching ignore timer. (erc-cmd-IGNORE): Refactor and redo doc string. Add new optional `timespec' parameter, primarily to aid in testing. Update an existing timer instead of always creating one, and display time remaining in "ignore list" output. Pass server buffer instead of current buffer to timer callbacks because `erc--unignore-user' displays its messages in the `active' buffer, not necessarily the issuing one. Note that doing this does discard potentially useful information, so if ever reverting, we can change the `cl-find' :test in `erc--find-ignore-timer' to something that compares the `erc-server-process' of both buffers. ;; ;; Something like: ;; ;; (defun erc--ignore-timers-equal-p (a b) ;; (and (equal (car a) (car b)) ;; (eq (buffer-local-value 'erc-server-process (cadr a)) ;; (buffer-local-value 'erc-server-process (cadr b))))) ;; (erc-cmd-UNIGNORE): Pass `erc-ignore-list' member matching `user' parameter to `erc--unignore-user' instead of original, raw parameter, along with the server buffer. (erc--unignore-user): Cancel existing timer and don't bother switching to server buffer since we're already there. (erc-message-english-ignore-list): New variable. * test/lisp/erc/erc-scenarios-ignore.el: New file. * test/lisp/erc/erc-tests.el (erc--read-time-period): New test. (erc-cmd-UNIGNORE): New test. (Bug#70127)
* (Freplace_match): Fix bug#65451Stefan Monnier2024-04-071-0/+74
| | | | | | | | | | | | | | | * src/search.c (Freplace_match): For ordering of *-change-functions. * test/src/editfns-tests.el (editfns-tests--before/after-change-functions): New test. (sanity-check--message, sanity-check-change-functions-error) (sanity-check-change-functions-check-size) (sanity-check-change-functions-before) (sanity-check-change-functions-after): New functions. (sanity-check--verbose, sanity-check-change-functions-beg) (sanity-check-change-functions-end) (sanity-check-change-functions-buffer-size) (sanity-check-change-functions-errors): New vars.
* Merge from origin/emacs-29Eli Zaretskii2024-04-061-0/+78
|\ | | | | | | | | 46b8746b38e Fix warning-suppress for list type "warning type" 910ea5f1e55 Make object init more robust (bug#69571)
| * Make object init more robust (bug#69571)Theodor Thornhill2024-03-311-0/+78
| | | | | | | | | | | | * lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Make the regex same as before, but conditionally check other heuristics rather than crazy regex shenanigans.
* | Make sh-script-tests.el more robustMichael Albinus2024-04-052-0/+7
| | | | | | | | | | | | | | * test/lisp/progmodes/sh-script-tests.el (test-sh-script-indentation) (test-basic-sh-indentation, test-indent-after-continuation): * test/lisp/progmodes/sh-script-resources/sh-indents.erts (Code): Skip if `sh-indent-supported-here' is nil. (Bug#70196)
* | Adapt treesitter tests for EMBAMichael Albinus2024-04-042-1/+7
| | | | | | | | | | | | | | * test/infra/Makefile.in (TREE-SITTER-FILES): Add js-tests.el and python-tests.el, which don't follow test file name convention. * test/infra/test-jobs.yml: Regenerate.
* | Make lexical-binding cookie warning test more robustMattias Engdegård2024-04-031-6/+8
| | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--lexical-binding-cookie): Run with lexical-binding both on and off.
* | Fix json-insert unibyte buffer bug (bug#70007)Mattias Engdegård2024-04-021-8/+35
| | | | | | | | | | | | | | | | | | | | | | Previously, a unibyte target buffer could be put in an incorrect state if json-insert was used to insert non-ASCII characters. * src/json.c (Fjson_insert): Simplify. Don't attempt to decode the data being inserted: it is guaranteed to be correct UTF-8 and is correct for both unibyte and multibyte buffers. * test/src/json-tests.el (json-serialize/roundtrip) (json-serialize/roundtrip-scalars): Extend tests.
* | Update JSON parser test and docsMattias Engdegård2024-04-011-5/+2
| | | | | | | | | | | | * test/src/json-tests.el (json-parse-string/object): Duplicated object keys are now retained in alist and plist output. * etc/NEWS: Mention it.
* | Fix symbol list matching regexps.Vladimir Kazanov2024-04-011-2/+45
| | | | | | | | | | | | | | | | | | Fix symbol list matching regexp performance Allow empty face lists, improve the face list matching regexp (see discussion in Bug#69714) based on relint's comments, add tests: * test/lisp/emacs-lisp/ert-font-lock-tests.el: Add tests. * lisp/emacs-lisp/ert-font-lock.el: Fix regexps.
* | Don't signal `json-end-of-file` for short nonempty bad JSON inputsMattias Engdegård2024-04-011-3/+1
| | | | | | | | | | * src/json.c (json_parse_value): Generate a plain parse error. * test/src/json-tests.el (json-parse-string/short): Adapt test.
* | Faster JSON parsingMattias Engdegård2024-04-011-19/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Speed up JSON parsing substantially by only UTF-8-parsing string literals and only exactly once. Previously, json-parse-string always first parsed the entire input and copied it to a new string, and then validated each string literal twice. We no longer create an extra new string when interning an alist key, nor do we garble plist keys with Unicode characters. * src/lread.c (intern_c_multibyte): New. * src/json.c (json_encode): Remove. (utf8_error): New. (json_parse_string): Faster and more careful UTF-8 decoding. Create and return a new multibyte string or symbol without extra decoding. All callers adapted. (Fjson_parse_string): Skip expensive input pre-decoding. * test/src/json-tests.el (json-parse-string/object-unicode-keys) (json-parse-string/short): New. (json-parse-string/string, json-parse-string/invalid-unicode): Adapt tests. * etc/NEWS: Mentioned change in errors.
* | Native JSON support is always availableMattias Engdegård2024-04-011-23/+0
| | | | | | | | | | | | * lisp/progmodes/sh-script.el (sh--json-read): Remove. (sh-shellcheck-flymake): Call json-parse-buffer directly. * test/src/json-tests.el: Don't check for function availability.
* | Fix the new PEG libraryEli Zaretskii2024-03-311-0/+0
| | | | | | | | | | | | | | | | | | | | | | * doc/lispref/peg.texi (Parsing Expression Grammars) (PEX Definitions, Parsing Actions, Writing PEG Rules): Fix markup, indexing, and wording. * etc/NEWS: Fix wording of PEG entry. * test/lisp/progmodes/peg-tests.el: Move from test/lisp/, to match the directory of peg.el.
* | Add peg.el as a built-in libraryEric Abrahamsen2024-03-301-0/+367
| | | | | | | | | | | | * lisp/progmodes/peg.el: New file, taken from ELPA package. * test/lisp/peg-tests.el: Package tests. * doc/lispref/peg.texi: Documentation.
* | New JSON encoder (bug#70007)Mattias Engdegård2024-03-301-7/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is in general at least 2x faster than the old encoder and does not depend on any external library. Using our own code also gives us control over translation details: for example, we now have full bignum support and tighter float formatting. * src/json.c (json_delete, json_initialized, init_json_functions) (json_malloc, json_free, init_json, json_out_of_memory) (json_releae_object, check_string_without_embedded_nulls, json_check) (json_check_utf8, lisp_to_json_nonscalar_1, lisp_to_json_nonscalar) (lisp_to_json, json_available_p, ensure_json_available, json_insert) (json_handle_nonlocal_exit, json_insert_callback): Remove. Remaining uses updated. * src/json.c (json_out_t, symset_t, struct symset_tbl) (symset_size, make_symset_table, push_symset, pop_symset) (cleanup_symset_tables, symset_hash, symset_expand, symset_add) (json_out_grow_buf, cleanup_json_out, json_make_room, JSON_OUT_STR) (json_out_str, json_out_byte, json_out_fixnum, string_not_unicode) (json_plain_char, json_out_string, json_out_nest, json_out_unnest) (json_out_object_cons, json_out_object_hash), json_out_array) (json_out_float, json_out_bignum, json_out_something) (json_out_to_string, json_serialize): New. (Fjson_serialize, Fjson_insert): New JSON encoder implementation. * test/src/json-tests.el (json-serialize/object-with-duplicate-keys) (json-serialize/string): Update tests.
* | bug#69992: Minor improvement to image map transformation logicDavid Ponce2024-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/image.el (image--compute-rotation): New function. (image--compute-map, image--compute-original-map): Use it. Ensure all transformations are applied or undone according to what Emacs does internally. Call a transformation function only when needed. Fix doc string. (image--scale-map, image--rotate-map): Assume effective scale argument. (image--rotate-coord): Improve doc string. (image--flip-map): Remove no more used argument FLIP. * test/lisp/image-tests.el (image-create-image-with-map): Use a valid SVG image otherwise `image-size' will not return a valid value and calculation of scale could fail. (image-transform-map): Update according to changed signature of `image--flip-map'.
* | Merge from origin/emacs-29Eli Zaretskii2024-03-301-0/+14
|\ \ | |/ | | | | | | | | 946d4aad1df Avoid errors in Info-search-case-sensitively in DIR buffers fbf68302999 Add test for previous change (bug#70023) bcf6dd6e266 Add typescript-ts-mode indentation for interface bodies (...
| * Add test for previous change (bug#70023)Theodor Thornhill2024-03-281-0/+14
| | | | | | | | | | * test/lisp/progmodes/typescript-ts-mode-resources/indent.erts: Add test.
* | Merge from origin/emacs-29Eli Zaretskii2024-03-301-1/+0
|\ \ | |/ | | | | | | | | | | | | | | | | | | 7a5d7be52c5 org--confirm-resource-safe: Fix prompt when prompting in ... 2bc865ace05 org-file-contents: Consider all remote files unsafe 6f9ea396f49 org-latex-preview: Add protection when `untrusted-content... 937b9042ad7 * lisp/gnus/mm-view.el (mm-display-inline-fontify): Mark ... ccc188fcf98 * lisp/files.el (untrusted-content): New variable. befa9fcaae2 org-macro--set-templates: Prevent code evaluation 3221d8d4611 * admin/authors.el (authors-aliases): Add ignored authors. 8d8253f8991 * etc/NEWS: Update for Emacs 29.3
* | ; * test/lisp/vc/vc-git-tests.el: bend doc string quoteMattias Engdegård2024-03-291-1/+1
| |
* | New `sort` keyword arguments (bug#69709)Mattias Engdegård2024-03-291-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the :key, :lessp, :reverse and :in-place keyword arguments. The old calling style remains available and is unchanged. * src/fns.c (sort_list, sort_vector, Fsort): * src/sort.c (tim_sort): Add keyword arguments with associated new features. All callers of Fsort adapted. * test/src/fns-tests.el (fns-tests--shuffle-vector, fns-tests-sort-kw): New test. * doc/lispref/sequences.texi (Sequence Functions): Update manual. * etc/NEWS: Announce.
* | Add `value<` (bug#69709)Mattias Engdegård2024-03-291-0/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a general-purpose polymorphic ordering function, like `<` but for any two values of the same type. * src/data.c (syms_of_data): Add the `type-mismatch` error. (bits_word_to_host_endian): Move... * src/lisp.h (bits_word_to_host_endian): ...here, and declare inline. * src/fns.c (Fstring_lessp): Extract the bulk of this function to... (string_cmp): ...this 3-way comparison function, for use elsewhere. (bool_vector_cmp, value_cmp, Fvaluelt): New. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns): Add `value<`, which is pure and side-effect-free. * test/src/fns-tests.el (fns-value<-ordered, fns-value<-unordered) (fns-value<-type-mismatch, fns-value<-symbol-with-pos) (fns-value<-circle, ert-deftest fns-value<-bool-vector): New tests. * doc/lispref/sequences.texi (Sequence Functions): * doc/lispref/numbers.texi (Comparison of Numbers): * doc/lispref/strings.texi (Text Comparison): Document the new value< function. * etc/NEWS: Announce.
* | pp.el: Try and fix bug#70039Stefan Monnier2024-03-281-0/+19
| | | | | | | | | | * lisp/emacs-lisp/pp.el (pp-fill): Avoid splitting `#N#` or `#[`. * test/lisp/emacs-lisp/pp-tests.el (pp-tests--sanity): New test.
* | Improve ert-font-lock assertion parser (Bug#69714)Vladimir Kazanov2024-03-282-25/+130
| | | | | | | | | | | | | | | | | | | | | | | | Fail on files with no assertions, parser now accepts multiple carets per line and face lists: * lisp/emacs-lisp/ert-font-lock.el: Assertion parser fix. * test/lisp/emacs-lisp/ert-font-lock-resources/no-asserts.js: * test/lisp/emacs-lisp/ert-font-lock-tests.el (test-parse-comments--no-assertion-error) (test-syntax-highlight-inline--caret-negated-wrong-face) (test-macro-test--file-no-asserts): New test cases. * doc/misc/ert.texi (Syntax Highlighting Tests): More syntax examples.
* | (pcase-mutually-exclusive): Use auto-generated tableStefan Monnier2024-03-281-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | The `pcase-mutually-exclusive-predicates` table was not very efficient since it grew like O(N²) with the number of predicates. Replace it with an O(N) table that's auto-generated from the `built-in-class` objects. * lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates): Delete variable. (pcase--subtype-bitsets): New function and constant. (pcase--mutually-exclusive-p): Use them. * lisp/emacs-lisp/cl-preloaded.el (built-in-class): Don't inline.
* | cl-preloaded.el: Partly revert last changeStefan Monnier2024-03-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | The change caused type-check errors in auth-source where they use `:type function` constraints on object slots and expect those to be able to hold symbols. * lisp/emacs-lisp/cl-preloaded.el (function): Revert last change. * test/src/data-tests.el (data-tests--cl-type-of): Use `cl-functionp` rather than `functionp` to test `function`.
* | cl-preloaded.el: Fix the type latticeStefan Monnier2024-03-261-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We generally want types to form not just a DAG but a lattice. If objects can be both `keyword` and `symbol-with-pos`, this means there should be a more precise type describing this intersection. If we ever find the need for such a refinement, we could add such a `keyword-with-pos` type, but here I took the simpler route of treating `keyword` not as a proper built-in type but as a second-class type like `natnum`. While fixing this problem, also fix the problem we had where `functionp` was not quite adequate to characterize objects of type `function`, by introducing a new predicate `cl-functionp` for that. * lisp/emacs-lisp/cl-preloaded.el (cl-functionp): New function. (function): Use it. (keyword): Don't declare it as a built-in type. (user-ptrp): Remove redundant declaration. * lisp/emacs-lisp/cl-generic.el (cl--generic--unreachable-types): Delete constant. (cl-generic-generalizers): Remove corresponding test. * lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add entry for `keyword` type. * lisp/emacs-lisp/comp.el (comp-known-predicates): Fix type for negative result of `characterp`. Remove duplicate `numberp` entry. Fix types for `keywordp` now that `keyword` is not a built-in type any more. * test/src/data-tests.el (data-tests--cl-type-of): Add a few cases. Remove workaround for `function`.