summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* cl-defsubst: Use static scoping for argsStefan Monnier2023-06-231-1/+11
| | | | | | | | | | * lisp/emacs-lisp/cl-macs.el (cl--slet): New function, partly extracted from `cl--slet*`. (cl--slet*): Use it. (cl--defsubst-expand): Use it to fix bug#47552. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct-dynbound-label): New test.
* cl-defun/cl-struct: Use static scoping for function argsStefan Monnier2023-06-231-1/+9
| | | | | | | * lisp/emacs-lisp/cl-macs.el (cl--slet*): New function. (cl--transform-lambda): Use it to fix bug#47552. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-&key-arguments): Add test.
* Don't compile (+ X 0) as (* X 1)Mattias Engdegård2023-06-211-0/+4
| | | | | | | | | | Previously (+ X 0) was reduced to (+ X) which became (* X 1) in codegen, but this is wrong for X = -0.0 and also slightly slower. * lisp/emacs-lisp/byte-opt.el (byte-optimize-plus): Don't reduce an addition to (+ X) by eliminating zeros; retain one 0 argument. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case.
* Prefix syntax for ,@ in elisp-mode (bug#44418)Mattias Engdegård2023-06-211-0/+1
| | | | | | | | * lisp/progmodes/elisp-mode.el (elisp-mode-syntax-propertize): Use prefix syntax for ,@ to avoid the @ becoming part of a symbol that follows. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-with-normal-env): Propertise inserted Lisp code to keep the test working.
* pp-fill: Fix tests breakageStefan Monnier2023-06-172-3/+7
| | | | | | | | | | | | | * lisp/emacs-lisp/pp.el (pp-to-string, pp-buffer, pp): Preserve old behavior of (almost always) returning a trailing newline. * test/lisp/emacs-lisp/pp-tests.el (pp-print-quote): Adjust tests, now that `pp-to-string` always returns a trailing newline, rather than only most of the time. * test/lisp/emacs-lisp/backtrace-tests.el (backtrace-tests--single-and-multi-line): Make the test less sensitive to the choice of what is "pretty".
* Merge from origin/emacs-29Eli Zaretskii2023-06-101-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0d8b69e0ad3 Don't ding when completion succeeded f11e2d36999 ; * admin/git-bisect-start: Update failing commits 9855a3ea744 ; * src/xdisp.c (redisplay_tool_bar): Fix a typo in a com... f4ee696b887 Improve documentation of color-related functions 90eadc3e234 Revert "* package.el (package--get-activatable-pkg): Pref... 65f355ea0a3 ; Update my mail address a3a69ec2342 Fix connection-local user options handling (bug#63300) 240803cc3e1 Document 'startup-redirect-eln-cache' 026afb22984 ; * etc/PROBLEMS: Entry about crashes due to anti-virus (... bcc222251e1 Fix `emacs-lisp-native-compile-and-load' for C-h f (bug#5... 07c8211ca30 Add 'infer' as a keyword to typescript-ts-mode (bug#63880) dd2d8ff2f5c ; * etc/NEWS: Mention the issue with PGTK on WSL (bug#633... fa8135f8916 Revert changes to the order in which package descs are lo... 27fcfa2c0a7 ; * etc/NEWS: Improve instructions for grammar libraries. 2a84ab905c8 Handle point in last file-name component in minibuffer co... 05f25238b7b Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 4bc043ff45d Avoid asking redundant question in emacsbug.el 2eadf328d05 * test/infra/Dockerfile.emba (emacs-base): Don't install ... 583ba1db7ee typescript-ts-mode: Add a rule for function_signature # Conflicts: # etc/NEWS # lisp/minibuffer.el
| * ; Update my mail addressAndrea Corallo2023-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el: Update author mail. * lisp/emacs-lisp/comp.el: Likewise. * src/comp.c: Likewise. * test/lisp/emacs-lisp/comp-cstr-tests.el: Likewise. * test/src/comp-resources/comp-test-funcs-dyn.el: Likewise. * test/src/comp-resources/comp-test-funcs.el: Likewise. * test/src/comp-resources/comp-test-pure.el: Likewise. * test/src/comp-tests.el: Likewise.
* | Clean up defcustom type quote checkMattias Engdegård2023-05-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile--suspicious-defcustom-choice): Rename to... (byte-compile--defcustom-type-quoted): ...this and rewrite to make more sense. All callers updated. (byte-compile-nogroup-warn): Better warning message. * test/lisp/emacs-lisp/bytecomp-tests.el (test-bytecomp-defgroup-choice): This never failed because it wasn't actually a test. Turn it into... (bytecomp-test-defcustom-type-quoted): ...this, which is.
* | package-tests.el: Add test for last changeStefan Monnier2023-05-261-3/+8
| | | | | | | | | | * test/lisp/emacs-lisp/package-tests.el (package-test-desc-from-buffer): Make sure the absence of the terminating comment does not matter.
* | ; eieio-test-persist.el: namespace hygieneMattias Engdegård2023-05-251-3/+3
| | | | | | | | | | * test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el (hash-equal): Rename to `eieio-test--hash-equal`.
* | Don't mutate constants in testsMattias Engdegård2023-05-134-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-test--symbol-macrolet): * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-ellipsis-circular): * test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el (eieio-test-persist-interior-lists): * test/lisp/textmodes/reftex-tests.el (reftex-all-used-citation-keys): * test/src/xdisp-tests.el (xdisp-tests--minibuffer-resizing): * test/src/fns-tests.el (test-vector-delete): Mutate created objects, not constants. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-add-display-text-property): Mutate a created string, and compare using `equal-including-properties` without which the test was rather meaningless. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test16-directory-files): Don't mutate.
* | Use `mutate-constant` as warning identifierMattias Engdegård2023-05-131-5/+5
| | | | | | | | | | | | | | | | | | | | | | * etc/NEWS: * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings) (byte-compile-form): * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Use the new warning name `mutate-constant` instead of using the somewhat overloaded `suspicious`.
* | Byte-compiler warning about mutation of constant valuesMattias Engdegård2023-05-131-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we can easily detect mutation of constants (quoted lists, strings and vectors), warn. For example, (setcdr '(1 . 2) 3) (nreverse [1 2 3]) (put-text-property 0 3 'face 'highlight "moo") Such code can result in surprising behaviour and problems that are difficult to debug. * lisp/emacs-lisp/bytecomp.el (byte-compile-form, mutating-fns): Add the warning and a list of functions to warn about. * etc/NEWS: Announce. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Add test cases.
* | Make old-struct test more robustMattias Engdegård2023-05-051-2/+2
| | | | | | | | | | | | * test/lisp/emacs-lisp/cl-lib-tests.el (old-struct): Use the `vector` constructor instead of vector literals to avoid failing because of `type-of` constant-folding.
* | Don't rewrite (nconc X nil) -> X for any X (bug#63103)Mattias Engdegård2023-04-271-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the last cdr of a non-terminal argument to `nconc` is overwritten no matter its value: (nconc (cons 1 2) nil) => (1) a terminating nil arg cannot just be eliminated unconditionally. * lisp/emacs-lisp/byte-opt.el (byte-optimize-nconc): Only eliminate a terminal nil arg to `nconc` if preceded by a nonempty proper list. Right now we only bother to prove this for `(list ...)`, so that (nconc (list 1 2 3) nil) -> (list 1 2 3) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test cases.
* | Pacify byte-compiler warnings in nadvice-testsBasil L. Contovounesios2023-04-091-7/+9
| | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/nadvice-tests.el (advice-test-called-interactively-p) (advice-test-called-interactively-p-around) (advice-test-called-interactively-p-filter-args) (advice-test-call-interactively): Heed advertised-calling-convention of called-interactively-p to pacify byte-compiler warnings.
* | Consolidate existing warnings about unused return valuesMattias Engdegård2023-04-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the warning about unused return values from calls to side-effect-free functions from the source-level optimiser to the code generator, where it can be unified with the special-purpose warning about unused values from `mapcar`. This change also cures spurious duplicate warnings about the same code, makes the warnings amenable to suppression through `with-suppressed-warnings`, and now warns about some unused values that weren't caught before. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Move warning away from here. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings): Doc string updates. (byte-compile-form): Put the new warnings here. (byte-compile-normal-call): Move mapcar warning away from here. * lisp/emacs-lisp/bytecomp.el (byte-compile-ignore): Compile args to `ignore` for value to avoid unused-value warnings, and then discard the generated values immediately thereafter. Mostly this does not affect the generated code but in rare cases it might result in slightly worse code. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Adapt test.
* | Remove useless unwind-protect forms, or make them useful as intendedMattias Engdegård2023-04-071-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/imenu.el (imenu--generic-function): * lisp/mail/yenc.el (yenc-decode-region): * lisp/textmodes/table.el (table-recognize-region): * test/lisp/dired-tests.el (dired-test-directory-files): * test/lisp/hl-line-tests.el (hl-line-tests-sticky): Fix unwind-protect bracketing mistakes that caused the unwind code to be misplaced. * lisp/strokes.el (strokes-read-stroke): Fix a bracketing mistake that misplaced the unwind code, and another one that misplaced the else-clause of an `if` form. * test/lisp/gnus/mml-sec-tests.el (mml-secure-test-fixture): Fix a bracketing mistake that misplaced the unwind code, and remove superfluous condition-case. * lisp/mwheel.el (mouse-wheel-global-text-scale): * lisp/speedbar.el (speedbar-stealthy-updates) (speedbar-fetch-dynamic-etags): * lisp/emacs-lisp/edebug.el (edebug--recursive-edit): * lisp/emacs-lisp/package.el (package--read-pkg-desc): * lisp/cedet/semantic.el (semantic-refresh-tags-safe): * lisp/emulation/viper-cmd.el (viper-escape-to-state): * lisp/emulation/viper-cmd.el (viper-file-add-suffix): * lisp/gnus/mail-source.el (mail-source-movemail): * lisp/mail/feedmail.el (feedmail-send-it-immediately) (feedmail-deduce-address-list): * lisp/mail/mailclient.el (mailclient-send-it): * lisp/mail/smtpmail.el (smtpmail-deduce-address-list): * lisp/mh-e/mh-print.el (mh-ps-print-range): * lisp/textmodes/reftex-index.el (reftex-index-this-phrase): * test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch): (ert-test-run-tests-batch-expensive): Remove unwind-protect forms that are apparently useless, some since a prior edit that removed their purpose, some since their first appearance. * test/lisp/subr-tests.el (subr-test--frames-2): Insert dummy unwind form in backtrace test code.
* | Warn about unwind-protect without unwind formsMattias Engdegård2023-03-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `unwind-protect` without unwind forms is not just pointless but often indicates a mistake where the intended unwind part is misplaced, as in (unwind-protect (progn PROT-FORMS UNWIND-FORMS)) ; oops or (unwind-protect PROT-FORM) UNWIND-FORMS ; also oops or entirely forgotten for that matter. Warning about this makes sense, and the warning can always be silenced by removing the `unwind-protect` altogether if it shouldn't be there in the first place. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Implement warning. * etc/NEWS: Announce. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Add test case.