summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Merge from origin/emacs-29Stefan Monnier2023-03-271-0/+4
|\ | | | | | | | | | | | | | | | | | | 0337131bfa1 Update to Transient v0.3.7-218-g3dbb22a a8c23677d39 Update to Org 9.6.2 45b16bfb496 Skip failing tests on Cygwin with native compilation (bug... 8b4a494d8d4 Fix GNUSTEP tests on EMBA # Conflicts: # test/infra/gitlab-ci.yml
| * Skip failing tests on Cygwin with native compilation (bug#62450)Ken Brown2023-03-261-0/+4
| | | | | | | | | | | | | | | | | | * test/Makefile.in (TEST_NATIVE_COMP): New variable, used to determine whether to run tests tagged with :nativecomp. Set it to "no" on Cygwin and to $(HAVE_NATIVE_COMP) otherwise. * test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): Skip on Cygwin with native-compilation.
* | Fix shortdoc-tests when Unicode arrows can be displayedMattias Engdegård2023-03-251-6/+24
| | | | | | | | | | | | | | | | | | | | New shortdoc functions use Unicode arrows when possible, which caused some tests to fail if run under such circumstances. * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-tests--to-ascii): New function. (shortdoc-function-examples-test) (shortdoc-help-fns-examples-function-test): Call it.
* | Repair and speed up safe-copy-tree and make it internal (bug#61962)Mattias Engdegård2023-03-121-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no particular requirement for safe-copy-tree so let's make it internal for now. The new implementation is faster and more correct. * doc/lispref/lists.texi (Building Lists): * etc/NEWS: Remove doc and announcement. * lisp/subr.el (safe-copy-tree--seen, safe-copy-tree--1) (safe-copy-tree): Remove old version. * lisp/emacs-lisp/bytecomp.el (bytecomp--copy-tree-seen) (bytecomp--copy-tree-1, bytecomp--copy-tree): Add new version. (byte-compile-initial-macro-environment): Use it. * test/lisp/subr-tests.el (subr--safe-copy-tree): * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--copy-tree): Move and improve tests.
* | Fix pluralization in shortdoc-help-fns-examples-functionDaniel Martín2023-03-121-0/+15
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/shortdoc.el (shortdoc-help-fns-examples-function): Implement a better logic to pluralize "Example", by counting the number of arrow characters in the example string. (Bug#61877) * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-help-fns-examples-function-test): Add a test.
* | Add functions to query Emacs Lisp examples registered in shortdocDaniel Martín2023-03-121-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/shortdoc.el (shortdoc--display-function): Add a new shortdoc-example text property so that ELisp examples can be searched for later. (shortdoc--insert-group-in-buffer): New function extracted from the buffer insertion code in 'shortdoc-display-group'. (shortdoc-display-group): Implement in terms of 'shortdoc--insert-group-in-buffer'. (shortdoc-function-examples): New function that returns an alist of Emacs Lisp examples from shortdoc. (shortdoc-help-fns-examples-function): New function to insert Emacs Lisp function examples in *Help* buffers, if added to 'help-fns-describe-function-functions'. * test/lisp/emacs-lisp/shortdoc-tests.el (shortdoc-function-examples-test): Test it. * doc/emacs/help.texi (Name Help): Document in the user manual. * doc/lispref/help.texi (Documentation Groups): Document it. * etc/NEWS: Advertise it. (Bug#61877)
* | Don't modify interactive closures destructively (Bug#60974).Vibhav Pant2023-03-061-0/+12
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/cconv.el (cconv-convert): When form is an interactive lambda form, don't destructively modify it, as it might be a constant literal. Instead, create a new list with the relevant place(s) changed. * test/lisp/emacs-lisp/cconv-tests.el (cconv-tests-interactive-form-modify-bug60974): New test.
* | Fix `cond` miscompilation bugMattias Engdegård2023-03-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug that miscompiled (cond ... C S1...Sn) where S1...Sn are switch clauses (that can be compiled into a switch op) and C a non-switch clause, by tucking on an extra copy of C at the end. This was a serious wrong-code bug when the condition of C had side-effects; otherwise it was only a waste of time and space. * lisp/emacs-lisp/bytecomp.el (byte-compile-cond): Fix. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case.
* | Warn about `condition-case` without handlersMattias Engdegård2023-02-271-0/+6
| | | | | | | | | | | | | | | | | | | | Omitting handlers from a `condition-case` form makes it useless since no errors are caught. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): New warning. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Add test case. * etc/NEWS: Announce.
* | (bytecomp-warn--ignore): New testStefan Monnier2023-02-251-2/+10
| | | | | | | | | | | | | | Add tests for the interaction of `ignore` with warnings. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn--ignore): New test. (bytecomp--with-warning-test): Really make it a function.
* | bytecomp--with-warning-test: Make it a functionStefan Monnier2023-02-251-6/+7
| | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (bytecomp--with-warning-test): Make it a function.
* | ; * test/lisp/emacs-lisp/nadvice-tests.el: suppress some warningsMattias Engdegård2023-02-211-1/+7
| |
* | Don't rely on dynamic scoping to fix bug#59213Stefan Monnier2023-02-181-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than look up a dynamically scoped var to decide whether to trim closures, use an ad-hoc marker on those closures which should not be trimmed. * lisp/emacs-lisp/cconv.el (cconv-dont-trim-unused-variables): Delete var. (cconv-make-interpreted-closure): Use a `:closure-dont-trim-context` markers instead. * lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Use `:closure-dont-trim-context` rather than `cconv-dont-trim-unused-variables`. * lisp/emacs-lisp/testcover.el (testcover-analyze-coverage): Remove workaround for `cconv-dont-trim-unused-variables`. * test/lisp/emacs-lisp/cconv-tests.el (cconv-safe-for-space): New test.
* | Fix test errors when run with fancy charset (bug#61534)Mattias Engdegård2023-02-161-1/+3
| | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals, test-suppression): Bind `text-quoting-style` to `grave` around tests to force generation of ASCII quotes. * test/src/lread-tests.el (lread-tests--unescaped-char-literals): Subject the reference string to the same text styling as that under scrutiny.
* | nadvice: Fix bug#61179Stefan Monnier2023-02-041-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Advising interactive forms relies on the ability to distinguish interactive forms that do nothing else than return a function. So, be careful to preserve this info. Furthermore, interactive forms are expected to be evaluated in the lexical context captured by the closure to which they belong, so be careful to preserve that context when manipulating those forms. * lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyze-form) <lambda>: Preserve the info that an interactive form does nothing else than return a function. * lisp/emacs-lisp/nadvice.el (advice--interactive-form-1): New function. (advice--interactive-form): Use it. (advice--make-interactive-form): Refine to also accept function values quoted with `quote`. Remove obsolete TODO. * test/lisp/emacs-lisp/nadvice-tests.el: Don't disallow byte-compilation. (advice-test-bug61179): New test. * lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): Allow the `if` arg to be a form. * lisp/simple.el (oclosure-interactive-form): Adjust accordingly.
* | ; * cl-lib-tests.el: Suppress for the right function.Mattias Engdegård2023-01-031-1/+1
| |
* | Merge from origin/emacs-29Stefan Kangas2023-01-022-2/+5
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4520f09dd8b ; * admin/git-bisect-start: Update failing commits 2569ede9c49 Update to Org 9.6-81-g563a43 d9ed736f0a7 ruby-ts-mode: Remove some currently unused functions 45618447203 ruby-ts-mode: Highlight singleton method definitions and ... 0562006da3b Add ruby-ts-mode 84e7c2fbc85 Fix fontification of C++ reference return types (bug#60441) 1864b65af60 ; Minor fix for treesit--install-language-grammar-1 (bug#... 8994f87ad40 Adjust function-call fontification in csharp-ts-mode (bug... 411647a3f65 ; Fix NEWS. 7b0b17df67e Rewrite Antinews in ELisp manual for Emacs 29 f12f72b0e09 ; * lisp/simple.el (primitive-undo): Clarify error messag... 7fd822e7f52 Update Antinews in the user manual for Emacs 29 da77d70deeb ; * test/lisp/emacs-lisp/copyright-tests.el: Fix and futu... 2baf9e107c1 Fix shortdoc-tests failure with respect to regexp-opt-cha... 5aeb8de32ee ; Fix copyright years in 2 more files. # Conflicts: # etc/NEWS
| * ; * test/lisp/emacs-lisp/copyright-tests.el: Fix and future-safe.Mattias Engdegård2023-01-011-2/+4
| |
| * Fix shortdoc-tests failure with respect to regexp-opt-charsetMattias Engdegård2023-01-011-0/+1
| | | | | | | | | | | | * test/lisp/emacs-lisp/shortdoc-tests.el (regexp-opt): Require. `regexp-opt-charset` is not autoloaded, and whether `regexp-opt` is preloaded is configuration-dependent.
* | Merge from origin/emacs-29Eli Zaretskii2023-01-0172-72/+72
|\ \ | |/ | | | | | | | | | | | | | | | | | | cae528457c ; Add 2023 to copyright years. b394359261 Improve documentation of 'isearch-open-overlay-temporary' ab3210e709 Document 'use-package' in the 2 main manuals # Conflicts: # etc/refcards/ru-refcard.tex # lib/explicit_bzero.c # m4/explicit_bzero.m4
| * ; Add 2023 to copyright years.Eli Zaretskii2023-01-0172-72/+72
| |
* | Merge from origin/emacs-29Eli Zaretskii2023-01-011-0/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 72a81e2022 ; * lisp/treesit.el (treesit-simple-indent-presets): Fix t... ddfeee3e8a Build recipe interactively in treesit-install-language-gra... 6837469780 ; Add REVISION to treesit-language-source-alist 0dc788aa01 ; Remove GRAMMAR-DIR from treesit-language-source-alist f9aef67c36 Tweak csharp-mode font-lock-settings (bug#60376) 46362c0a3a ; * doc/lispref/tips.texi (Documentation Tips): Add indexing. 9a386b682e Revert a recent change which causes errors 9871ee8b14 ; More fixes for documentation of 'defalias' f309651b67 ; Fix handling of 'not' by 'buffer-match-p' 9292f595a7 ; Fix typos 43c7e05a2a Fix misspelled functions in shortdoc groups 01acecc79c Simplify introduction of use-package manual 2a7e072e53 ; Fix documentation of 'defalias' eee2aeca25 Fix python-shell-buffer-substring when retrieving a single... bfdad6c4e5 ; Fix recent treesit-related changes
| * Fix misspelled functions in shortdoc groupsStefan Kangas2022-12-311-0/+9
| | | | | | | | | | | | | | * lisp/emacs-lisp/shortdoc.el (file, list): Fix misspelled function names: 'file-writable-p' and 'seq-reduce'. * test/lisp/emacs-lisp/shortdoc-tests.el (subr-x): Require. (shortdoc-all-functions-fboundp): New test.
* | ; remove incorrect quoting of condition namesMattias Engdegård2022-12-301-1/+1
| |
* | Consistent empty-body warning messages for let and let*Mattias Engdegård2022-12-291-2/+2
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Make warning messages for let and let* consistent with other empty-body warnings.
* | Add empty-body warning for when, unless etcMattias Engdegård2022-12-291-1/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Warn about code like (when SOME-CONDITION) because these may indicate bugs. Warnings currently apply to `when`, `unless`, `ignore-error`, `with-suppressed-warnings` and (as before) `let` and `let*`. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Update doc string. * lisp/emacs-lisp/bytecomp.el: (byte-compile-warning-types) (byte-compile-warnings): Add empty-body. (byte-compile-initial-macro-environment): Add empty-body warning for with-suppressed-warnings. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Use the empty-body category for let and let*. * lisp/subr.el (when, unless, ignore-error): Add empty-body warning. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Add test cases.
* | Warn about `condition-case' with quoted condition namesMattias Engdegård2022-12-291-0/+5
| | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-condition-case): Add warning. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-quoted-condition): Add test case.
* | Warn about `ignore-error` with quoted condition argumentMattias Engdegård2022-12-291-0/+5
| | | | | | | | | | | | | | * lisp/subr.el (ignore-error): Clarify condition argument in doc string and add warning. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-quoted-condition): New test.
* | Merge from origin/emacs-29Stefan Kangas2022-12-251-0/+39
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c36fe3df17b Fix c-ts-mode imenu defun name (bug#60296) a24e350170e Fix treesit--children-covering-range-recurse (bug#60301) fbb4eb919b4 Support treesit-defun-name in tree-sitter major modes 6253184afc2 ; * lisp/treesit.el (treesit-defun-at-point): Guard again... f8e219ebfaa Add treesit-defun-name and friends 35c2ca2ca64 Make treesit-node-at/on guess language at point 7f7def2ae62 ; Add treesit-no-parser error b6a2e1ddf66 * nt/INSTALL.W64: update instructions for setting up W64 ... 265b91d891a Revert "; Bump minimum supported Windows version for MinG... 75155e45860 ; Bump minimum supported Windows version for MinGW64 to W... 677f6c79eb9 ; Update minimum requirements of MinGW-w64 7723af5e4aa ; * lisp/progmodes/c-ts-mode.el: quote literal string in ... 38866510c7c ; * src/xdisp.c (redisplay_internal): Reinstate the FRAME... a825aa0b135 Fix definition of CNS 11643-15 charset a42b20dd95e ; * lisp/progmodes/c-ts-mode.el: Add outline section head... e4e36345399 Improve c-ts-mode block comment indent (bug#60270) e30621caa2c ; Add treesit_recursion_limit 6a43af58802 Fix block comment indent and filling for c-ts-mode (bug#5... e492c21e810 Fix treesit_cursor_helper (bug#60267) 4437dbedf7b Fix restart-emacs alarms (Bug#60220) 121a9ff9f6f Fix alternate stack test in configure 84888080eea Add more functions to "string" shortdoc c90f97d4e5d Make the Contour terminal an alias of xterm-256color c3fac9465fa ; Fix punctuation in last change. 756bb422a49 Correct wrong info in (info)Go to node a8c3424d28b Fix typo in TUTORIAL.fr (bug#60261) 24cd2f0daf1 Add some diff-fixup-modifs tests d32091199ae Fix quoted argument in emacsclient-mail.desktop Exec key 286c48137f6 ert-x: Move window selection logic to its own macro 823c49cea85 ; ert-x: Simplify `ert-with-test-buffer-selected' 38c6abe4d0b ; ert-x: Add test for buffer read-only state 0e39ad6fa56 Fix crash after X error
| * ert-x: Move window selection logic to its own macroRichard Hansen2022-12-241-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/ert-x.el (ert-with-buffer-selected): New macro to temporarily display a buffer in a selected window and evaluate a body. (ert-with-test-buffer-selected): Use the new macro. * test/lisp/whitespace-tests.el (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): Add tests. (Bug#60189)
| * ; ert-x: Add test for buffer read-only stateRichard Hansen2022-12-241-0/+5
| | | | | | | | | | | | | | | | This test should have been included with commit 29b7d740006fe2190a729bd1c30ccab9356cee36. * test/lisp/emacs-lisp/ert-x-tests.el (ert-test-with-test-buffer-selected/read-only): New test. (Bug#60189)
* | Fix condition-case empty success handler misinterpretationMattias Engdegård2022-12-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | (condition-case X E (:success)) should return nil; the compiler behaves correctly in this case. * src/eval.c (internal_lisp_condition_case): Evaluate an empty :success handler as nil instead of pretending it isn't there. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case.
* | Fix condition-case body for-effect miscompilationMattias Engdegård2022-12-241-0/+48
| | | | | | | | | | | | | | | | | | | | | | (condition-case x A (:success B)) should not compile A for-effect even if the entire form is in for-effect context. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't optimise the condition-case body form for effect (potentially discarding its value) if there is a success handler and a variable. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test cases.
* | Use equal and member instead of eq and memqMattias Engdegård2022-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cedet/semantic/complete.el (semantic-displayer-show-request): * lisp/descr-text.el (describe-char-categories): * lisp/mh-e/mh-identity.el (mh-select-identity): * lisp/transient.el (transient--delay-post-command) (transient--post-command): * lisp/vc/vc-git.el (vc-git-create-tag): * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-nth-value-test-multiple-values): * lisp/emulation/viper-cmd.el (viper-preserve-cursor-color): Use `equal` instead of `eq` and `member` instead of `memq` where the comparison is with literals without guaranteed identity. In some cases this change corrects evident bugs, in others it is mostly cosmetic.
* | Merge from origin/emacs-29Stefan Kangas2022-12-191-1/+1
|\ \ | |/ | | | | | | | | de2239a584a Revert "alist-get testfn argument evaluation correction" 856d889f3a8 Revert "Elide broken but unnecessary `if` optimisations" 8e42e20ed7f Revert "Use equal and member instead of eq and memq"
| * Revert "Use equal and member instead of eq and memq"Eli Zaretskii2022-12-161-1/+1
| | | | | | | | | | | | | | This reverts commit f4b430140f0866f98bbf18b7094348dc64032813. Please don't install anything on the release branch that is not strictly necessary fro Emacs 29.
| * Use equal and member instead of eq and memqMattias Engdegård2022-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cedet/semantic/complete.el (semantic-displayer-show-request): * lisp/descr-text.el (describe-char-categories): * lisp/mh-e/mh-identity.el (mh-select-identity): * lisp/transient.el (transient--delay-post-command) (transient--post-command): * lisp/vc/vc-git.el (vc-git-create-tag): * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-nth-value-test-multiple-values): * lisp/emulation/viper-cmd.el (viper-preserve-cursor-color): Use `equal` instead of `eq` and `member` instead of `memq` where the comparison is with literals without guaranteed identity. In some cases this change corrects evident bugs, in others it is mostly cosmetic.
* | Suppress memql warning in testMattias Engdegård2022-12-181-1/+2
| | | | | | | | | | | | * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-adjoin-test): Suppress warning about `memql` argument inside expansion of `cl-adjoin`.
* | Warn about lambda expressions in comparisonsMattias Engdegård2022-12-181-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lambda expressions are not comparable; warn about calls such as (eq x (lambda ...)) etc. * lisp/emacs-lisp/bytecomp.el (bytecomp--dodgy-eq-arg): Rename to... (bytecomp--dodgy-eq-arg-p): ...this. Use pcase. Add lambda checks. (bytecomp--value-type-description, bytecomp--arg-type-description) (bytecomp--check-eq-args, bytecomp--check-memq-args): Add function checks. Update calls. Make compiler-macro arguments optional to avoid crashes in malformed code. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--with-warning-test): Simplify argument. Run each compilation with a fresh (empty) warning cache. Add ert-info for easier debugging. (bytecomp-warn-dodgy-args-eq, bytecomp-warn-dodgy-args-memq): Add lambda tests.
* | Use equal and member instead of eq and memqMattias Engdegård2022-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cedet/semantic/complete.el (semantic-displayer-show-request): * lisp/descr-text.el (describe-char-categories): * lisp/mh-e/mh-identity.el (mh-select-identity): * lisp/transient.el (transient--delay-post-command) (transient--post-command): * lisp/vc/vc-git.el (vc-git-create-tag): * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-nth-value-test-multiple-values): * lisp/emulation/viper-cmd.el (viper-preserve-cursor-color): Use `equal` instead of `eq` and `member` instead of `memq` where the comparison is with literals without guaranteed identity. In some cases this change corrects evident bugs, in others it is mostly cosmetic.
* | Merge from origin/emacs-29Stefan Kangas2022-12-163-9/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 033071692c7 ; Fix typos f4a513344d9 Add lambda_expression-rule to java-ts-mode (bug#60091) 546aed35434 eglot: Add support for new language server csharp-ls cb761eb7ac4 Use the new tree-sitter commands 037407ad95a Add "function" feature to python-ts-mode (bug#59977) fee2efe1b03 Add go-ts-mode and go-mod-ts-mode (Bug#60025) e8f7ab67ad1 Add basic support for hideshow in python-ts-mode (bug#60044) cac070b23e4 Add "this" keyword to java-ts-mode (bug#60086) c8d75046a2f When completing relative project file names, use relative... 3b618d0e3ed Avoid segfaults due to invalid selected-window's buffer # Conflicts: # lisp/progmodes/sh-script.el