aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref/sequences.texi (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Improve documentation of 'seq-difference'Jens Schmidt2026-01-311-4/+5
| | | | | | * doc/lispref/sequences.texi (Sequence Functions): * lisp/emacs-lisp/seq.el (seq-difference): Clarify the documentation of 'seq-difference'. (Bug#80257)
* ; Fix documentaion of 'seq-intersection'Jens Schmidt2026-01-311-3/+3
| | | | | | * doc/lispref/sequences.texi (Sequence Functions): * lisp/emacs-lisp/seq.el (seq-intersection): Fix documentaion of 'seq-intersection'. (Bug#80257)
* ; Add 2026 to copyright years.Sean Whitton2026-01-011-1/+1
|
* Improve documentation of 'seq-intersection'Eli Zaretskii2025-12-061-4/+5
| | | | | | * doc/lispref/sequences.texi (Sequence Functions): * lisp/emacs-lisp/seq.el (seq-intersection): Clarify the documentation of 'seq-intersection'. (Bug#79844)
* Disallow string data resizing (bug#79784)Mattias Engdegård2025-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Only allow string mutation that is certain not to require string data to be resized and reallocated: writing bytes into a unibyte string, and changing ASCII to ASCII in a multibyte string. This ensures that mutation will never transform a unibyte string to multibyte, that the size of a string in bytes never changes, and that the byte offsets of characters remain the same. Most importantly, it removes a long-standing obstacle to reform of string representation and allow for future performance improvements. * src/data.c (Faset): Disallow resizing string mutation. * src/fns.c (clear_string_char_byte_cache): * src/alloc.c (resize_string_data): Remove. * test/src/data-tests.el (data-aset-string): New test. * test/lisp/subr-tests.el (subr--subst-char-in-string): Skip error cases. * test/src/alloc-tests.el (aset-nbytes-change): Remove test that is no longer relevant. * doc/lispref/strings.texi (Modifying Strings): * doc/lispref/sequences.texi (Array Functions): * doc/lispref/text.texi (Substitution): Update manual. * etc/NEWS: Announce.
* Lisp Reference Manual: Index standard symbol properties.Stephen Gildea2025-01-121-0/+1
| | | | | | | | | | | | | | * doc/lispref/symbols.texi (Standard Properties): * doc/lispref/commands.texi: * doc/lispref/customize.texi (Variable Definitions): * doc/lispref/help.texi: * doc/lispref/keymaps.texi: * doc/lispref/minibuf.texi (Minibuffer History): * doc/lispref/modes.texi (Setting Hooks): * doc/lispref/sequences.texi (Char-Tables): * doc/lispref/text.texi (Undo): * doc/lispref/variables.texi: Each standard symbol property has exactly one index entry, uniformly formatted as "(symbol property)".
* Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Update description of string comparison functionsUlrich Müller2024-08-061-2/+3
| | | | | | | | * doc/lispref/strings.texi (Text Comparison): Swap descriptions of 'string-equal' (the function) and 'string=' (its alias). Same for 'string-lessp' and 'string<'. Document 'string>'. (Bug#72486) * doc/lispref/sequences.texi (Sequence Functions): Update cross reference to 'string-lessp'.
* ; Fix punctuation in docsStefan Kangas2024-07-211-1/+1
|
* ; Fix typosStefan Kangas2024-06-071-1/+1
|
* Use a dedicated type to represent interpreted-function valuesStefan Monnier2024-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* `value<` manual entry adjustments (bug#69709)Mattias Engdegård2024-03-291-3/+21
| | | | | | * doc/lispref/sequences.texi (Sequence Functions): Explain lexicographical ordering. Note the dual nature of `nil`. Mention the depth limit.
* ; * doc/lispref/sequences.texi (Sequence Functions): Fix markup and examples.Eli Zaretskii2024-03-291-9/+22
|
* Remove `sort-on` (bug#69709)Mattias Engdegård2024-03-291-36/+4
| | | | | | | | * lisp/sort.el (sort-on): * doc/lispref/sequences.texi (Sequence Functions): * etc/NEWS: Remove the `sort-on` function which is now completely superseded by the extended `sort` in features, ease of use, and performance.
* New `sort` keyword arguments (bug#69709)Mattias Engdegård2024-03-291-63/+68
| | | | | | | | | | | | | | 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/+35
| | | | | | | | | | | | | | | | | | | | | | 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.
* ; * doc/lispref/sequences.texi (Sequence Functions): Fix typo.Eli Zaretskii2024-02-021-1/+1
|
* ; Another fix of last change.Eli Zaretskii2024-02-021-7/+8
|
* ; Fix last changeEli Zaretskii2024-02-021-19/+19
| | | | | | | * lisp/sort.el (sort-on): Doc fix. * doc/lispref/sequences.texi (Sequence Functions): Fix description of 'sort-on'.
* ; Fix last changeEli Zaretskii2024-02-021-0/+2
| | | | | * doc/lispref/sequences.texi (Sequence Functions): Improve indexing of last change
* New function 'sort-on'Eli Zaretskii2024-02-021-4/+33
| | | | | | | | | * lisp/sort.el (sort-on): New function. Patch by John Wiegley <jwiegley@gmail.com>. * etc/NEWS: * doc/lispref/sequences.texi (Sequence Functions): Document 'sort-on'.
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* ; Improve documentation of 'char-table-range'Eli Zaretskii2023-09-011-1/+2
| | | | | | * doc/lispref/sequences.texi (Char-Tables): * src/chartab.c (Fchar_table_range): Clarify what 'char-table-range' returns for an argument that is a cons cell.
* Update manual about `sort`Mattias Engdegård2023-04-111-27/+25
| | | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Remove inaccurate and over-specific claims about how `sort` works for lists: there is no guarantee that it doesn't modify the `car` fields of the input list (which is precisely what it does at this time). (cherry picked from commit c753a9592345e2084d69e9e2cc458c16db2e4141)
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* ; Fix typosStefan Kangas2022-12-161-1/+1
|
* Add 'seq-keep'Lars Ingebrigtsen2022-10-041-0/+13
| | | | | * doc/lispref/sequences.texi (Sequence Functions): Document it. * lisp/emacs-lisp/seq.el (seq-keep): New function (bug#58278).
* ; * doc/lispref/sequences.texi (Sequence Functions): Fix punctuation.Eli Zaretskii2022-09-041-3/+3
|
* Add new function `seq-positions'Damien Cassou2022-09-041-0/+21
| | | | | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Document it. * lisp/emacs-lisp/seq.el (seq-positions): New function. * lisp/emacs-lisp/shortdoc.el (sequence): Mention it. * test/lisp/emacs-lisp/seq-tests.el (test-seq-positions): Test it (bug#57548).
* Add new function `seq-remove-at-position'Damien Cassou2022-09-041-0/+18
| | | | | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Document it. * lisp/emacs-lisp/seq.el (seq-remove-at-position): New function. * lisp/emacs-lisp/shortdoc.el (sequence): Mention it. * test/lisp/emacs-lisp/seq-tests.el (test-seq-remove-at-position): Test it.
* Improve documentation of several functions in seq.elDamien Cassou2022-09-041-1/+1
| | | | | | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): * lisp/emacs-lisp/seq.el (seq-contains): (seq-contains-p): (seq-set-equal-p): (seq-position): (seq-union): (seq-intersection): (seq-difference): Use more standard wording in the docstrings (bug#57561).
* ; Fix the lispref manual about seq.elEli Zaretskii2022-08-311-2/+1
| | | | | * doc/lispref/sequences.texi (Sequence Functions): seq.el is preloaded, so no need to load it manually. (Bug#57505)
* Add new function `seq-split'Lars Ingebrigtsen2022-07-031-0/+14
| | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Document it. * lisp/emacs-lisp/seq.el (seq-split): New function. * lisp/emacs-lisp/shortdoc.el (sequence): Mention it.
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Improve the documentation of a recent changeEli Zaretskii2021-09-171-3/+5
| | | | | | * etc/NEWS: * doc/lispref/sequences.texi (Sequence Functions): Improve documentation of 'seq-union'.
* Add new sequence function 'seq-union'Stefan Kangas2021-09-171-0/+16
| | | | | | | | * lisp/emacs-lisp/seq.el (seq-union): New function. * doc/lispref/sequences.texi (Sequence Functions): * lisp/emacs-lisp/shortdoc.el (sequence): Document above new function. * test/lisp/emacs-lisp/seq-tests.el (test-seq-union): New test.
* Revert "Add macro `seq-setq`."Lars Ingebrigtsen2021-08-141-17/+0
| | | | | | This reverts commit a8a3fd8f8e27089ac46bf98e534529ff03f679a5. The same patch was applied twice. Remove the second instance.
* Add macro `seq-setq`.Earl Hyatt2021-08-141-0/+17
| | | | | | | * doc/lispref/sequences.texi (seq-setq): Document this macro. * test/lisp/emacs-lisp/seq-tests.el (test-seq-setq): Test this macro (bug#50053).
* Add macro `seq-setq`.Earl Hyatt2021-08-141-0/+17
| | | | | | | | | * doc/lispref/sequences.texi (seq-setq): Document this macro. * lisp/emacs-lisp/seq.el (seq-setq): New macro. * test/lisp/emacs-lisp/seq-tests.el (test-seq-setq): Test this macro (bug#50053).
* Merge from origin/emacs-27Glenn Morris2021-02-191-1/+1
|\ | | | | | | | | | | 4712c75ab8 Clarify when activate-mark-hook is run abedf3a865 Fix language-environment and font selection on MS-Windows 8b8708eadd Fix example in Sequence Functions node in the manual
| * Fix example in Sequence Functions node in the manualPetteri Hintsanen2021-02-071-1/+1
| | | | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Fix the result from the example.
| * Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* | Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | Add new predicates for sequence lengthsLars Ingebrigtsen2020-12-271-0/+15
|/ | | | | | | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Document them. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Mark them as side-effect-free. * lisp/emacs-lisp/shortdoc.el (list): Mention them. * src/fns.c (Flength): Mention them in the doc string. (length_internal): New function. (Flength_less, Flength_greater, Flength_equal): New defuns. (syms_of_fns): Sym them.
* Clarify the seq-reduce documentationLars Ingebrigtsen2020-10-151-2/+7
| | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Ditto. * lisp/emacs-lisp/seq.el (seq-reduce): Clarify the order of the arguments (bug#43995).
* ; Fix last changeEli Zaretskii2020-08-151-1/+1
|
* ; * doc/lispref/sequences.texi (Sequence Functions): Typo Fix. (Bug#42871)Eli Zaretskii2020-08-151-2/+2
|
* Don’t use “constant” for values you shouldn’t changePaul Eggert2020-05-161-14/+11
| | | | | | | | | | | | | | | | | | | | Inspired by patch proposed by Dmitry Gutov (Bug#40671#393) and by further comments by him and by Michael Heerdegen in the same bug report. * doc/lispintro/emacs-lisp-intro.texi (setcar): Don’t push mutability here. * doc/lispref/eval.texi (Self-Evaluating Forms, Quoting) (Backquote): * doc/lispref/lists.texi (Modifying Lists): * doc/lispref/objects.texi (Lisp Data Types, Mutability): * doc/lispref/sequences.texi (Array Functions, Vectors): * doc/lispref/strings.texi (String Basics, Modifying Strings): Don’t use the word “constant” to describe all values that a program should not change. * doc/lispref/objects.texi (Mutability): Rename from “Constants and Mutability”. All uses changed. In a footnote, contrast the Emacs behavior with that of Common Lisp, Python, etc. for clarity, and say the goal is to be nicer.
* Improve mutability docPaul Eggert2020-04-191-6/+8
| | | | | | | | | | See Eli Zaretskii’s suggestions (Bug#40671#33). * doc/lispref/lists.texi (Setcar, Setcdr, Rearrangement): * doc/lispref/sequences.texi (Sequence Functions) (Array Functions): Add commentary to examples. * doc/lispref/lists.texi (Sets And Lists): Revert change to delq example.
* Improve mutability documentationPaul Eggert2020-04-191-5/+5
| | | | | | | | | | | | | This change was inspired by comments from Štěpán Němec in: https://lists.gnu.org/r/emacs-devel/2020-04/msg01063.html * doc/lispref/objects.texi (Lisp Data Types): Mention mutability. (Constants and mutability): New section. * doc/lispintro/emacs-lisp-intro.texi (Lists diagrammed) (Indent Tabs Mode): Improve wording. * doc/lispref/eval.texi (Self-Evaluating Forms): Say that they return constants. * doc/lispref/lists.texi (Sets And Lists): Fix memql mistake/confusion that I recently introduced.