* lisp/emacs-lisp/bytecomp.el
(byte-compile-docstring-length-warn): Warn about overly long
docstring in lambda. (Bug#44858)
(byte-compile--wide-docstring-p): Improve comment.
* test/lisp/emacs-lisp/bytecomp-tests.el
("warn-wide-docstring-defun.el"): Update to test for the above new
warning.
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
Ignore more function argument lists.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests-byte-compile--wide-docstring-p): New test.
This should really be taken care of by a syntax normalisation step in
the frontend, but there is no such step for non-lexbind code yet.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-letX): Tolerate bindingsa
without initialising expressions.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test cases.
Previously, variables bound outside `while` loops were not substituted
inside even in the absense of mutation. Add the necessary mutation
checking inside loops to allow propagation of values and aliased
variables.
* lisp/emacs-lisp/byte-opt.el
(byte-optimize--inhibit-outside-loop-constprop): New variable.
(byte-optimize-form-code-walker): First traverse each loop without
substitution to discover mutation, then without restrictions.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-loop): New.
(bytecomp-tests--test-cases): Add test cases.
* lisp/emacs-lisp/ert.el (ert-deftest):
Evaluate the body of `ert-deftest` with the `lexical-binding` value of
the source file (or more precisely the value in force when the
definition is evaluated), which is what everyone expected, instead of
always using dynamic binding which is what they got until now.
* test/lisp/emacs-lisp/ert-tests.el
(ert-test-deftest-lexical-binding-t): New test.
Allowing &rest without a variable name following turned out not to be
very useful, and it never worked properly. Disallow it.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list):
* src/eval.c (funcall_lambda):
Signal error for &rest without variable name.
* doc/lispref/functions.texi (Argument List): Adjust manual.
* etc/NEWS (file): Announce.
* test/src/eval-tests.el (eval-tests--bugs-24912-and-24913):
Extend test, also checking with and without lexical binding.
(eval-tests-accept-empty-optional-rest): Reduce to...
(eval-tests-accept-empty-optional): ...this, again checking
with and without lexical binding.
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-function): Check for
local defforms (`cl-flet' and `cl-labels').
(lisp--local-defform-body): New auxiliary function (bug#9622).
* test/lisp/net/tramp-tests.el (tramp-test44-asynchronous-requests):
Revert change to use seq-random-elt, as Tramp needs to be compatible
with Emacs 25, and the function was only added in 26.1.
* lisp/emacs-lisp/checkdoc.el (checkdoc-in-abbreviation-p): Use
'forward-ward' instead of 'forward-sexp' to avoid jumping too far in
some situations. (Bug#50731)
* test/lisp/emacs-lisp/checkdoc-tests.el
(checkdoc-tests--abbrev-test): New helper function.
(checkdoc-tests-in-abbrevation-p/basic-case): Rename from
'checkdoc-tests-in-abbrevation-p'.
(checkdoc-tests-in-abbrevation-p/with-parens)
(checkdoc-tests-in-abbrevation-p/with-escaped-parens): Use above new
helper function.
(checkdoc-tests-in-abbrevation-p/single-char)
(checkdoc-tests-in-abbrevation-p/with-em-dash)
(checkdoc-tests-in-abbrevation-p/incorrect-abbreviation): New tests.
* test/lisp/button-tests.el (button--help-echo-form):
* test/lisp/files-tests.el (files-tests-permanent-local-variables):
Remove assumption that `with-temp-buffer` creates a buffer
where `lexical-binding` is nil.
* test/lisp/mh-e/mh-limit-tests.el:
* test/lisp/mh-e/mh-utils-tests.el:
* test/lisp/mh-e/mh-xface-tests.el:
Import the functional tests from src/mh-unit.el.
mh-unit.el is from the old SourceForge mh-e repository, last changed
in 2017. To this are applied unmerged patches Mike Kupfer wrote in
2018 ("Refactor mh-unit into functional and release tests" and
"Fix the functional tests").
All tests have been converted to run under Emacs's ERT framework.
Some tests for mh-utils use MH programs to examine mail folders.
These tests require an MH variant to be installed on the system; for
these, added both a mock harness that pretends the needed files and MH
programs do exist, and a wrapper that creates the necessary mail files.
New function 'mh-test-utils-setup-with-variant' bears some resemblance
to 'mh-test-folders-set-up' from the original tests. New function
'mh-test-utils-setup-with-mocks' is new functionality for these tests.
* etc/NEWS: Announce new default behavior of map-elt and map-delete
on alists.
* lisp/emacs-lisp/map.el: Bump to version 3.2.
(map-elt): Test alist keys with equal by default. Betray a little
bit more information in the docstring on which functions are used
for which map types. (Bug#47368)
(map-put): Update docstring accordingly.
(map--plist-delete): Consistently test plist keys with eq.
(map-delete): Consistently test alist keys with equal.
* test/lisp/emacs-lisp/map-tests.el (test-map-elt-testfn): Update
for new map-elt behavior.
(test-map-put!-alist, test-map-delete-alist): New tests.
The api specifically requires a symbol here, so we can't just replace
nowait with nil.
* test/lisp/net/network-stream-tests.el
(open-gnutls-stream-old-api-wait): Add explicit value for nowait
to silence byte-compiler warning due to Bug#47080.
By putting delimiter syntax on the last character of Python
triple-quoted strings, this makes syntax-ppss be more accurate.
Previously:
emacs -Q something.py
type two single quotes
M-: (nth 3 (syntax-ppss))
notice how the return value says you're outside a string, correctly
type another quote
M-: (nth 3 (syntax-ppss))
notice how the return value says you're inside a string, correctly
backspace the quote just entered
M-: (nth 3 (syntax-ppss))
notice how the return value says you're inside a string, incorrectly
With this patch the last step is corrected. This helps things like
electric-pair-mode. Also, the test
python-syntax-after-python-backspace now passes, again.
* lisp/progmodes/python.el (python-syntax-stringify): Put
delimiter syntax in "inner" of the surrouding triple quotes.
* test/lisp/progmodes/python-tests.el
(python-syntax-after-python-backspace): Passes again.
In python-tests.el, the triple-quote pairing tests are passing
incorrectly, i.e. the auto-pairing functionality they purport to guard
isn't really working for users trying it interactively. Added a new
failing test, soon to be fixed.
In electric-tests.el, added tests for Python, too.
* test/lisp/electric-tests.el (define-electric-pair-test): Also run
main tests for python-mode. (pair-some-quotes-skip-others): Test
another slightly different pairing.
* test/lisp/progmodes/python-tests.el
(python-triple-double-quote-pairing): Rename from
python-triple-quote-pairing.
(python-triple-single-quote-pairing): New test.
'blink-paren-function' and its timers could sometimes interfere with
the tests and slow them down significantly.
* test/lisp/electric-tests.el (call-with-saved-electric-modes):
Bind blink-paren-function to nil.
* lisp/dired-aux.el (dired-compress-file-suffixes): Specify the
directory in the tar targets.
(dired-uncompress-file): New function (bug#47058). This asks what
directory to uncompress to.
(dired-compress-file): Use it.
* lisp/auth-source.el (auth-source-netrc-create)
(auth-source-secrets-create): Set :save-function only for non
empty passwords.
* lisp/net/tramp.el (tramp-read-passwd): Don't save empty passwords.
* test/lisp/auth-source-tests.el
(auth-source-test-secrets-create-secret): Adapt test.
(auth-source-test-netrc-create-secret): New test.
* src/keymap.c (syms_of_keymap)
<describe-bindings-check-shadowing-in-ranges>: New variable.
(describe_vector): Check shadowing of consecutive keys only if
'describe-bindings-check-shadowing-in-ranges' is non-nil. Remove
redundant second loop when VECTOR is a char-table. Improve
comments. Patch by Stefan Kangas <stefan@marxist.se>. (Bug#45379)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-one-shadowed-in-range): Adapt the
test case for the new variable.
* src/fileio.c (expand-file-name): Check for null bytes for both
NAME and DEFAULT-DIRECTORY arguments. Also check for null bytes
in buffer-local default-directory, assuming it is used.
* src/coding.c (encode_file_name): Use CHECK_STRING_NULL_BYTES.
* src/lisp.h (CHECK_STRING_NULL_BYTES): Add function for checking
for null bytes in Lisp strings.
* test/src/fileio-tests.el (fileio-test--expand-file-name-null-bytes):
Add test for new changes to expand-file-name.
* etc/NEWS: Announce changes.
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine):
Change 'y-or-n-p' check to accept prompt ending with both "? " or "?",
that is, it no longer needs the space. (Bug#50621)
(checkdoc--fix-y-or-n-p): New helper function.
* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests-fix-y-or-n-p)
(checkdoc-tests-fix-y-or-n-p/no-change)
(checkdoc-tests-fix-y-or-n-p/with-space): New tests.