summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in test of read-only cl-defstruct slot.Earl Hyatt2025-03-311-2/+3
| | | | | | | | | * test/lisp/emacs-lisp/cl-macs-tests.el (mystruct) (cl-lib-struct-accessors): Use ":read-only" instead of ":readonly". * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-struct-accessors): Test using `setf' on read-only accessor to make sure the correct keyword is used.
* Add cl-with-accessorsEarl Hyatt2025-03-311-0/+15
| | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-with-accessors): New macro. * doc/misc/cl.texi (Structures): Mention the new macro. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-struct-with-accessors): New Test. * etc/NEWS (New macro 'cl-with-accessors'.): Mention the macro. This macro is useful when making repeated use of a structures accessor functions, such as reading from a slot and then writing to a slot. It is similar to 'with-slots' from EIEIO, but uses accessor functions instead of slot names.
* ; Fix OOM kill in ert-testsEli Zaretskii2025-03-261-3/+1
| | | | | | * test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch-expensive): Mark it 'unstable', as it might run out of memory on GNU/Linux and on Windows.
* ; Fix 'ert-tests' on MS-WindowsEli Zaretskii2025-03-261-0/+2
| | | | | * test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch-expensive): Skip the test on MS-Windows.
* Use numeric time zone suffix in ERT explainer.Philipp Stephani2025-03-261-2/+2
| | | | | | | | | | This is more robust since the time zone name is system-dependent. * lisp/emacs-lisp/ert.el (ert--explain-time-equal-p): Use numeric time zone suffix. * test/lisp/emacs-lisp/ert-tests.el (ert-test-explain-time-equal-p): Adapt test.
* Add an ERT explainer for 'time-equal-p'.Philipp Stephani2025-03-251-0/+8
| | | | | | | | * lisp/emacs-lisp/ert.el (ert--explain-time-equal-p): New explainer function. * test/lisp/emacs-lisp/ert-tests.el (ert-test-explain-time-equal-p): New test.
* ; Replace "Elisp" with "Lisp" or "Emacs Lisp" in some placesSean Whitton2025-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (libgccjit_not_found_err) (libgccjit_dev_not_found_err): * doc/lispref/elisp.texi (Top): * doc/lispref/functions.texi (What Is a Function): * doc/lispref/parsing.texi (Parsing Program Source) (Tree-sitter C API): * doc/misc/gnus.texi (The Gnus Registry): * etc/TODO: * lisp/auth-source.el (auth-source-search): * lisp/cedet/semantic/bovine/el.el (emacs-lisp-mode): * lisp/editorconfig.el (editorconfig-get-local-variables-functions): * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): * lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): * lisp/net/tramp-message.el (tramp-debug-font-lock-keywords): * src/frame.c (do_switch_frame): * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-help-fns-examples-function-test): Say "Lisp" not "Elisp". * lisp/progmodes/peg.el (peg-translate-exp): Say "Emacs Lisp" not "Elisp".
* Fix capitalization ELisp -> ElispSean Whitton2025-03-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (libgccjit_not_found_err) (libgccjit_dev_not_found_err): * doc/emacs/buffers.texi (List Buffers): * doc/lispref/elisp.texi (Tree-sitter C API): * doc/lispref/functions.texi (What Is a Function): * doc/lispref/parsing.texi (Parsing Program Source) (Tree-sitter C API): * doc/misc/gnus.texi (The Gnus Registry): * etc/DEBUG: * etc/NEWS: * etc/NEWS.25: * etc/NEWS.26: * etc/NEWS.28: * etc/NEWS.30: * etc/TODO: * lib-src/emacsclient.c (print_help_and_exit): * lisp/auth-source.el (auth-source-search): * lisp/cedet/semantic/bovine/el.el (emacs-lisp-mode): * lisp/cedet/semantic/wisent/comp.el (wisent-automaton-lisp-form): * lisp/cedet/srecode/el.el (srecode-semantic-apply-tag-to-dict): * lisp/editorconfig.el (editorconfig-get-local-variables-functions): * lisp/emacs-lisp/bindat.el (bindat-type): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): * lisp/emacs-lisp/cl-macs.el (cl--labels-convert): * lisp/emacs-lisp/lisp-mode.el (lisp-fdefs) (lisp-fill-paragraphs-as-doc-string): * lisp/emacs-lisp/macroexp.el (macroexp--fgrep): * lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): * lisp/emacs-lisp/re-builder.el: * lisp/erc/erc-button.el (erc-emacswiki-lisp-url): * lisp/help-fns.el (help-fns--describe-function-or-command-prompt): * lisp/menu-bar.el (menu-bar-search-documentation-menu): * lisp/net/tramp-message.el (tramp-debug-font-lock-keywords): * lisp/org/org-capture.el (org-capture): * lisp/org/org.el (org-category, org-todo): * lisp/org/ox.el (org-export-async-start): * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): * lisp/progmodes/peg.el (peg-translate-exp): * lisp/progmodes/ruby-ts-mode.el: * lisp/woman.el (woman-mode, woman-parse-numeric-arg): * src/chartab.c (map_char_table_for_charset): * src/fns.c (extract_data_from_object): * src/frame.c (do_switch_frame): * src/keyboard.c (make_lispy_event): * test/lisp/emacs-lisp/cl-macs-tests.el (cl-&key-arguments): * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-help-fns-examples-function-test): * test/manual/etags/c-src/emacs/src/keyboard.c (make_lispy_event): Fix capitalization ELisp -> Elisp.
* Correct (debug body) edebug specsMichael Heerdegen2025-03-081-1/+1
| | | | | | | | | This fixes Bug#69865. * lisp/org/ob-exp.el (org-babel-exp--at-source): * test/lisp/dired-tests.el (dired-test-with-temp-dirs): * test/lisp/emacs-lisp/package-tests.el (with-fake-help-buffer): Fix broken edebug specs (debug body) -> (debug (body)).
* Add more tests for cl-seq.elStefan Kangas2025-03-061-0/+89
| | | | | | | * test/lisp/emacs-lisp/cl-seq-tests.el (cl--oddp-safe) (cl-subst-if-test, cl-subst-if-not-test, cl-nsubst-test) (cl-nsubst-if-test, cl-nsubst-if-not-test, cl-sublis-test) (cl-nsublis-test, cl-tree-equal-test): New tests.
* (pp-fill): Fix bug#76715Stefan Monnier2025-03-051-0/+9
| | | | | * lisp/emacs-lisp/pp.el (pp-fill): Don't break before `.` within symbols. * test/lisp/emacs-lisp/pp-tests.el (pp-tests--bug76715): New test.
* ; Fix my last commitStefan Kangas2025-03-041-7/+0
| | | | | * test/lisp/emacs-lisp/package-tests.el (package-test-install-single-from-archive/string-type): Delete test.
* Make package-install accept a string as wellStefan Kangas2025-03-021-0/+7
| | | | | | | | | * lisp/emacs-lisp/package.el (package-install): Allow passing a string instead of a symbol. (Bug#72160) (package-upgrade): Improve docstring. * test/lisp/emacs-lisp/package-tests.el (package-test-install-single-from-archive/string-type): New test.
* Merge from origin/emacs-30Eli Zaretskii2025-03-011-47/+47
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f88dc0f2f9d ; Fix documentation of 'buffer-text-pixel-size' 734986349fd ; Minor Android documentation improvements a90da899034 ; Fix up emacs-lisp-mode docstring 58c7acb5554 ; Fix completion-fail-discreetly docstring typo. 02c830ba22b Fix ert-font-lock macro signatures 0c6b8643aec Fix a typo in 'window_text_pixel_size' 8a8c25eaccd ; Add Rudolf Schlatte to authors.el 94c0ea39a5a * doc/misc/efaq.texi (New in Emacs 30): Fix typo. (Bug#7... 0be5f9115ec ; * etc/images/README (Files): Add an entry for last-page... 63adf9dcf53 ; Reflow some cl-lib docstrings 99253f79703 ; * etc/TODO: New section "Make it easier to contribute". # Conflicts: # lisp/emacs-lisp/cl-macs.el
| * Fix ert-font-lock macro signaturesBasil L. Contovounesios2025-02-251-47/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/ert.texi (Syntax Highlighting Tests): * test/lisp/emacs-lisp/ert-font-lock-tests.el (test-line-comment-p--emacs-lisp, test-line-comment-p--shell-script) (test-line-comment-p--javascript, test-line-comment-p--python) (test-line-comment-p--c, test-macro-test--correct-highlighting) (test-macro-test--docstring, test-macro-test--failing) (test-macro-test--file, test-macro-test--file-no-asserts) (test-macro-test--file-failing): Reindent macro calls. (with-temp-buffer-str-mode): Evaluate macro arguments left-to-right. (ert-font-lock--wrap-begin-end): Use rx for more robust composition. (test-line-comment-p--php): Require that php-mode is callable, not already loaded. * lisp/emacs-lisp/ert-font-lock.el (ert-font-lock-deftest) (ert-font-lock-deftest-file): NAME is not followed by an empty list like in ert-deftest, so the optional DOCSTRING is actually the second argument. Adapt calling convention in docstring, and debug, doc-string, and indent properties accordingly (bug#76372). Fix docstring grammar, document MAJOR-MODE, and avoid referring to a file name as a path.
| * Update copyright year to 2025Stefan Kangas2025-01-0275-75/+75
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | Make define-global-minor-mode alias obsoleteStefan Kangas2025-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/easy-mmode.el (define-global-minor-mode): Make alias for old name obsolete, just in time for its 20th anniversary. * test/lisp/emacs-lisp/lisp-mode-tests.el (test-font-lock-keywords): * lisp/progmodes/subword.el (global-subword-mode) (global-superword-mode): Don't use above obsolete name. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression) (lisp-fdefs): Remove syntax highlighting for obsolete name. * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload): Add comment mentioning the obsolete status of above alias. * doc/lispref/loading.texi (Autoload): Don't document obsolete name.
* | Adapt a number of regression tests to AndroidPo Lu2025-02-262-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/infra/android/test-controller.el (ats-run-test): Strip text properties from value string. Inhibit text conversion. * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--locate-symbols): * test/lisp/emacs-lisp/rmc-tests.el (test-rmc--add-key-description) (test-rmc--add-key-description/with-attributes) (test-rmc--add-key-description/non-graphical-display) (test-read-multiple-choice, test-read-multiple-choice-help): Skip on Android in some wise or another.
* | Make cl-gensym obsolete in favor of built-in gensymStefan Kangas2025-02-252-16/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-gensym): Declare function obsolete in favor of gensym, added in Emacs 26.1. The only reason for its existence is that it allows an integer argument, but that's not really useful, so it's better to remove this complexity. Ref: https://lists.gnu.org/r/emacs-devel/2017-09/msg00313.html * doc/misc/cl.texi (Symbols, Creating Symbols, Efficiency Concerns) (Obsolete Setf Customization): Don't document above obsolete function. * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): * lisp/emacs-lisp/edebug.el (edebug-make-form-wrapper): * lisp/obsolete/cl.el (cl--function-convert, lexical-let): * lisp/obsolete/thumbs.el (thumbs-temp-file): * lisp/progmodes/eglot.el (eglot--lambda) (eglot--when-live-buffer, eglot--when-buffer-window) (eglot--collecting-xrefs, eglot--glob-parse): * lisp/progmodes/flymake.el (flymake--run-backend): * test/lisp/emacs-lisp/package-tests.el (with-package-test): * test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact): * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-read-buffer, elisp-shorthand-read-from-string): Prefer plain gensym to cl-gensym in files that can depend on Emacs 26.1. * lisp/jsonrpc.el (jsonrpc-lambda, jsonrpc-request): Prefer gensym to cl-gensym only when defined, as this file supports Emacs 25.1 * test/lisp/emacs-lisp/cl-macs-tests.el (cl-lib-test-gensym): Simplify test as 'should' no longer uses cl-gensym.
* | Use cl-with-gensyms in a few more casesStefan Kangas2025-02-253-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/cl.texi (Macro Bindings): * lisp/emacs-lisp/comp.el (comp--with-sp): * lisp/emacs-lisp/subr-x.el (with-buffer-unmodified-if-unchanged): * lisp/eshell/em-extpipe.el (eshell-extpipe--or-with-catch): * lisp/international/mule-cmds.el (with-locale-environment): * lisp/kmacro.el (kmacro-menu--marks-exist-p): * test/lisp/emacs-lisp/cl-extra-tests.el (cl-lib-test-remprop): * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-deduplicate): * test/lisp/emacs-lisp/ert-tests.el (ert-test-special-operator-p): * test/lisp/kmacro-tests.el (kmacro-tests-should-insert) (kmacro-tests-should-match-message): * test/lisp/replace-tests.el (replace-tests-with-undo): Use cl-with-gensyms instead of bare gensym call.
* | Move buffer related functions from ert-x.el to ert.elStefan Kangas2025-02-242-91/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/ert-x.el (ert--text-button) (ert--format-test-buffer-name, ert--test-buffers) (ert--test-buffer-button, ert--test-buffer-button-action) (ert--call-with-test-buffer, ert-with-test-buffer) (ert-with-buffer-selected, ert-kill-all-test-buffers) (ert-call-with-buffer-renamed, ert-buffer-string-reindented): Move from here... * lisp/emacs-lisp/ert.el (ert--text-button) (ert--format-test-buffer-name, ert--test-buffers) (ert--test-buffer-button, ert--test-buffer-button-action) (ert--call-with-test-buffer, ert-with-test-buffer) (ert-kill-all-test-buffers, ert-with-buffer-selected) (ert-call-with-buffer-renamed, ert-with-buffer-renamed): ...to here. * doc/misc/ert.texi (Helpers for Buffers): Break out new section... (Helper Functions): ...from here. * lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected): Move obsolete definition to the end of the file. * test/lisp/emacs-lisp/ert-x-tests.el (ert--hash-table-to-alist, ert-test-test-buffers) (ert-test-with-buffer-selected/current) (ert-test-with-buffer-selected/selected) (ert-test-with-buffer-selected/nil-buffer) (ert-test-with-buffer-selected/modification-hooks) (ert-test-with-buffer-selected/read-only) (ert-test-with-buffer-selected/return-value) (ert-test-with-test-buffer-selected/modification-hooks) (ert-test-with-test-buffer-selected/read-only) (ert-test-with-test-buffer-selected/return-value) (ert-test-with-test-buffer-selected/buffer-name): Move tests from here... * test/lisp/emacs-lisp/ert-tests.el (ert--hash-table-to-alist, ert-test-test-buffers) (ert-test-with-buffer-selected/current) (ert-test-with-buffer-selected/selected) (ert-test-with-buffer-selected/nil-buffer) (ert-test-with-buffer-selected/modification-hooks) (ert-test-with-buffer-selected/read-only) (ert-test-with-buffer-selected/return-value) (ert-test-with-test-buffer-selected/selected) (ert-test-with-test-buffer-selected/modification-hooks) (ert-test-with-test-buffer-selected/read-only) (ert-test-with-test-buffer-selected/return-value) (ert-test-with-test-buffer-selected/buffer-name): ...to here. * test/lisp/progmodes/hideshow-tests.el (ert-x): * test/lisp/simple-tests.el (ert-x): * test/lisp/whitespace-tests.el (ert-x): Don't require.
* | Support selecting buffer in ert-with-test-bufferStefan Kangas2025-02-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/ert-x.el (ert-with-test-buffer): Add new keyword argument :selected to make the buffer current and selected. (ert-with-test-buffer-selected): Make obsolete and redefine in terms of ert-with-test-buffer. * doc/misc/ert.texi (Helper Functions): Document above new :selected keyword argument, and remove documentation of ert-with-test-buffer-selected. * test/lisp/emacs-lisp/ert-x-tests.el (ert-test-with-test-buffer-selected/selected) (ert-test-with-test-buffer-selected/modification-hooks) (ert-test-with-test-buffer-selected/read-only) (ert-test-with-test-buffer-selected/return-value) (ert-test-with-test-buffer-selected/buffer-name): * test/lisp/progmodes/hideshow-tests.el (hideshow-tests-with-temp-buffer-selected): * test/lisp/simple-tests.el (kill-whole-line-invisible) (kill-whole-line-read-only, kill-whole-line-after-other-kill) (kill-whole-line-buffer-boundaries) (kill-whole-line-line-boundaries): * test/lisp/whitespace-tests.el (whitespace-tests--with-test-buffer, whitespace-tests--global): Use ert-with-test-buffer instead of ert-with-test-buffer-selected.
* | Prefer ert-with-temp-directory in testsStefan Kangas2025-02-231-98/+99
| | | | | | | | | | | | | | | | | | | | | | * test/lisp/dired-aux-tests.el (dired-test-bug30624): * test/lisp/emacs-lisp/track-changes-tests.el (track-changes-tests--random): * test/src/buffer-tests.el (test-buffer-chars-modified-ticks): * test/src/fileio-tests.el (fileio-tests--symlink-failure) (fileio-tests--insert-file-interrupt) (fileio-tests--circular-after-insert-file-functions): Prefer ert-with-temp-directory to using make-temp-file directly.
* | Prefer incf to cl-incf in testsStefan Kangas2025-02-2314-63/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-reify-function): * test/lisp/emacs-lisp/cl-extra-tests.el (cl-getf): * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-for-as-arith-order-side-effects) (cl-macs-loop-for-as-equals-then, cl-macs-loop-do, cl-macs-loop-finally) (cl-macs-loop-in-ref, cl-macs-loop-being-elements-of-ref) (cl-macs-test--symbol-macrolet, cl-the): * test/lisp/emacs-lisp/cl-seq-tests.el (cl-lib-test-remove) (cl-lib-test-remove-if-not): * test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el (edebug-test-code-range): * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-deduplicate): * test/lisp/emacs-lisp/generator-tests.el (cps-while-incf): (cps-test-iter-cleanup-once-only): * test/lisp/emacs-lisp/hierarchy-tests.el (hierarchy-labelfn-button-if-does-not-button-unless-condition) (hierarchy-labelfn-button-if-does-button-when-condition): * test/lisp/emacs-lisp/let-alist-tests.el (let-alist-evaluate-once): * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp, lisp-indent-region): * test/lisp/emacs-lisp/map-tests.el (test-map-elt-gv) (test-setf-map-with-function): * test/lisp/emacs-lisp/multisession-tests.el (multi-test-sqlite-simple) (multi-test-sqlite-busy, multi-test-files-simple) (multi-test-files-busy): * test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test, oclosure-test-mutate): * test/lisp/emacs-lisp/track-changes-tests.el (track-changes-tests--random): * test/lisp/files-tests.el (files-tests--with-buffer-offer-save): * test/lisp/net/shr-tests.el (shr-test/zoom-image): * test/lisp/replace-tests.el (replace-tests-with-undo): * test/src/buffer-tests.el (test-overlay-randomly): * test/src/data-tests.el (test-bool-vector-bv-from-hex-string): * test/src/fns-tests.el (fns-tests-sort): * test/src/json-tests.el (json-insert/signal, json-insert/throw): * test/src/minibuf-tests.el (minibuf-tests--strings-to-symbol-alist) (minibuf-tests--strings-to-string-alist) (minibuf-tests--strings-to-string-hashtable) (minibuf-tests--strings-to-symbol-hashtable): * test/src/process-tests.el (make-process/file-handler/found): Prefer incf to cl-incf.
* | New macros incf and decfStefan Kangas2025-02-232-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/cl-lib.el (cl-incf, cl-decf): Move macros from here... * lisp/emacs-lisp/gv.el (incf, decf): ...to here. Make old names into aliases, documented as deprecated. * lisp/obsolete/cl.el: Don't alias incf and decf. * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-incf) (cl-lib-test-decf): Move tests from here... * test/lisp/emacs-lisp/gv-tests.el (gv-incf, gv-decf): ...to here. * doc/lispref/numbers.texi (Arithmetic Operations): * lisp/emacs-lisp/shortdoc.el (number): Document incf and decf. * doc/lispref/variables.texi (Multisession Variables): * doc/misc/cl.texi (Organization, Modify Macros, Modify Macros) (Modify Macros, Macro Bindings, For Clauses, Property Lists) (Structures, Efficiency Concerns, Obsolete Setf Customization): Delete cl-incf and cl-decf documentation, moving any relevant parts to lispref. Delete some parts that seem to primarily regard implementation details that do not warrant inclusion in lispref. Update all examples to use incf/decf.
* | Expand tests for cl-incf and cl-decfStefan Kangas2025-02-221-4/+24
| | | | | | | | | | * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-incf) (cl-lib-test-decf): Expand tests.
* | Prefer plusp/minusp to cl-plusp/cl-minuspStefan Kangas2025-02-172-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/dired.el (dired--move-to-next-line): * lisp/emacs-lisp/ert.el (ert-run-tests-batch, ert-face-for-stats): * lisp/emacs-lisp/pp.el (pp--format-definition): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--org-timestamp): * lisp/ibuffer.el (ibuffer-compile-format, ibuffer--format-title) (ibuffer--format-summary): * lisp/image-mode.el (image-transform-set-percent): * lisp/international/emoji.el (emoji--list-generate, emoji--read-emoji): * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation) (ebrowse-set-member-buffer-column-width) (ebrowse-cyclic-display-next/previous-member-list) (ebrowse-draw-member-short-fn) (ebrowse-switch-member-buffer-to-sibling-class, ebrowse-push-position): * lisp/textmodes/dns-mode.el (dns-mode-reverse-and-expand-ipv6): * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--not-writable-directory) (bytecomp-tests--dest-mountpoint) (bytecomp-tests--target-file-no-directory): * test/lisp/emacs-lisp/cl-seq-tests.el (cl-member-if-test) (cl-member-if-not-test, cl-assoc-if-not-test, cl-rassoc-if-test) (cl-rassoc-if-not-test): * test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid): Prefer plusp and minusp to cl-plusp and cl-minusp.
* | New functions plusp and minuspStefan Kangas2025-02-171-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/cl-lib.el (cl-plusp, cl-minusp): Move from here... * lisp/subr.el (plusp, minusp): ...to here. Make old names into aliases, documented as deprecated. Add type declarations. Change from defsubst to regular functions with compiler macros. * lisp/obsolete/cl.el: Don't alias plusp and minusp. * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-plusp) (cl-lib-test-minusp): Move tests from here... * test/lisp/subr-tests.el (subr-test-plusp, subr-test-minusp): ...to here. * doc/lispref/numbers.texi (Predicates on Numbers): Document plusp and minusp. * doc/misc/cl.texi (Predicates on Numbers): Delete cl-plusp and cl-minusp. * lisp/emacs-lisp/shortdoc.el (number): Document plusp and minusp instead of cl-plusp and cl-minusp.
* | Make the rx `eval` form use lexical binding when activeMattias Engdegård2025-02-171-1/+8
| | | | | | | | | | | | | | | | | | Previously, it always used dynamic binding. * lisp/emacs-lisp/rx.el (rx--expand-eval): Heed `lexical-binding`. * test/lisp/emacs-lisp/rx-tests.el (rx-tests--x, rx-tests--get-x) (rx-eval): Add test case. * etc/NEWS: Announce.
* | Prefer oddp/evenp to free-coding them in testsStefan Kangas2025-02-172-35/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/bindat-tests.el (bindat-test--sint): * test/lisp/emacs-lisp/seq-tests.el (test-seq-drop-while) (test-seq-take-while, test-seq-filter, test-seq-remove) (test-seq-count, test-seq-some, test-seq-find, test-seq-every-p) (test-seq-group-by): * test/lisp/eshell/em-pred-tests.el (eshell-with-file-attributes-from-name): * test/lisp/filenotify-tests.el (file-notify-test07-many-events) (file-notify-test09-watched-file-in-watched-dir): * test/src/floatfns-tests.el (bignum-expt, bignum-round): * test/src/undo-tests.el (undo-test4): Prefer oddp/evenp to free-coding them.
* | Prefer oddp/evenp to cl-oddp/cl-evenpStefan Kangas2025-02-174-94/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/calc/calc-ext.el (math-oddp): * lisp/calc/calc-misc.el (math-evenp): * lisp/calendar/todo-mode.el (todo-adjusted-category-label-length, todo-insert-category-line) (todo-update-categories-display): * lisp/emacs-lisp/cl-macs.el (cl-defstruct): * lisp/net/gnutls.el (open-gnutls-stream): * lisp/tab-line.el (tab-line-tab-face-inactive-alternating): * test/lisp/auth-source-tests.el (auth-source-test-macos-keychain-search): * test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-notany) (cl-extra-test-notevery): * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-adjoin-test): * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-collect) (cl-macs-loop-append/nconc, cl-macs-loop-when) (cl-macs-loop-if): * test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-remove-test) (cl-remove-if-test, cl-remove-if-not-test, cl-seq-delete-test) (cl-delete-if-test, cl-delete-if-not-test) (cl-seq-substitute-if-test, cl-seq-substitute-if-not-test) (cl-find-if-test, cl-find-if-not-test, cl-position-if-test) (cl-seq-count-test, cl-count-if-test, cl-count-if-not-test) (cl-member-if-test, cl-member-if-not-test, cl-assoc-if-test) (cl-assoc-if-not-test, cl-rassoc-if-test) (cl-rassoc-if-not-test): * test/src/treesit-tests.el (treesit-search-forward-predicate): Prefer oddp/evenp to cl-oddp/cl-evenp where possible. * lisp/calc/calc-ext.el (cl-lib): * lisp/calc/calc-misc.el (cl-lib): Don't require.
* | New functions oddp and evenpStefan Kangas2025-02-171-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/cl-lib.el (cl-oddp, cl-evenp): Move from here... * lisp/subr.el (oddp, evenp): ...to here. Make old names into aliases, documented as deprecated. Add type declarations. * lisp/obsolete/cl.el: Don't alias oddp and evenp. * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-oddp) (cl-lib-test-evenp): Move tests from here... * test/lisp/subr-tests.el (subr-test-oddp, subr-test-evenp): ...to here. * lisp/emacs-lisp/shortdoc.el (number): Add oddp and evenp. (map): Prefer oddp and evenp to cl-oddp and cl-evenp. * doc/lispref/numbers.texi (Predicates on Numbers): Document above new functions oddp and evenp. * doc/misc/cl.texi (Predicates on Numbers): Delete cl-oddp and cl-evenp. (Other Clauses): Prefer oddp to cl-oddp.
* | ; Suppress obsoletion warning in package-x tests.Basil L. Contovounesios2025-02-141-1/+2
| |
* | Document cl-n... set operations consistentlyBasil L. Contovounesios2025-02-141-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The docstrings of cl-nintersection and cl-nset-difference have been inconsistent with their manual entries since the beginning of emacs.git history (bug#76017). This patch settles on the weaker and thus backward-compatible requirement that only their first argument be safe to mutate. * lisp/emacs-lisp/bytecomp.el: Include only first argument in mutates-arguments property. * lisp/emacs-lisp/cl-seq.el (cl-nintersection, cl-nset-difference): Make docstring consistent with manual in that the second argument is not modified. * test/lisp/emacs-lisp/cl-seq-tests.el (cl-nintersection-test) (cl-nset-difference-test): Simplify. (cl-nset-difference): Pass fresh list as second argument, otherwise destructive modifications to it could go undetected.
* | Consolidate some cl-lib testsBasil L. Contovounesios2025-02-144-347/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For discussion, see bug#75633#16 and the following thread: https://lists.gnu.org/r/emacs-devel/2025-02/msg00053.html * test/lisp/emacs-lisp/cl-extra-tests.el (cl-lib-test-remprop) (cl-lib-test-coerce-to-vector, cl-parse-integer): Move here from cl-lib-tests.el. (cl-extra-test-remprop): Remove duplicate test, folding body... (cl-get): ...into this test. (cl-extra-test-concatenate): Remove duplicate test, folding body... (cl-concatenate): ...into this test. * test/lisp/emacs-lisp/cl-lib-tests.el: Update historic commentary. (cl-lib-test-remprop, cl-lib-test-coerce-to-vector) (cl-parse-integer): Move to cl-extra-tests.el. (cl-lib-test-remove-if-not, cl-lib-test-remove) (cl-lib-test-set-functions, cl-lib-test-string-position) (cl-lib-test-mismatch, cl-nset-difference): Move to cl-seq-tests.el. (cl-lib-test-gensym, cl-lib-keyword-names-versus-values) (cl-lib-empty-keyargs, mystruct, cl-lib-struct-accessors) (cl-lib-struct-constructors, cl-lib-arglist-performance, cl-the) (cl-flet-test, cl-lib-test-typep, cl-lib-symbol-macrolet) (cl-lib-symbol-macrolet-4+5, cl-lib-symbol-macrolet-2) (cl-lib-symbol-macrolet-hide, cl-lib-defstruct-record): Move to cl-macs-tests.el. (cl-lib-test-endp): Remove duplicate test, folding body into cl-seq-endp-test. (cl-lib-set-difference): Remove duplicate test, folding body into cl-set-difference-test. * test/lisp/emacs-lisp/cl-macs-tests.el: Do not require cl-macs and pcase. (mystruct, cl-lib-struct-accessors, cl-lib-struct-constructors) (cl-lib-arglist-performance, cl-lib-defstruct-record) (cl-lib-symbol-macrolet, cl-lib-symbol-macrolet-4+5) (cl-lib-symbol-macrolet-2, cl-lib-symbol-macrolet-hide, cl-flet-test) (cl-lib-keyword-names-versus-values, cl-lib-empty-keyargs) (cl-lib-test-gensym, cl-the, cl-lib-test-typep): Move here from cl-lib-tests.el. (cl-case-error, cl-case-warning): Fix indentation. * test/lisp/emacs-lisp/cl-seq-tests.el: Require cl-lib rather than cl-seq. (cl-seq-endp-test): Absorb body of cl-lib-test-endp. (cl-lib-test-remove, cl-lib-test-remove-if-not) (cl-lib-test-string-position, cl-lib-test-mismatch) (cl-lib-test-set-functions, cl-nset-difference): Move here from cl-lib-tests.el. (cl-set-difference-test): Absorb body of cl-lib-set-difference.
* | Fix uncaught cl-nreconc on constant listBasil L. Contovounesios2025-02-131-4/+4
| | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-isqrt): Expect most specific error type. (cl-extra-test-nreconc): Pass fresh list as first argument to cl-nreconc. The usual mutates-arguments warning was not emitted, possibly in relation to bug#74920 and cl-nreconc being proclaimed inline. (cl-extra-test-list-length): Simplify using nconc.
* | Fix cl-seq-tests.elBasil L. Contovounesios2025-02-131-497/+401
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | None of the tests using the macro cl-seq--with-side-effects were being evaluated (since bug#24264), and other tests were not robust against destructive operations or optimizations (since bug#24264 and bug#75633). For further discussion, see: https://lists.gnu.org/r/emacs-devel/2025-02/msg00053.html * test/lisp/emacs-lisp/cl-seq-tests.el: Fit first line within 80 columns. Remove empty Commentary section. (cl-union-test-00): Use bug#N reference in place of URL. (cl-seq-test-bug24264): Ditto. Use nconc in place of append. (cl-seq--test-list, cl-seq--test-list2, cl-seq--with-side-effects): Remove. (cl-seq-tests--relet*): New convenience macro replacing the need for cl-seq--with-side-effects. (cl-seq-fill-test, cl-seq-replace-test, cl-seq-delete-test): Use cl-seq-tests--relet* to actually evaluate tests. Avoid mutating quoted literals. (cl-seq-nsubstitute-test): Ditto. Actually call cl-nsubstitute, not cl-substitute. Avoid comparing mutated argument to itself; compare to its original copy instead. Avoid calling cl-position on list that is being mutated in :if predicate; use original copy instead. (cl-seq-remove-test, cl-remove-if-not-test, cl-delete-if-not-test) (cl-delete-duplicates-test, cl-seq-remove-duplicates-test) (cl-seq-substitute-test, cl-seq-substitute-if-test) (cl-seq-position-test, cl-count-if-test, cl-count-if-not-test) (cl-member-if-test, cl-member-if-not-test, cl-assoc-if-test) (cl-assoc-if-not-test, cl-rassoc-if-test, cl-subsetp-test): Simplify. (cl-remove-if-test, cl-seq-substitute-if-not-test, cl-find-if-test) (cl-find-if-not-test, cl-position-if-test, cl-member-test) (cl-assoc-test, cl-rassoc-test): Quote function symbols, not lambdas. (cl-delete-if-test): Use cl-seq-tests--relet*. Check result of cl-delete-if to avoid relying on its side effects, and to pacify byte-compiler warning. (cl-seq-mismatch-test): Avoid 'easy to misread' hidden argument. (cl-seq-search-test): Break long line. (cl-sort-test, cl-stable-sort-test, cl-merge-test): Avoid mutating quoted literals. (cl-intersection-test): Avoid comparing eql-ity of string literals. (cl-nintersection-test, cl-nset-difference-test) (cl-nset-exclusive-or-test): Avoid mutating quoted literals. Don't compare initial and final values of arguments, since they may have been mutated. (cl-set-difference-test, cl-set-exclusive-or-test): Use fresh arguments to check for absence of mutation.
* | Delete redundant lambdas around unary functionsStefan Kangas2025-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not just stylistic, but also slightly faster. These are all regular defuns, of course, as this won't work with macros and defsubsts. * lisp/calc/calc-nlfit.el (math-nlfit-fit-curve) (calc-fit-hubbert-linear-curve): * lisp/calendar/cal-tex.el (cal-tex-latexify-list): * lisp/calendar/todo-mode.el (todo-sort): * lisp/cedet/semantic/ctxt.el (semantic-ctxt-end-of-symbol-default) (semantic-ctxt-current-symbol-default): * lisp/cedet/semantic/symref.el (semantic-symref-result-get-files): * lisp/cedet/semantic/texi.el (semantic-texi-command-completion-list): * lisp/descr-text.el (describe-char): * lisp/emacs-lisp/eieio-datadebug.el (data-debug-add-specialized-thing): * lisp/emacs-lisp/rmc.el (read-multiple-choice--short-answers): * lisp/eshell/em-pred.el (eshell-modifier-alist): * lisp/gnus/gnus-cache.el (gnus-cache-articles-in-group): * lisp/gnus/gnus-dired.el (gnus-dired-attach): * lisp/help-mode.el (help-package-def): * lisp/ibuf-ext.el (ibuffer-mark-modified-buffers): * lisp/image/image-dired.el: * lisp/international/quail.el (quail-keyseq-translate) (quail-get-translations): * lisp/isearch.el (isearch-pre-command-hook) (search-within-boundaries): * lisp/mail/supercite.el (sc-ask): * lisp/mh-e/mh-e.el (mh-variant-set): * lisp/net/rcirc.el (rcirc-nick-channels, rcirc-channel-nicks): (rcirc-browse-url): * lisp/obsolete/thumbs.el (thumbs-cleanup-thumbsdir): * lisp/org/org-agenda.el (org-agenda-filter-completion-function): * lisp/org/org-table.el (org-table-eval-formula): * lisp/org/org.el (org-set-regexps-and-options): * lisp/org/ox.el (org-export--get-inbuffer-options): * lisp/ses.el (ses-range): * lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize): * lisp/textmodes/ispell.el (ispell-begin-tex-skip-regexp): * lisp/vc/vc-cvs.el (vc-cvs-stay-local-p): * lisp/window.el (window--state-get-1): * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-all-groups-work): Delete redundant lambdas around unary functions. (Bug#66816)
* | Use read-key in read-multiple-choice (bug#75886)Gerd Möllmann2025-02-041-2/+2
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/rmc.el (read-multiple-choice--short-answers): Use read-key instead of read-event because read-event doesn't use input-decode-map. * test/lisp/emacs-lisp/rmc-tests.el: Use read-key instead of read-event.
* | Rename a recently-added variable (bug#56197)Eli Zaretskii2025-02-011-1/+1
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraphs-as-doc-string): Renamed from 'lisp-fill-paragraph-as-displayed' and default value reversed. (lisp-fill-paragraph): Adjust to the change. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-fill-paragraph-as-displayed): Likewise.
* | Port dest-mountpoint test to suspicious bwrapPaul Eggert2025-01-311-0/+6
| | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el: (bytecomp-tests--dest-mountpoint): Skip test if bwrap prohibits even ‘true’, which it does on my Ubuntu 24.10 platform.
* | lisp: Introduce a `lisp-fill-paragraph-as-displayed' variable.Maxim Cournoyer2025-01-251-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with Emacs 28, filling strings now happens in a narrowed scope, and looses the leading indentation and can cause the string to extend past the fill-column value. Introduce `lisp-fill-paragraph-as-displayed' as a new variable allowing opting out of this new behavior in specific scenarios (such as when using the Scheme major mode, say). * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph-as-displayed): New variable. (lisp-fill-paragraph): Honor it, by avoiding the logic narrow to strings before applying fill-paragraph. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-fill-paragraph-respects-fill-column): Test it. (lisp-fill-paragraph-docstring-boundaries): New test, as a safeguard to avoid regressions. Fixes: bug#56197
* | ; Fix last change by using 'cl-oddp' and 'cl-evenp' (bug#75633).Eli Zaretskii2025-01-182-76/+76
| |
* | New unit-tests for cl-lib (bug#75633).Ahmed Khanzada2025-01-183-1/+996
| |
* | (cl-block, cl-return-from): Fix bug#75498Stefan Monnier2025-01-161-0/+9
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-block, cl-return-from): Change encoding so it obeys variable coping (i.e. lexical scoping when `lexical-binding` is non-nil). (cl--block-wrapper, cl--block-throw): Adjust accordingly. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--test-cl-block-lexbind-bug-75498): New test.
* | Update copyright year to 2025Paul Eggert2025-01-0176-76/+76
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | (cl-flet, cl-labels): Fix bug#74870Stefan Monnier2024-12-211-0/+10
| | | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-flet, cl-labels): Wrap function bodies in `cl-block`. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--test-flet-block): New test.
* | (cl-labels): Add support for (FUNC EXP) bindings (bug#59786)Stefan Monnier2024-11-121-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | Allow `cl-labels` to use the same (FUNC EXP) bindings as were already added to `cl-flet` in Emacs-25. The Info doc (mistakenly) already documented this new feature. * lisp/emacs-lisp/cl-macs.el (cl--self-tco-on-form): New function. (cl-labels): Use it to add support for (FUNC EXP) bindings. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): Add test for tail-recursive (FUNC EXP) bindings.
* | cond*: Add support for Pcase patternsStefan Monnier2024-10-251-0/+53
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/cond-star.el (cond*): Adjust docstring. (match*): Prefer `_VAR` syntax. (cond*-convert-condition): Add support for `pcase*`. * doc/lispref/control.texi (cond* Macro): Document `pcase*`. * test/lisp/emacs-lisp/cond-star-tests.el: New file.
* | ; Fix thinko in my last changeStefan Kangas2024-10-021-0/+3
| | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare): Fix thinko. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-defcustom-local): Update test.