summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
...
* | ; Add 2024 to copyright yearsPo Lu2024-01-022-2/+2
| |
* | Merge from savannah/emacs-29Po Lu2024-01-0272-72/+72
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-0272-72/+72
| |
| * Fix rx wrong-code bug: ranges starting with ^Mattias Engdegård2023-07-301-5/+15
| | | | | | | | | | | | | | | | | | | | | | (rx (in (?^ . ?a))) was incorrectly translated to "[^-a]". Change it so that we get "[_-a^]" instead. * lisp/emacs-lisp/rx.el (rx--generate-alt): Split ranges starting with `^` occurring first in a non-negated character alternative. * test/lisp/emacs-lisp/rx-tests.el (rx-any): Add and adapt tests. (cherry picked from commit 5f5d668ac7917d61e9366fe0c3efd7b542671c3d)
* | checkdoc: Avoid false positive for keybinding in docstringStefan Kangas2023-12-241-0/+9
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): Avoid false positive when a variable contains a keybinding (for example, "C-g"). (Bug#68002) * test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-docstring-avoid-false-positive-ok): New test.
* | Introduce new function lm-package-requiresStefan Kangas2023-12-231-0/+20
| | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/package.el (package--prepare-dependencies): Move from here... * lisp/emacs-lisp/lisp-mnt.el (lm--prepare-package-dependencies): ...to here. (lm-package-requires): New function. (package-buffer-info): Use above new function. * test/lisp/emacs-lisp/lisp-mnt-tests.el (lm--tests-lm-package-requires): New test.
* | ; Fix typosStefan Kangas2023-12-101-4/+4
| |
* | Add ert-font-lockVladimir Kazanov2023-12-033-0/+470
| | | | | | | | | | | | | | | | | | Add ert-font-lock as well as unit tests and testing resources. * lisp/emacs-lisp/ert-font-lock.el: New library. * test/lisp/emacs-lisp/ert-font-lock-resources/broken.js: * test/lisp/emacs-lisp/ert-font-lock-resources/correct.js: * test/lisp/emacs-lisp/ert-font-lock-tests.el: Unit tests. (Bug#67460)
* | Make EIEIO ':accessor' behave like ':reader' when reading (bug#66938)Brandon2023-11-261-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Clones of instances of subclasses of 'eieio-instance-inheritor' didn't delegate to their ':parent-instance' field when reading object fields using ':accessor'. * lisp/emacs-lisp/eieio.el (defclass): Remove 'slot-boundp' check for :accessor's getter * test/lisp/emacs-lisp/eieio-tests/eieio-tests.el (eieio-test-use-accessor-function-with-cloned-object): New test. Copyright-paperwork-exempt: yes
* | Fix variable aliasing bytecode miscompilation (bug#67116)Mattias Engdegård2023-11-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler didn't cancel aliasing if the aliased variable was modified in a variable binding in the same `let` that created the alias. For example, (let ((x A)) (let ((y x) (z (setq x B))) y)) would incorrectly substitute y->x in the body form despite x being already modified at that point, which normally should have cancelled the aliasing. Bug reported by Alan Mackenzie. * lisp/emacs-lisp/byte-opt.el (byte-optimize--aliased-vars): Now an alist that also contains the aliases; update the doc string. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): * lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form): Detect aliasing early for `let`-bound variables as well. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test cases.
* | Fix bytecomp-tests--dest-mountpoint test failureMattias Engdegård2023-11-041-1/+2
| | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--dest-mountpoint): Add lexical cookie. Bug reported and fix suggested by Jens Schmidt (https://lists.gnu.org/archive/html/emacs-devel/2023-10/msg00719.html)
* | comp-cstr.el: The type hierarchy is a DAG, not a treeStefan Monnier2023-10-301-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjust the type operations to account for the fact that types can have several parents. * lisp/emacs-lisp/comp-cstr.el (comp--cl-class-hierarchy): Use `cl--class-allparents`. Add FIXME. (comp--direct-supertype): Declare obsolete. (comp--direct-supertypes): New function. (comp--normalize-typeset0): Rewrite to use `comp--direct-supertypes`; adjust to account for the DAG structure; use `cl-set-difference`. (comp--direct-subtypes): Rewrite. (comp--intersection): New function. (comp-supertypes): Rewrite and change return type. (comp-subtype-p): Simplify. (comp-union-typesets): Use `comp-supertypes` instead of iterating over `comp-cstr-ctxt-typeof-types`. * lisp/emacs-lisp/comp.el (comp--native-compile): Don't catch errors if we're debugging. * test/lisp/emacs-lisp/comp-cstr-tests.el: Adjust tests. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix mishap when we evaluate (cl-defstruct cl-structure-object ..) during the compilation of `cl-preloaded.el`. * lisp/emacs-lisp/cl-preloaded.el: Add corresponding assertion.
* | Move lexical-binding warning from checkdoc to byte-compilerMattias Engdegård2023-10-212-5/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This warning is much more appropriate for the compiler, since lexical binding affects what it can reason and warn about, than for checkdoc as the warning has no bearing to documentation at all. The move also improves the reach of the warning. * etc/NEWS: Update. * lisp/emacs-lisp/checkdoc.el (checkdoc-lexical-binding-flag) (checkdoc-file-comments-engine): Move warning from here.... * lisp/emacs-lisp/bytecomp.el (byte-compile-file): ...to here. * test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el: * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals) (bytecomp-tests-function-put, bytecomp-tests--not-writable-directory) (bytecomp-tests--target-file-no-directory): Update tests. (bytecomp-tests--log-from-compilation) (bytecomp-tests--lexical-binding-cookie): New test.
* | Add two missing 'number-or-marker' entries to the cl machinery (bug#66615)Andrea Corallo2023-10-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assuming 'number-or-marker' is a type (as present multiple times in cl--typeof-types) adding some missing entries for coherency. * lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add 'number-or-marker' as supertype of 'number' in the 'float' branch. * lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add 'number-or-marker'. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Update test. * test/src/comp-tests.el (comp-tests-type-spec-tests): Update two testes.
* | Improve cstr typeset normalizationAndrea Corallo2023-10-191-1/+10
| | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Add four tests. * lisp/emacs-lisp/comp-cstr.el (comp--sym-lessp) (comp--direct-supertype, comp--normalize-typeset0): New functions. (comp-normalize-typeset): Rework to make use of 'comp--normalize-typeset0'. (comp--direct-subtypes): New function.
* | Complete yesterday's commit for cl-print.elAlan Mackenzie2023-09-301-8/+10
| | | | | | | | | | | | | | | | | | I.e. commit the needed change to the test suite. * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-ellipsis-string): Bind cl-print-string-length. Only bind print-length and print-level where they are specifically needed.
* | Revert "Don't use ellipses while cl-printing strings."Alan Mackenzie2023-09-271-1/+16
| | | | | | | | This reverts commit 761f8901fffdb155cbcc7f3b5a2329161c2c1826.
* | package-tests.el: Add test Bug#65475Philip Kaludercic2023-09-211-0/+16
| | | | | | | | | | | | * test/lisp/emacs-lisp/package-tests.el (with-package-test): Bind package-selected-packages. (package-test-bug65475): Add test.
* | Warn about duplicated :tag strings in defcustom choicesMattias Engdegård2023-09-191-1/+4
| | | | | | | | | | | | | | | | It is bad user experience when two menu items have identical labels. * lisp/emacs-lisp/bytecomp.el (bytecomp--check-cus-type): Add check. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-defcustom-type): Add test case.
* | Don't use ellipses while cl-printing strings.Alan Mackenzie2023-09-191-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug#65680. The former use of print-length as a bound on the length of the printed string was erroneous, causing error messages preceding backtracees to get unnecessarily truncated to 50 characters. * lisp/emacs-lisp/cl-print.el (cl-print-object <string>): Remove the substitution of ellipses for long strings. * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-ellipsis-string): Remove this test.
* | Expanded defcustom type byte-compilation warnings (bug#65852)Mattias Engdegård2023-09-171-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Warn about more kinds of mistakes in :type arguments of `defcustom` and `define-widget`. These include: - misplaced keyword args, as in (const red :tag "A reddish hue") - missing subordinate types, as in (repeat :tag "List of names") or (choice list string) - duplicated values, as in (choice (const yes) (const yes)) - misplaced `other` member, as in (choice (const red) (other nil) (const blue)) - various type name mistakes, as in (vector bool functionp) * lisp/emacs-lisp/bytecomp.el (byte-compile--defcustom-type-quoted) (byte-compile-nogroup-warn): Remove. (byte-compile-normal-call): Remove call to the above. (bytecomp--cus-warn, bytecomp--check-cus-type) (bytecomp--custom-declare): New.
* | Shorten docstrings generated by cl-defstructDamien Cassou2023-09-131-0/+17
| | | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Split the first line of generated docstrings if either the struct name or a field name is very long. This reduces the likelihood of "docstring wider than 80 characters" errors. (Bug#65790)
* | Shorten docstrings generated by cl-defsubstDamien Cassou2023-09-131-0/+11
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-defsubst): Split the first line of the docstring into 2 lines if the function name is very long. Additionally, remove the word "inlining" in the generated docstring as it is not very useful and increases the likelihood of "docstring wider than 80 characters" errors. (Bug#65790)
* | bytecomp-tests.el: Add new helper functionDamien Cassou2023-09-131-2/+5
| | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--without-warning-test): Add helper function. (bytecomp-warn--ignore): Use the helper.
* | Add byte-compiler warning about useless trailing cond clausesMattias Engdegård2023-09-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Warn about clauses after the default clause, as in (cond ((= x 0) (say "none")) (t (say "some")) (say "goodbye")) because they are very much an indicator of a mistake (such as misplaced brackets), and since they are deleted by the optimiser, any other warnings there are lost and the user wouldn't know that something is wrong otherwise. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Add warning. * etc/NEWS: Announce. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Add test case.
* | Don't cache warnings between bytecode compilation testsMattias Engdegård2023-09-091-6/+11
| | | | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--with-fresh-warnings): New macro. (test-byte-comp-compile-and-load, bytecomp--with-warning-test): Use it.
* | Error when trying to make nil or t obsoleteStefan Kangas2023-09-081-0/+32
| | | | | | | | | | | | | | * lisp/emacs-lisp/byte-run.el (make-obsolete, make-obsolete-variable): Signal error if the symbol to make obsolete is nil or t. (Bug#62248) (byte-run--constant-obsolete-warning): New function. * test/lisp/emacs-lisp/byte-run-tests.el: New file.
* | ; Silence byte-compilerStefan Kangas2023-09-061-17/+19
| | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/cl-lib-tests.el (old-struct) (cl-lib-old-struct): * test/lisp/progmodes/eglot-tests.el (eglot-test-rust-analyzer-watches-files) (eglot-test-capabilities, eglot-test-path-to-uri-windows): Silence byte-compiler.
* | Use new ERT `skip-when` macro in testsStefan Kangas2023-09-042-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/autorevert-tests.el (auto-revert-test02-auto-revert-deleted-file): * test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--library-completion): * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline): * test/lisp/filenotify-tests.el (file-notify-test11-symlinks): * test/lisp/ibuffer-tests.el (ibuffer-0autoload): * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1): * test/lisp/net/network-stream-tests.el (echo-server-nowait) (connect-to-tls-ipv4-nowait, connect-to-tls-ipv6-nowait) (open-network-stream-tls-wait, open-network-stream-tls-nowait) (open-network-stream-tls, open-network-stream-tls-nocert) (open-gnutls-stream-new-api-nowait) (open-gnutls-stream-old-api-nowait): * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-10483) (cperl-test-hyperactive-electric-else): * test/lisp/progmodes/elisp-mode-tests.el (eval-last-sexp-print-format-sym-echo) (eval-last-sexp-print-format-small-int-echo) (eval-last-sexp-print-format-large-int-echo) (eval-defun-prints-edebug-when-instrumented): * test/lisp/progmodes/python-tests.el (python-ffap-module-path-1): * test/lisp/shadowfile-tests.el (shadow-test00-clusters) (shadow-test01-sites, shadow-test02-files) (shadow-test03-expand-cluster-in-file-name) (shadow-test04-contract-file-name, shadow-test05-file-match) (shadow-test06-literal-groups, shadow-test07-regexp-groups) (shadow-test08-shadow-todo, shadow-test09-shadow-copy-files): * test/lisp/simple-tests.el (eval-expression-print-format-sym-echo) (eval-expression-print-format-small-int-echo) (eval-expression-print-format-large-int-echo): * test/lisp/term-tests.el (term-simple-lines) (term-carriage-return, term-line-wrap, term-colors) (term-colors-bold-is-bright, term-cursor-movement) (term-scrolling-region, term-set-directory) (term-line-wrapping-then-motion, term-to-margin): * test/lisp/thread-tests.el (thread-tests-list-threads-error-when-not-configured): * test/lisp/vc/vc-tests.el (backend): * test/manual/scroll-tests.el (scroll-tests-scroll-margin-0) (scroll-tests-scroll-margin-negative) (scroll-tests-scroll-margin-max) (scroll-tests-scroll-margin-over-max) (scroll-tests-scroll-margin-whole-window): * test/misc/test-custom-libs.el (test-custom-libs): * test/src/emacs-module-tests.el (module/async-pipe): * test/src/fileio-tests.el (fileio-tests--odd-symlink-chars): * test/src/filelock-tests.el (filelock-tests-lock-spoiled) (filelock-tests-file-locked-p-spoiled) (filelock-tests-unlock-spoiled) (filelock-tests-kill-buffer-spoiled) (filelock-tests-detect-external-change): * test/src/image-tests.el (image-tests-image-size/error-on-nongraphical-display) (image-tests-image-mask-p/error-on-nongraphical-display) (image-tests-image-metadata/error-on-nongraphical-display): * test/src/process-tests.el (make-process/mix-stderr) (process-tests/fd-setsize-no-crash/make-network-process) (process-tests/fd-setsize-no-crash/make-serial-process): Use ERT `skip-when` macro in tests.
* | Add `skip-when` macro to `ert-deftest`Stefan Kangas2023-09-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can help avoid some awkward test skip conditions. For example, this triple negation: (skip-unless (not noninteractive)) Can be written as the simpler: (skip-when noninteractive) * lisp/emacs-lisp/ert.el (ert-deftest): Add new 'skip-when' macro. (ert--skip-when): New internal function. * doc/misc/ert.texi (Tests and Their Environment): Document above new macro. * test/lisp/emacs-lisp/ert-tests.el (ert-test-skip-when): New test.
* | Fix debug spec of cl-flet (bug#65344)Gerd Möllmann2023-08-211-0/+17
| | | | | | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl-flet): Fix debug spec. (cl-defun): Allow only symbols as function names in debug spec. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-flet/edebug): New test case.
* | rx: Better translation of char-matching patternsMattias Engdegård2023-08-121-33/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Translate or-patterns that (even partially) match single characters into character alternatives which are more efficient in matching, sometimes algorithmically so. Example: (or "%" (in "a-z") space) was previously translated to "%\\|[a-z]\\|[[:space:]]" but now becomes "[%a-z[:space:]]" Single-char patterns include `nonl` and `anychar`, which now can also be used in set operations (union, complement and intersection), and character classes. For example, `(or nonl "\n")` is now equivalent to `anychar`. * lisp/emacs-lisp/rx.el (rx--expand-def): Remove, split into... (rx--expand-def-form, rx--expand-def-symbol): ...these. (rx--translate-compat-symbol-entry) (rx--translate-compat-form-entry): New functions for handling the legacy extension mechanism. (rx--normalise-or-arg): Renamed to... (rx--normalise-char-pattern): ...this, and rewrite. (rx--all-string-or-args): Remove, split into... (rx--all-string-branches-p, rx--collect-or-strings): ...these. (rx--char-alt-union, rx--intersection-intervals) (rx--reduce-to-char-alt, rx--optimise-or-args) (rx--translate-char-alt, rx--human-readable): New. (rx--translate-or, rx--translate-not, rx--translate-intersection): Rewrite. (rx--charset-p, rx--intervals-to-alt, rx--charset-intervals) (rx--charset-union, rx--charset-intersection, rx--charset-all) (rx--translate-union): Remove. (rx--generate-alt): Decide whether to generate a negated character alternative. (rx--complement-intervals, rx--intersect-intervals) (rx--union-intervals): Rename to... (rx--interval-set-complement, rx--interval-set-intersection) (rx--interval-set-union): ...these. (rx--translate-symbol, rx--translate-form): Refactor extension processing. Handle synthetic `rx--char-alt` form. * test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-char-any-raw-byte) (rx-any, rx-charset-or): Adapt to changes and extend. * test/lisp/emacs-lisp/rx-tests.el (rx--complement-intervals) (rx--union-intervals, rx--intersect-intervals): Rename to... (rx--interval-set-complement, rx--interval-set-union) (rx--interval-set-intersection): ...these.
* | Check keyword args of make-processHelmut Eller2023-08-085-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The functions make-process and make-network-process have many keyword args and it's easy to misspell some of them. Use a compiler macro to warn about some possible mistakes. * lisp/emacs-lisp/bytecomp.el (bytecomp--check-keyword-args): New helper. (make-process, make-network-process): Define a compiler macro that performs some checks but doesn't anything else. * test/lisp/emacs-lisp/bytecomp-tests.el: Add some tests. * test/lisp/emacs-lisp/bytecomp-resources/: (warn-make-process-missing-keyword-arg.el, warn-make-process-missing-keyword-value.el, warn-make-process-repeated-keyword-arg.el, warn-make-process-unknown-keyword-arg.el): New test files
* | ; Fix bad bytecomp-tests casesMattias Engdegård2023-08-081-8/+10
| | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Repair broken test cases.
* | Teach byte-compiler about Aristotelian identityMattias Engdegård2023-08-081-0/+3
| | | | | | | | | | | | | | * lisp/emacs-lisp/byte-opt.el (byte-optimize-equal, byte-optimize-eq): Optimise (eq X X) -> t where X is a variable; idem for eql and equal. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case.
* | ; Pacify new nadvice-tests byte-compiler warnings.Basil L. Contovounesios2023-08-061-14/+20
| |
* | Don't allow the `eq` and `unbind` byte-ops to commute (bug#65017)Mattias Engdegård2023-08-041-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-opt.el (byte-after-unwind-ops): Cease sinking `eq` past `unwind`, because that optimised away the let-binding in (let ((symbols-with-pos-enabled nil)) (eq x y)) and `eq` is currently sensitive to `symbols-with-pos-enabled`. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--eq-symbols-with-pos-enabled): New test.
* | rx: better not-wordchar and (syntax word) translationMattias Engdegård2023-08-021-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/rx.el: Add tables of legacy syntax. (rx--translate-symbol): Translate the legacy construct `not-wordchar` as (not wordchar), which is more intuitively obvious. * lisp/emacs-lisp/rx.el (rx--translate-syntax): Generate the shorter \w and \W instead of \sw and \Sw. * test/lisp/emacs-lisp/rx-tests.el (rx-atoms, rx-syntax, rx-not): Adapt tests.
* | rx performance improvementsMattias Engdegård2023-08-021-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/rx.el (rx--generate-alt): Treat the intervals and classes lists separately without joining, to reduce allocation. Handle special cases first. (rx--union-intervals): Implement directly instead of using intersection and complement. * test/lisp/emacs-lisp/rx-tests.el (rx-any): Adapt test, as some character alternatives are now slightly different. (rx--complement-intervals, rx--union-intervals) (rx--intersect-intervals): New unit tests.
* | Fix rx wrong-code bug: ranges starting with ^Mattias Engdegård2023-07-301-5/+15
| | | | | | | | | | | | | | | | | | (rx (in (?^ . ?a))) was incorrectly translated to "[^-a]". Change it so that we get "[_-a^]" instead. * lisp/emacs-lisp/rx.el (rx--generate-alt): Split ranges starting with `^` occurring first in a non-negated character alternative. * test/lisp/emacs-lisp/rx-tests.el (rx-any): Add and adapt tests.
* | Allow default values in 'map-let' and the pcase 'map' formEarl Hyatt2023-07-301-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/map.el (map-let, map) (map--make-pcase-bindings): Add a third argument for specifying a default value, like in 'map-elt'. (Bug#49407) * lisp/emacs-lisp/map.el (map--make-pcase-bindings): Clarify that keys that aren't found aren't ignored, they actually get the value nil (unless the new default value is given). The overall pattern can still fail to match if the sub-pattern for the unfound key doesn't match nil. * test/lisp/emacs-lisp/map-tests.el (test-map-let-default) (test-map-plist-pcase-default, test-map-pcase-matches): Add tests, including for the above item.
* | Fix broken byte-compilation of unary comparisonsMattias Engdegård2023-07-261-0/+5
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-opt.el (byte-opt--nary-comparison): Fix a typo causing miscompilation of code such as (OP X), where OP is <, >, <=, >= or =. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case. Reported by Richard Copley.
* | Provide backtrace for byte-ops aref and asetMattias Engdegård2023-07-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Produce synthetic backtrace entries for `aref` and `aset` byte-ops when the index is non-fixnum, or is out of range for vector or record arguments (bug#64613). * src/bytecode.c (exec_byte_code): Detect type and range errors in-line for aref and aset. * src/data.c (syms_of_data): Declare symbols Qaref and Qaset. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--byte-op-error-cases): Add test cases.
* | ; bytecode backtrace test clean-upMattias Engdegård2023-07-261-11/+11
| |
* | Add 'define-error' to font lock keywords for emacs-lisp-modeNeal Sidhwaney2023-07-261-0/+23
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-fdefs): Add 'define-error'. (Bug#64824) * test/lisp/emacs-lisp/lisp-mode-tests.el (test-font-lock-keywords): New test. Copyright-paperwork-exempt: yes
* | macroexp.el: Fix missing warning for intermediate expansionsStefan Monnier2023-07-211-0/+16
| | | | | | | | | | | | | | | | | | | | | | When a macro expanded to a call to an obsolete macro, we failed to emit a warning for that use of the obsolete macro. * lisp/emacs-lisp/macroexp.el (macroexp-macroexpand): Use `macroexpand-1` to check obsolecence of intermediate expansions. * test/lisp/emacs-lisp/macroexp-tests.el (macroexp--test-obsolete-macro): New test.
* | Don't distort character ranges in rx translationMattias Engdegård2023-07-171-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Emacs regexp engine interprets character ranges from ASCII to raw bytes, such as [a-\xfe], as not including non-ASCII Unicode at all; ranges from non-ACII Unicode to raw bytes, such as [ü-\x91], are ignored entirely. To make rx produce a translation that works as intended, split ranges that that go from ordinary characters to raw bytes. Such ranges may appear from set manipulation and regexp optimisation. * lisp/emacs-lisp/rx.el (rx--generate-alt): Split intervals that straddle the char-raw boundary when rendering a string regexp from an interval set. * test/lisp/emacs-lisp/rx-tests.el (rx-char-any-raw-byte): Add test cases.
* | Provide backtrace for byte-ops car, cdr, setcar, setcdr, nth and eltMattias Engdegård2023-07-141-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Include calls to these primitives from byte-compiled code in backtraces. For nth and elt, not all errors are covered. (Bug#64613) * src/bytecode.c (exec_byte_code): Add error backtrace records for car, cdr, setcar, setcdr, nth and elt. * src/data.c (syms_of_data): Add missing defsyms for car, setcar, setcdr, nth and elt. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--error-frame, bytecomp-tests--byte-op-error-cases) (bytecomp--byte-op-error-backtrace): New test.
* | cl-print: Put buttons on ellipsesStefan Monnier2023-07-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, in *Backtrace* we have a nice behavior for cl-printed objects where they're truncated by default to a manageable size but we can click on the "..." to expand them when needed. The patch below moves that functionality to `cl-print.el` such that it can be enjoyed "everywhere" (bug#64536). It also has the benefit of simplifying the code since `backtrace.el` had to look for ellipses in order to add buttons to them, whereas now we can put the ellipses right when we write them. * lisp/emacs-lisp/cl-print.el (cl-print-object-contents): Improve docstring. (cl-print-expand-ellipsis-function): New var. (cl-print--default-expand-ellipsis): New function. (cl-print-expand-ellipsis): New command. (cl-print-insert-ellipsis): Allow nil instead of 0 to mean "this elides the whole object". (cl-print-ellipsis): Move button type from `backtrace.el`. (cl-print-propertize-ellipsis): Put a button. (cl-print--expand-ellipsis): Rename from `cl-print-expand-ellipsis`. (cl-print-to-string-with-limit): Allow new value t for `limit`. * lisp/emacs-lisp/backtrace.el (backtrace--font-lock-keywords): Simplify. (backtrace--match-ellipsis-in-string): Delete function. (backtrace--change-button-skip): Adjust to new button type name. (backtrace--expand-ellipsis): New function, extracted from `backtrace-expand-ellipsis`. (backtrace-expand-ellipsis): Delete function. (backtrace-ellipsis): Move button type to `cl-print.el`. (backtrace--print-to-string): Don't look for cl-print ellipses any more. (backtrace-mode): Use `backtrace--expand-ellipsis`. * lisp/ielm.el (ielm--expand-ellipsis): New function. (inferior-emacs-lisp-mode): Use it to fill the data when expanded. * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-check-ellipsis-expansion) (cl-print-tests-check-ellipsis-expansion-rx): Adjust to new internal function name.
* | cl-macs-tests.el (cl-&key-arguments): Fix regressionStefan Monnier2023-06-271-2/+4
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-form): Turn "cannot use lexical var" errors into warnings. Make the obey `with-suppressed-warnings`. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-&key-arguments): Suppress warnings.