Commit graph

7646 commits

Author SHA1 Message Date
Stefan Monnier
e775ef2f57 * lisp/emacs-lisp/benchmark.el (benchmark-elapse): Tweak 2021-06-11 14:06:29 -04:00
Mattias Engdegård
6b41d7da95 Constant-propagate (function SYMBOL)
* lisp/emacs-lisp/byte-opt.el (byte-optimize--substitutable-p):
Consider #'SYMBOL a constant for compile-time propagation purposes.
2021-06-03 21:28:10 +02:00
Mattias Engdegård
a517b77ffe Optimise (cons X nil) to (list X)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-cons): New function.
2021-06-03 21:28:10 +02:00
Basil L. Contovounesios
4784b6eb9a ; End recently added sentences with a period. 2021-06-01 20:21:51 +01:00
Andrea Corallo
a32e65b357 * Add `native-compile-target-directory' (bug#48743)
* lisp/emacs-lisp/comp.el (native-compile-target-directory): New
variable.
(comp-spill-lap-function): Make use of.
2021-06-01 18:12:20 +02:00
Andrea Corallo
c4b02dad9b Rename batch-byte-native-compile-for-bootstrap (bug#48743)
* lisp/Makefile.in : Rename `batch-byte-native-compile-for-bootstrap'
-> `batch-byte+native-compile.
* lisp/emacs-lisp/bytecomp.el (byte+native-compile)
(byte-compile-file): Rename
`batch-byte-native-compile-for-bootstrap' ->
`batch-byte+native-compile + `byte-native-for-bootstrap' ->
`byte+native-compile'.
* lisp/emacs-lisp/comp.el (comp-spill-lap-function, comp-final)
(batch-native-compile, batch-byte+native-compile): Likewise.
* lisp/emacs-lisp/bytecomp.el (byte+native-compile)
(byte-compile-file): Likewise.
* test/src/comp-tests.el (comp-tests-bootstrap): Rename
`byte-native-for-bootstrap' -> `byte+native-compile'.
2021-06-01 18:11:37 +02:00
Andrea Corallo
8992a45202 * Make *Async-native-compile-log* buffer read-only (bug#48763)
* lisp/emacs-lisp/comp.el (comp-run-async-workers): Make
"*Async-native-compile-log*" read-only.
2021-05-31 20:52:45 +02:00
Lars Ingebrigtsen
d51e6af9a7 Put ELP results in a special-mode buffer
* lisp/emacs-lisp/elp.el (elp-results): Make `q' work in ELP
results buffer (bug#14104).
(elp-results-mode): Define as an empty special mode derivation.
2021-05-31 08:17:00 +02:00
Philipp Stephani
3988411f6c Give 'syntax-propertize-wholelines' a docstring.
This function is generally useful.

* lisp/emacs-lisp/syntax.el (syntax-propertize-wholelines): Add
docstring.
2021-05-30 22:38:48 +02:00
Daniel Martín
e247b4b691 Add a new documentation group for overlays
* lisp/emacs-lisp/shortdoc.el (overlay): Add documentation group for
buffer overlays(bug#48730).
2021-05-30 06:41:52 +02:00
Daniel Martín
1230651ffd Improve the documentation of documentation groups
* doc/lispref/help.texi (Documentation Groups): Fix typos and add an
example.
* lisp/emacs-lisp/shortdoc.el (define-short-documentation-group): Add
:no-eval* and :result-string keywords to the docstring.  (Bug#48730)
2021-05-30 06:41:24 +02:00
Mattias Engdegård
0cbfb7e795 ; * lisp/emacs-lisp/rx.el (rx--pcase-macroexpander): slight rephrase 2021-05-29 09:18:01 +02:00
Mattias Engdegård
93162efd79 Fix shortdoc examples
Make sure that each example in shortdoc actually contains the function
it illustrates, and add a test for it.

* lisp/emacs-lisp/shortdoc.el (string, list, buffer, number):
Use the right functions in examples for string-version-lessp,
lax-plist-put, point-min and ffloor.
* test/lisp/emacs-lisp/shortdoc-tests.el: New test file.
2021-05-29 09:18:00 +02:00
Daniel Martín
651394d845 Fix looking-at-p example in shortdoc.el
* lisp/emacs-lisp/shortdoc.el (regexp): Use `looking-at-p' instead of
`looking-at' (bug#48709).
2021-05-28 01:45:28 +02:00
Stefan Monnier
24c9657746 * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Silence warnings
(byte-optimize--lexvars): Move before first use instead of using `dlet`
on that first use.
2021-05-27 17:31:57 -04:00
Mattias Engdegård
40d2970f43 Don't propagate lexical variables into inlined functions
Functions compiled when inlined (thus from inside the optimiser)
mustn't retain the lexical environment of the caller or there will be
tears.  See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2021-05/msg01227.html .

Bug found by Stefan Monnier.

* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand):
Bind byte-optimize--lexvars to nil when re-entering the compiler
recursively.
* test/lisp/emacs-lisp/bytecomp-resources/bc-test-alpha.el:
* test/lisp/emacs-lisp/bytecomp-resources/bc-test-beta.el: New files.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-defsubst): New test.
2021-05-27 14:16:17 +02:00
Stefan Monnier
354ecaf12b * lisp/emacs-lisp/byte-opt.el: Make the build more reproducible
(byte-compile-inline-expand): When inlining code from another file,
always inline the byte-code version of the function.
(byte-optimize--pcase): Simplify edebug spec.
2021-05-25 13:38:05 -04:00
Philipp Stephani
7a46fa9c75 Allow years in a copyright range to be separated by en dashes.
* lisp/emacs-lisp/copyright.el (copyright-regexp)
(copyright-years-regexp, copyright-update-year)
(copyright-fix-years): Also include en dash.

* test/lisp/emacs-lisp/copyright-tests.el (copyright-tests--data): New
test cases.
2021-05-25 14:04:06 +02:00
Stefan Monnier
84e207c811 * lisp/emacs-lisp/subr-x.el (if-let*, if-let): Use looser Edebug spec
This makes the same spec work both for `if-let` and `when-let`.

(when-let*, and-let*, when-let): Simplify accordingly.
2021-05-22 10:21:59 -04:00
Basil L. Contovounesios
43fd13770a Fix native-comp-async-report-warnings-errors :type
* doc/lispref/compile.texi (Native-Compilation Variables): Document
'silent' alternative of native-comp-async-report-warnings-errors.
* lisp/emacs-lisp/comp.el
(native-comp-async-report-warnings-errors): Fix quoting in
:type expression (bug#48586).
2021-05-22 13:22:29 +01:00
Philipp Stephani
33a52cb458 Give 'when-let' and 'when-let*' their own Edebug specification.
The Edebug specification of 'if-let' and 'if-let*' doesn't work if the
body is empty.  While that's a pathological case, it's not wrong per
se, and could arguably happen due to macro expansion.

* lisp/emacs-lisp/subr-x.el (when-let*, when-let): Don't reuse Edebug
specification from 'if-let*' and 'if-let'.
2021-05-22 13:29:50 +02:00
Philipp Stephani
91fa95bde0 * lisp/emacs-lisp/cl-macs.el (cl-loop): Add missing 'when' to spec 2021-05-22 13:17:00 +02:00
Stefan Monnier
2c47eaa18a * lisp/emacs-lisp/eieio-core.el (eieio-defclass-internal): Use a closure 2021-05-18 17:13:52 -04:00
Juri Linkov
502e3ce614 * lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix imprecise numbers.
(lisp-outline-level): Return right levels starting from 1 instead of 5.
Suggested by Howard Melman <hmelman@gmail.com> in bug#46878.
2021-05-18 23:35:57 +03:00
Basil L. Contovounesios
33c0994c7c Look for ElDoc buffer in all visible frames
* lisp/emacs-lisp/eldoc.el (eldoc--echo-area-prefer-doc-buffer-p):
Look for a window displaying the ElDoc documentation buffer in all
visible frames, as promised by the user option
eldoc-echo-area-prefer-doc-buffer (bug#48278).
2021-05-18 16:31:19 +01:00
Alexandr Vityazev
2c90aa93a9 Fix the length= shortdoc example
* lisp/emacs-lisp/shortdoc.el (list): Fix the length= example
(bug#48495).

Copyright-paperwork-exempt: yes
2021-05-18 15:36:25 +02:00
Mattias Engdegård
be9db2b94d Fix pcase 'rx' patterns with a single named submatch (bug#48477)
pcase 'rx' patterns with a single named submatch, like

  (rx (let x "a"))

would always succeed because of an over-optimistic transformation.
Patterns with 0 or more than 1 named submatches were not affected.

Reported by Philipp Stephani.

* lisp/emacs-lisp/rx.el (rx--pcase-macroexpander):
Special case for a single named submatch.
* test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add tests.
2021-05-18 12:34:30 +02:00
Philipp Stephani
9676d41b83 * lisp/emacs-lisp/subr-x.el (if-let): Swap &or branches (Bug#48489) 2021-05-18 09:26:49 +02:00
Philipp Stephani
42950e9e46 Fix a few Edebug specifications where code is wrapped in lambdas.
As the Info node `(elisp) Specification List' explains, it is not
correct to use `body' or t for a piece of code that the macro wraps in
a `lambda' form.  These should use `def-body' instead.

* lisp/info-xref.el (info-xref-with-file):
* lisp/subr.el (subr--with-wrapper-hook-no-warnings, track-mouse)
(combine-change-calls, with-eval-after-load):
* lisp/emacs-lisp/bytecomp.el (displaying-byte-compile-warnings):
* lisp/emacs-lisp/cl-macs.el (cl-do-symbols, cl-progv):
* lisp/emacs-lisp/ert-x.el (ert-with-test-buffer):
* lisp/emacs-lisp/gv.el (gv-letplace):
* lisp/emacs-lisp/nadvice.el (define-advice):
* lisp/emacs-lisp/thunk.el (thunk-delay):
* lisp/vc/vc-dispatcher.el (vc-run-delayed): Use 'def-body' instead of
t or 'body' where applicable.

* lisp/emacs-lisp/package.el (package--with-response-buffer): Remove
evaluation of the body altogether.  I have no idea how to write it
correctly in this case.
2021-05-17 10:09:43 +02:00
Eric Abrahamsen
e761e12498 Add a 'silent option for native-comp-async-report-warnings-errors
* lisp/emacs-lisp/comp.el (native-comp-async-report-warnings-errors):
Set to 'silent to log warnings, but not pop up the *Warnings* buffer.
* lisp/emacs-lisp/comp.el (comp-accept-and-process-async-output):
Check value.
2021-05-16 14:27:53 -07:00
Philipp Stephani
01bd4d1a82 Optimize calls to 'eql', 'memql' and similar for fixnums.
It's good practice to compare integers using 'eql' because two bignum
objects representing the same integer might not be 'eq'.  However,
'eql' is slower and doesn't have its own byte code.  Therefore,
replace it with 'eq' if one argument is guaranteed to be a fixnum on
all platforms.

* lisp/emacs-lisp/byte-opt.el (byte-optimize--fixnump): New helper
function.
(byte-optimize-equal, byte-optimize-member, byte-optimize-assoc): Use
it to optimize 'eql' etc. to 'eq' if it will always compare fixnums.
2021-05-16 14:45:18 +02:00
Lars Ingebrigtsen
43da7f838f Even further `text-property-search-forward' clarifications
* lisp/emacs-lisp/text-property-search.el
(text-property-search-forward): Further doc string clarifications.
2021-05-12 19:01:53 +02:00
Lars Ingebrigtsen
bc1a01172e Further corrections for the text-property-search doc strings
* lisp/emacs-lisp/text-property-search.el
(text-property-search-forward): Correct doc string.
(text-property-search-backward): Ditto.
2021-05-12 16:17:55 +02:00
Eli Zaretskii
98e5639c3c Fix the tests for 'string-limit'
* test/lisp/emacs-lisp/subr-x-tests.el (subr-string-limit-coding):
Fix the expected results of string-limit when encoding with
UTF-16.  Add tests for UTF-8 with BOM.  (Bug#48324)

* lisp/emacs-lisp/subr-x.el (string-limit): Add FIXME comment
about the current implementation, which is faulty by design.
2021-05-12 16:41:03 +03:00
Andrea Corallo
8bc91a6a3f * Rename comp-deferred-compilation-deny-list
* lisp/emacs-lisp/comp.el (native-comp-deferred-compilation-deny-list)
(native-compile-async-skip-p): Rename
comp-deferred-compilation-deny-list ->
native-comp-deferred-compilation-deny-list.
2021-05-11 18:31:45 +02:00
Lars Ingebrigtsen
6d225d82c8 `text-property-search-forward' doc string improvement
* lisp/emacs-lisp/text-property-search.el
(text-property-search-forward): Correct and clarify the doc string
(bug#48317).
2021-05-11 14:30:00 +02:00
Lars Ingebrigtsen
af529f777c Reintroduce autoloads for edebug-all-defs/edebug-all-forms
* lisp/emacs-lisp/edebug.el (edebug-all-defs, edebug-all-forms):
Reintroduce ;;;###autoload of these user options that were removed
in bae2cfe63c, because this leads to errors in a common (and
recommended) use case (bug#47516).
2021-05-09 11:47:01 +02:00
Basil L. Contovounesios
d3344e0a7f ; Fix recent re-builder doc changes. 2021-05-08 15:07:38 +01:00
dalanicolai
fdeb1a3dc7 Mention that Emacs is usually case-insensitive in a couple of places
* doc/lispref/searching.texi (Regular Expressions): Mention
`case-fold-search'.

* lisp/emacs-lisp/re-builder.el (re-builder): Mention case
sensitivity toggles (bug#47534).

Copyright-paperwork-exempt: yes
2021-05-08 13:59:03 +02:00
Eli Zaretskii
615cf550f2 Fix a recent change in rmc.el
* lisp/emacs-lisp/rmc.el (read-multiple-choice): Doc fix.  Improve
the message when entering recursive-edit.
2021-05-07 17:09:44 +03:00
Andrea Corallo
fbbcbed10e Rename comp-eln-load-path → native-comp-eln-load-path
* src/comp.c (Fcomp_el_to_eln_filename): Rename comp-eln-load-path →
native-comp-eln-load-path.
* src/lread.c (maybe_swap_for_eln): Likewise.
* lisp/startup.el (native-comp-eln-load-path)
(normal-top-level): Likewise.
* lisp/emacs-lisp/comp.el (comp-spill-lap-function, comp-final)
(comp-eln-load-path-eff, comp-trampoline-compile)
(comp-clean-up-stale-eln, comp-run-async-workers)
(comp-lookup-eln, batch-byte-native-compile-for-bootstrap): Likewise.
2021-05-06 17:16:09 +02:00
Andrea Corallo
901ce56603 Rename comp-warning-on-missing-source
* src/lread.c (maybe_swap_for_eln): Rename
comp-warning-on-missing-source →
native-comp-warning-on-missing-source.
* src/comp.c (syms_of_comp): Likewise.
* lisp/emacs-lisp/comp.el (native-comp-warning-on-missing-source):
Likewise.
2021-05-06 17:16:09 +02:00
Andrea Corallo
8c429a42c4 Rename comp-native-driver-options → native-comp-driver-options
* src/comp.c (add_driver_options, syms_of_comp): Rename
comp-native-driver-options → native-comp-driver-options.
* lisp/emacs-lisp/comp.el (native-comp-driver-options)
(comp-ctxt, comp-spill-lap-function, comp-final)
(comp-run-async-workers): Likewise.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Likewise.
2021-05-06 17:16:08 +02:00
Andrea Corallo
419852a599 * Rename comp-async-query-on-exit → native-comp-async-query-on-exit
* lisp/emacs-lisp/comp.el (native-comp-async-query-on-exit)
(comp-run-async-workers): Rename comp-async-query-on-exit →
native-comp-async-query-on-exit.
2021-05-06 17:16:08 +02:00
Andrea Corallo
c90129c5e5 * Rename comp-async-report-warnings-errors
* lisp/emacs-lisp/comp.el (native-comp-async-report-warnings-errors)
(comp-accept-and-process-async-output): Rename
comp-async-report-warnings-errors →
native-comp-async-report-warnings-errors.
2021-05-06 17:16:08 +02:00
Andrea Corallo
4e01605efa * Rename comp-async-env-modifier-form → native-comp-async-env-modifier-form
* lisp/emacs-lisp/comp.el (native-comp-async-env-modifier-form)
(comp-final, comp-run-async-workers): Rename
comp-async-env-modifier-form → native-comp-async-env-modifier-form.
2021-05-06 17:16:08 +02:00
Andrea Corallo
4e063bf8eb * Rename comp-async-all-done-hook → native-comp-async-all-done-hook
* lisp/emacs-lisp/comp.el (native-comp-async-all-done-hook)
(comp-run-async-workers): Rename comp-async-all-done-hook →
native-comp-async-all-done-hook.
2021-05-06 17:16:08 +02:00
Andrea Corallo
e73186a446 * Rename comp-async-cu-done-functions → native-comp-async-cu-done-functions
* lisp/emacs-lisp/comp.el (native-comp-async-cu-done-functions)
(comp-run-async-workers): Rename comp-async-cu-done-functions →
native-comp-async-cu-done-functions.
2021-05-06 17:16:08 +02:00
Andrea Corallo
d8f84a1c00 * Rename comp-async-jobs-number → native-comp-async-jobs-number
* lisp/emacs-lisp/comp.el (native-comp-async-jobs-number)
(comp-effective-async-max-jobs, native--compile-async)
(native-compile-async): Rename comp-async-jobs-number →
native-comp-async-jobs-number.
2021-05-06 17:16:08 +02:00
Andrea Corallo
31ca1c3e81 Rename comp-never-optimize-functions → native-comp-never-optimize-functions
* lisp/emacs-lisp/nadvice.el (advice--add-function): Rename
comp-never-optimize-functions → native-comp-never-optimize-functions.
* lisp/emacs-lisp/comp.el (native-comp-never-optimize-functions)
(comp-subr-trampoline-install, comp-call-optim-form-call): Likewise.
2021-05-06 17:16:07 +02:00