Commit graph

8038 commits

Author SHA1 Message Date
Lars Ingebrigtsen
6def36f216 Use the new `permission-denied' error to catch multisession errors
* lisp/emacs-lisp/multisession.el (multisession--read-file-value):
Use the new `permission-denied' error to catch file errors on Windows.
2021-12-21 05:23:11 +01:00
Stefan Monnier
0c4fc7032a Fix bug#28557
* test/lisp/emacs-lisp/cconv-tests.el: Remove `:expected-result :failed`
from the bug#28557 tests.
(cconv-tests-cl-function-:documentation): Account for the presence of
the arglist (aka "usage") in the docstring.

* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric):
Handle non-constant `:documentation`.

* lisp/emacs-lisp/generator.el (iter-lambda):
* lisp/emacs-lisp/cconv.el (cconv--convert-funcbody):
Use `macroexp-parse-body`.
2021-12-20 22:00:57 -05:00
Mattias Engdegård
de797bb853 ; * lisp/emacs-lisp/cl-macs.el (cl--self-tco): fix bootstrapping 2021-12-20 17:29:51 +01:00
Mattias Engdegård
92ffe44834 Body of dynamic let-bindings is not in tail position
This fixes a known bug in `named-let`.

* lisp/emacs-lisp/cl-macs.el (cl--self-tco): Prevent TCO from inside
dynamic variable bindings.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): Add test.
2021-12-20 16:26:02 +01:00
Mattias Engdegård
8706f6fde1 Add macroexp--dynamic-variable-p
This predicate can be used for discriminating between lexically and
dynamically bound variables during macro-expansion (only).
It is restricted to internal use for the time being.

* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
Use macroexpand--all-toplevel.
* lisp/emacs-lisp/macroexp.el (macroexp-dynamic-variable-p): New.
(macroexp--expand-all): Maintain macroexp--dynvars.
(macroexpand-all): Rebind macroexp--dynvars.
(macroexpand--all-toplevel): New.
(internal-macroexpand-for-load): Use macroexpand--all-toplevel.
* src/eval.c (eval_sub): Transfer defvar declarations from
Vinternal_interpreter_environment into macroexp--dynvars during
lazy macro-expansion.
* src/lread.c (readevalloop): Rebind macroexp--dynvars around
read-and-evaluate operations.
(syms_of_lread): Define macroexp--dynvars.
* test/lisp/emacs-lisp/macroexp-resources/vk.el: New file.
* test/lisp/emacs-lisp/macroexp-tests.el (macroexp-tests--run-emacs)
(macroexp-tests--eval-in-subprocess)
(macroexp-tests--byte-compile-in-subprocess)
(macroexp--tests-dynamic-variable-p): Add tests.
2021-12-20 16:26:02 +01:00
Mattias Engdegård
3259f399d4 Treat base64 string encode/decode as pure functions
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Mark base64-decode-string, base64-encode-string and
base64url-encode-string as pure and side-effect-free.
2021-12-20 16:26:02 +01:00
Daniel Mendler
d9d38059d1 Add a new elp-restore-package command
* lisp/emacs-lisp/elp.el (elp-restore-package): New command
(bug#52457).
2021-12-19 14:22:27 +01:00
Lars Ingebrigtsen
25d8045608 Fix elp-*-list interactive specs
* lisp/emacs-lisp/elp.el (elp-reset-list):
(elp-restore-list): Fix the interactive specs (bug#52457).
2021-12-19 14:22:27 +01:00
Mattias Engdegård
941d15558f Remove incorrect byte-hunk-handler for eval
This optimisation is of very limited utility and miscompiles top-level
code having the form (eval 'CODE t) by replacing it with CODE which
will then, as things currently stand, be evaluated with dynamic binding.

* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-eval): Remove.
2021-12-18 20:09:48 +01:00
Michael Albinus
55f652c856 Make generation of JUnit test reports more robust.
* lisp/emacs-lisp/ert.el (ert-load-file-name): New defvar.
(ert-write-junit-test-report): Use it.  Make detection of selector
more robust.  Protect calls of `xml-escape-string' with 'noerror.

* test/infra/Makefile.in (subdir_template): Use "make -k ...".

* test/infra/gitlab-ci.yml (test-filenotify-gio):
Adapt make_params in order to get a JUnit test report.
(test-native-comp-speed0): Use "make -k ...".

* test/infra/test-jobs.yml: Regenerate.

* test/lisp/progmodes/perl-mode-tests.el (top):
Set `ert-load-file-name'.
2021-12-18 18:43:18 +01:00
Lars Ingebrigtsen
e5a74c20c3 Make multisession file reading more resilient on Windows
* lisp/emacs-lisp/multisession.el (multisession--read-file-value):
Rename and try harder on file errors on Windows.
2021-12-18 09:24:17 +01:00
Michael Albinus
041fff3d3d Handle missing JUnit test reports
* lisp/emacs-lisp/ert.el (ert-write-junit-test-report)
(ert-write-junit-test-summary-report): Handle missing JUnit test reports.
2021-12-17 20:02:21 +01:00
Stefan Monnier
cf33ece310 multisession.el: Avoid old specializer syntax
Avoid the use of the old (eql VAL) specializer, preferring the new
(eql EXP) form.

* lisp/emacs-lisp/multisession.el (multisession-backend-value)
multisession--backend-set-value, multisession--backend-values)
multisession--backend-delete, multisession-backend-value)
multisession--backend-set-value, multisession--backend-values)
multisession--backend-delete): Quote the symbol passed to `eql` specializer.
2021-12-17 11:39:04 -05:00
Eli Zaretskii
ccb6028364 Improve multisession test results on MS-Windows
* lisp/emacs-lisp/multisession.el
(multisession--backend-set-value): Force 'fsync'ing the temporary
file.
2021-12-17 14:41:16 +02:00
Lars Ingebrigtsen
78a86a4b32 Fix parallel build with multisession.el
* lisp/emacs-lisp/multisession.el: Don't require url -- this pulls
in gnus-util, which requires rmail, which depends on
rmail-loaddefs being generated, which our Makefiles doesn't guarantee.
2021-12-17 09:01:04 +01:00
Lars Ingebrigtsen
81b589518c Update files times in multisesssion properly
* lisp/emacs-lisp/multisession.el
(multisession--backend-set-value): Make cached/external files
times match up.
2021-12-16 08:05:37 +01:00
Lars Ingebrigtsen
ed77d1a8c0 Make the multisession files value read more resilient
* lisp/emacs-lisp/multisession.el
(multisession--update-file-value): Make more resilient towards errors.
2021-12-16 08:00:01 +01:00
Lars Ingebrigtsen
3fd9d48f9b Declare a couple more functions in multisession.el
* lisp/emacs-lisp/multisession.el: New file.
2021-12-16 07:22:00 +01:00
Lars Ingebrigtsen
bfc38ff058 Add support for multisession variables
* doc/lispref/elisp.texi (Top): Add to menu.
(Top):
* doc/lispref/variables.texi (Variables): Ditto.
(Multisession Variables): Document multisession variables.

* lisp/emacs-lisp/multisession.el: New file.
2021-12-16 07:20:04 +01:00
Michael Albinus
030a1a8bd5 Add errors in ert JUnit test reports
* lisp/emacs-lisp/ert.el (ert-write-junit-test-report)
(ert-write-junit-test-summary-report): Handle errors.
2021-12-15 18:54:31 +01:00
Stefan Monnier
0cc2c2dcdb eieio-compat.el: Move to lisp/obsolete
The file only contains obsolete definitions, so it really belongs in
`lisp/obsolete`.  Moving it there will also signal a warning for those
people who run old `.elc` files using EIEIO and generated with
Emacs<25 and who otherwise might not know about the obsolescence of
some of the functions they use.

* lisp/emacs-lisp/eieio-compat.el: Move to ...
* lisp/obsolete/eieio-compat.el: ... here.
2021-12-14 17:01:34 -05:00
Michael Albinus
b30b33ed9b ERT can generate JUnit test reports
* .gitignore: Add test/**/*.xml.

* admin/notes/emba: Mention JUnit test report.

* etc/NEWS: ERT can generate JUnit test reports.

* lisp/emacs-lisp/ert.el (xml-escape-string): Autoload.
(ert-write-junit-test-report)
(ert-write-junit-test-summary-report): New defuns.
(ert-run-tests-batch, ert-summarize-tests-batch-and-exit): Call them.

* test/Makefile.in (clean): Remove *.xml.

* test/README: Mention $EMACS_TEST_JUNIT_REPORT environment variable.

* test/infra/Makefile.in ($(FILE)): Generate header commentary.
(clean): Remove.

* test/infra/gitlab-ci.yml (variables): Set EMACS_TEST_JUNIT_REPORT.
(.job-template): Use it in script and after_script.
(.build-template, .gnustep-template, .filenotify-gio-template)
(.native-comp-template): Adapt rules.
(.test-template): Trigger JUnit test report.

* test/infra/test-jobs.yml: Regenerate.
2021-12-13 16:09:56 +01:00
Stefan Monnier
0c24ccc9d8 * lisp/emacs-lisp/generator.el (iter-yield): Simplify 2021-12-13 09:32:01 -05:00
Stefan Kangas
e29c904a0a ; * lisp/emacs-lisp/shortdoc.el (keymaps): Fix typo. 2021-12-12 09:04:47 +01:00
Mattias Engdegård
8716f21d94 Constant-propagate access to captured variables
* lisp/emacs-lisp/byte-opt.el (byte-optimize--substitutable-p):
Treat (internal-get-closed-var N) as constants for propagation
purposes, because that is effectively what such forms will be compiled
to.  This allows for the elimination of some lexical variables.

* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
2021-12-11 22:16:55 +01:00
Stefan Kangas
9ccd3d3231 Use defvar-keymap for package-menu-mode-map
* lisp/emacs-lisp/package.el (package-menu-mode-map): Use
defvar-keymap.
2021-12-10 15:33:54 +01:00
Stefan Kangas
ed03b2f301 Convert shortdoc-mode-map to defvar-keymap
* lisp/emacs-lisp/shortdoc.el (shortdoc-mode-map): Convert to
defvar-keymap.
2021-12-08 13:22:21 +01:00
Stefan Kangas
c94b81bfc1 Remove some unnecessary references to Emacs 22
* lisp/cedet/semantic/fw.el:
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer):
* lisp/emulation/viper-util.el (viper-frame-value):
* lisp/mail/rmail.el (rmail-delete-headers):
* lisp/mh-e/mh-e.el (mh-inc-spool-list): Remove some unnecessary
references to Emacs 22.
2021-12-07 14:44:34 +01:00
Stefan Kangas
e637afce45 Remove spurious space in byte-compiler warning
* lisp/emacs-lisp/bytecomp.el
(byte-compile-docstring-length-warn): Remove spurious space in
byte-compiler warning.
* test/lisp/emacs-lisp/bytecomp-tests.el
("warn-wide-docstring-defun.el"): Update test.
2021-12-06 22:19:58 +01:00
Paul Eggert
524c42fa0e Prefer nil to (current-time) when either will do
* lisp/emacs-lisp/timer.el (timer-event-handler, run-at-time):
* lisp/gnus/gnus-score.el (gnus-score-date):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-imap-handle-date):
* lisp/gnus/gnus-sum.el (gnus-user-date)
(gnus-summary-create-article):
* lisp/image-dired.el (image-dired-create-thumb-1):
* lisp/image/gravatar.el (gravatar-retrieve)
(gravatar--prune-cache):
* lisp/net/dbus.el (dbus-monitor-handler):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-times):
* lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-times):
* test/lisp/autorevert-tests.el (auto-revert--wait-for-revert)
(auto-revert-tests--write-file, auto-revert-test--wait-for):
* test/lisp/net/tramp-tests.el (tramp--test-print-duration):
Prefer nil to (current-time) when either will do, as this avoids
some consing.  Similarly, prefer omitting (current-time) arg
when this is equivalent.
2021-12-05 23:24:08 -08:00
Stefan Kangas
2a73a52c4a ; Small doc fix in recent eieio-opt.el change
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): Quote
functions to make links work in help-mode.
2021-12-06 03:20:15 +01:00
Stefan Monnier
9171061352 EIEIO: Remove redundant type info in help
`C-h o` returned redundant info when used on EIEIO classes, listing
the same thing both for the type name and for the constructor name.

* lisp/emacs-lisp/eieio.el (help-fns-describe-function-functions):
Remove special case for defclass constructors.
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): Declare it obsolete.
2021-12-05 21:07:58 -05:00
Lars Ingebrigtsen
2454f9876d Don't fill byte-compilation warnings in batch mode
* lisp/emacs-lisp/warnings.el (display-warning): Don't break up
byte-compilation into several lines when in batch mode, because
that makes it difficult for some tools to parse them (bug#52281).
2021-12-06 02:23:02 +01:00
Stefan Kangas
520a703fa7 Merge from origin/emacs-28
c086358574 Update to Org 9.5.1-15-gdb4805
fef3e60061 * lisp/emacs-lisp/edebug.el (edebug-eval-defun): Minor doc...
a1e30e4106 ; Fix most remaining AUTHORS warnings
f3e6a432c5 ; * doc/misc/efaq.texi (New in Emacs 28): Add more news.
00236cc802 Fix the enumeration values returned by 'try_scrolling'
2021-12-05 06:30:35 +01:00
Lars Ingebrigtsen
f14a4c377d Make package-dir-info more resilient
* lisp/emacs-lisp/package.el (package-dir-info): Check that the
file exists before using it (bug#41489).
2021-12-05 02:13:00 +01:00
Stefan Monnier
de727b5886 eieio-core.el: Allow assignment to cl-structs through slot-value
* lisp/emacs-lisp/eieio-core.el (eieio--validate-slot-value):
Obey the `:read-only` property of the slot.
(eieio-oset): Allow use on cl-structs as well.
(eieio-read-only): New error.

* test/lisp/emacs-lisp/eieio-tests/eieio-tests.el (eieio-test--struct):
Make the last field read-only.
(eieio-test-defstruct-slot-value): Test that cl-struct slots can be
assigned via `slot-value`.
2021-12-04 13:47:35 -05:00
Stefan Kangas
fef3e60061 * lisp/emacs-lisp/edebug.el (edebug-eval-defun): Minor doc fix. 2021-12-04 13:23:35 +01:00
Stefan Kangas
c082dbbc21 Remove some more items obsolete since Emacs 23
* lisp/emacs-lisp/shadow.el (find-emacs-lisp-shadows):
* lisp/net/newst-backend.el (newsticker-cache-filename)
(newsticker--cache-save-version1, newsticker--cache-update)
(newsticker--cache-read-version1):
* lisp/obsolete/vc-arch.el (vc-arch-command): Remove items
obsolete since Emacs 23.
2021-12-03 19:53:46 +01:00
Lars Ingebrigtsen
85e56d97b7 Clarify the run-at-time documentation about "integral multiple"
* lisp/emacs-lisp/timer.el (run-at-time):
* doc/lispref/os.texi (Timers): Explain what "integral multiple"
really means.
2021-12-03 17:22:59 +01:00
Stefan Kangas
20124d78e7 ; Minor cleanup in re-builder after my last commit
* lisp/emacs-lisp/re-builder.el (reb-lisp-mode, reb-cook-regexp):
Very minor cleanup (by popular demand).
2021-12-03 17:18:33 +01:00
Stefan Kangas
430622796b Don't support obsolete sregex syntax in re-builder
* lisp/emacs-lisp/re-builder.el (reb-lisp-mode)
(reb-lisp-syntax-p, reb-change-syntax, reb-cook-regexp): Remove final
remaining references to the long obsolete sregex syntax.
2021-12-03 16:42:24 +01:00
Stefan Monnier
e3a10c8cd9 * lisp/emacs-lisp/cl-macs.el (natnum): Fix typo 2021-12-03 09:07:37 -05:00
Stefan Monnier
5869bf55b2 * lisp/emacs-lisp/cl-macs.el (natnum): Define it as a type 2021-12-03 08:56:52 -05:00
Lars Ingebrigtsen
4c7faf3377 Fix previous macroexp--warn-wrap change
* lisp/emacs-lisp/macroexp.el (macroexp--warn-wrap): Don't call
byte-compile-warning-enabled-p with zero parameters.
2021-12-02 16:47:49 +01:00
Lars Ingebrigtsen
7ca865dc52 Add `cl-constantly' function
* lisp/emacs-lisp/cl-lib.el (cl-constantly): Add Common Lisp
function missing (bug#21584).
2021-12-02 10:19:10 +01:00
Stefan Monnier
c6dd8dd223 * lisp/emacs-lisp/macroexp.el: Improve last change
Don't burp when `byte-compile-warning-enabled-p` is not yet defined.
And use the call that we had already instead of adding a new one.

(macroexp--warn-wrap): Allow `category`
to be a list to pass to `byte-compile-warning-enabled-p`.
(macroexp-macroexpand): Simplify accordingly.
2021-12-01 22:51:55 -05:00
Andrea Corallo
fd86829e66 Make use of `comp-cstr-shallow-copy'
* lisp/emacs-lisp/comp.el (comp-mvar-propagate): Remove.
(comp-fwprop-call, comp-fwprop-insn): Use `comp-cstr-shallow-copy'.

* lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-cmp-range)
(comp-cstr-union-1-no-mem, comp-cstr-union-1)
(comp-cstr-intersection-no-mem, comp-cstr-intersection)
(comp-cstr-negation): Use `comp-cstr-shallow-copy'.
2021-12-01 22:21:04 +01:00
Andrea Corallo
f3284d5acd * Redefine `comp-cstr-shallow-copy'
* lisp/emacs-lisp/comp-cstr.el (comp-cstr): Don't synthesize copier
function.
(comp-cstr-shallow-copy): New function.
(comp-cstr-=): Use `copy-sequence'.
2021-12-01 22:21:04 +01:00
Andrea Corallo
c35c86a353 * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Decl struct predicates as pure 2021-12-01 22:21:04 +01:00
Stefan Monnier
02ebd790b7 * lisp/emacs-lisp/cconv.el (cconv--lifted-arg): Simplify 2021-12-01 14:05:23 -05:00