Commit graph

9281 commits

Author SHA1 Message Date
Eli Zaretskii
65c90040eb Revert "Use 'emacs-lisp-compilation-mode' in native compilation buffers"
This reverts commit 40492581f9.
It caused a recursive-load error when native-compiling files.
(Bug#64391)
2023-07-06 18:00:05 +03:00
Eli Zaretskii
40492581f9 Use 'emacs-lisp-compilation-mode' in native compilation buffers
* lisp/emacs-lisp/comp.el (comp-log-to-buffer)
(comp-run-async-workers): Use 'emacs-lisp-compilation-mode' in the
buffers where we log the results of native compilation.  Suggested
by No Wayman <iarchivedmywholelife@gmail.com>.  (Bug#64452)
2023-07-06 11:50:41 +03:00
Stefan Monnier
26f31fe3b5 * lisp/emacs-lisp/syntax.el (syntax-propertize-rules): Fix bug#64459 2023-07-05 11:37:28 -04:00
Mattias Engdegård
59a350cb91 Warn about misplaced :success in condition-case (bug#64404)
* lisp/emacs-lisp/bytecomp.el (byte-compile-condition-case):
Warn if :success is part of a list of conditions (it must come alone).
2023-07-02 11:53:36 +02:00
Eli Zaretskii
3ba9f9657f Merge from origin/emacs-29
edd36786e1 ; * lisp/bookmark.el (bookmark-bmenu-locate): Doc fix (bu...
16eac20a5d ; Fix last change
ab8d0f7b76 Add project command entries to the menu-bar
fc6099bf04 ; Improve documentation of text-property-search-* functions
cc660bd265 ; * etc/PROBLEMS: Mention MinGW problems with -D_FORTIFY_...
a5bd9fb8c4 ; Improve doc strings in register.el
0be18d8097 ; Fix @xref in last change to doc/emacs/regs.texi.
624c779517 ; Fix tree-sitter C binding typos in Elisp manual.
16e9bdff4f Improve documentation of registers
2023-07-01 06:30:00 -04:00
Eli Zaretskii
e45ddf2fdc Merge from origin/emacs-29
4df510c7a7 Fix VC package build when doc file isn't in a subdir
382f5fa813 ; * doc/emacs/package.texi (Fetching Package Sources): Fi...
fc7e7c3fde Fix type check in tramp-get-buffer-string
2aa57fe6cf ; Fix typo in maintaining.texi (bug#64279)
2023-07-01 06:29:43 -04:00
Eli Zaretskii
fc6099bf04 ; Improve documentation of text-property-search-* functions
* doc/lispref/text.texi (Property Search): Improve wording and markup.

* lisp/emacs-lisp/text-property-search.el (text-property-search-forward)
(text-property-search-backward): Doc fixes.  (Bug#64367)
2023-07-01 12:28:33 +03:00
Stefan Monnier
dcd9209095 * lisp/emacs-lisp/cl-macs.el (cl--slet): Fix bug#64315 2023-06-28 09:24:30 -04:00
Stefan Monnier
82875b1575 cl-macs-tests.el (cl-&key-arguments): Fix regression
* 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.
2023-06-27 16:14:32 -04:00
Daniel Semyonov
4df510c7a7 Fix VC package build when doc file isn't in a subdir
* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Expand 'file' before attempting to get its directory.  (Bug#64242)
2023-06-25 23:33:24 +02:00
Stefan Monnier
4c50af02ab cl-macs.el: Silence recent new "lexical arg shadows" warnings
* lisp/emacs-lisp/cl-macs.el (cl--slet): Add `nowarn` arg.
(cl--defsubst-expand): Use it.
(cl-defstruct): Silence warnings abour lexical shadowing when a slot's
name happens to be the same as a dynbound var.
2023-06-25 11:38:40 -04:00
Stefan Monnier
0228421e34 Allow suppressing the "lexical arg shadows dynbound var" warning
In most cases the right way to fix this warning is by renaming
the offending argument, but in some cases this is inconvenient, as is
the case in `cl-defstruct` where arg names are imposed by slot names.

This patch also happens to fix a few bugs along the way:
- miscompilation of (lambda (gcs-done) (lambda (x) (+ x gcs-done)))
- errors about void function `byte-compile-warn-x` if the warning was
  emitted via `cconv-fv` when bytecomp was not loaded.
Oh, and it improves the warning by making the location info slightly
more precise.

* lisp/emacs-lisp/cconv.el (cconv--analyze-function): Remove this warning.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list):
Warn about it here instead.  Let `with-suppressed-warnings` control it
under `lexical`.
2023-06-25 11:14:03 -04:00
Stefan Monnier
e85ebb3d82 (macroexp--unfold-lambda): Obey the lexbind semantics
While at it, rework the code so as not to rely on an
intermediate rewriting of (funcall (lambda ..) ...)
to ((lambda ..) ...) since that forms is deprecated.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-funcall): Unfold lambdas
instead of turning them into the deprecated ((lambda ..) ..).
(byte-optimize-form-code-walker): Don't unfold ((lambda ..) ..) any more.
(byte-compile-inline-expand): Revert to non-optimized call if the unfolding
can't be optimized.

* lisp/emacs-lisp/bytecomp.el (byte-compile-form): Don't unfold
((lambda ..) ..) any more.

* lisp/emacs-lisp/cl-macs.el (cl--slet): Remove workaround.

* lisp/emacs-lisp/disass.el (disassemble): Make sure the code is
compiled with its own `lexical-binding` value.

* lisp/emacs-lisp/macroexp.el (macroexp--unfold-lambda): Make it work
both for ((lambda ..) ..) and for (funcall #'(lambda ..) ..).
Be careful not to move dynbound vars from `lambda` to `let`.
(macroexp--expand-all): Unfold (funcall #'(lambda ..) ..) instead of
turning it into ((lambda ..) ..).  Don't unfold ((lambda ..) ..) any more.
2023-06-24 17:53:41 -04:00
Stefan Monnier
f559bd1248 * lisp/emacs-lisp/cl-macs.el (cl--slet): Unbreak bootstrap 2023-06-24 11:44:32 -04:00
Eli Zaretskii
8e8667246a Merge from origin/emacs-29
d0147ff9e5 * lisp/emacs-lisp/shortdoc.el: More and better `substring...
fa06249a9f Fix "C-x RET r" when the new encoding is UTF
679e9d7c56 ; Mention MinGW64 GCC 13.1 problems in PROBLEMS
fdc1a12ed1 Fix "vc-print-log does not erase buffer" and associated p...
d507aa7336 Add selector_expression indentation rule
1f664a0af7 Add "nixd" LSP server to Eglot
e962cf4ba7 Fix building --with-native-compilation=aot from release t...
4ca371e9cc Fix bug#64152 (Minibuffer sometimes goes "modal")
a0ccf1859c Disable target-async by default in gdb-mi.el
2bad5829ff Revert "Fix parsing of dn line if WITHDN is non-nil"
7637e361d3 Don't truncate filenames with "emacs.el" in them
2591eb1190 Improve documentation of 'minibuffer-message'
6f211bc57b Eglot: again fix positions of coinciding inlay hint overl...
a24e9e3fee ; Update ChangeLog.4 and etc/AUTHORS.
2023-06-24 07:13:42 -04:00
Eli Zaretskii
5fa9458511 Merge from origin/emacs-29
8f62e7b85f Describe primarily the Emacs s-exp dialect for treesit qu...
eacd75df4e ; Improve documentation of overlay priorities
b3f11e94fa Fix documentation of :predicate in 'define-globalized-min...
2023-06-24 06:57:25 -04:00
Mattias Engdegård
d0147ff9e5 * lisp/emacs-lisp/shortdoc.el: More and better substring examples.
Suggested by Juri Linkov.
2023-06-24 12:27:08 +02:00
Stefan Monnier
e2ee646b16 cl-defsubst: Use static scoping for args
* 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.
2023-06-23 11:37:12 -04:00
Stefan Monnier
37a09a4c00 cl-defun/cl-struct: Use static scoping for function args
* 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.
2023-06-23 10:45:49 -04:00
Mattias Engdegård
195ca6b9a3 Don't compile (+ X 0) as (* X 1)
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.
2023-06-21 18:00:26 +02:00
Sean Whitton
f16064f6bc Delete eval-command-interactive-spec
* etc/NEWS: Delete announcement of eval-command-interactive-spec.
* lisp/emacs-lisp/subr-x.el (eval-command-interactive-spec): Delete.
2023-06-21 13:26:09 +01:00
Eli Zaretskii
7637e361d3 Don't truncate filenames with "emacs.el" in them
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol):
Avoid false positives when looking for "emacs.el" matches the
likes of "emacs.elpa".  (Bug#64143)
2023-06-20 16:35:09 +03:00
Paul Eggert
94d8eeeff4 Call them “bracket expressions” more consistently
Emacs comments and doc were inconsistent about the name used for
regexps like [a-z].  Sometimes it called them “character
alternatives”, sometimes “character sets”, sometimes “bracket
expressions”.  Prefer “bracket expressions” as it is less confusing:
POSIX and most other programs’ doc uses “bracket expressions”,
“alternative” is also used in the Emacs documentation to talk about
...\|... in regexps, and “character set” normally has a different
meaning in Emacs.
2023-06-19 11:09:00 -07:00
Eli Zaretskii
b3f11e94fa Fix documentation of :predicate in 'define-globalized-minor-mode'
* doc/lispref/modes.texi (Defining Minor Modes):
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Document that :predicate creates a customizable user option.
(Bug#64048)
2023-06-18 08:50:54 +03:00
Stefan Monnier
a9c962be96 pp-fill: Fix tests breakage
* 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".
2023-06-17 18:05:33 -04:00
Stefan Monnier
2f181d6032 pp.el (pp-fill): New default pp function
* lisp/emacs-lisp/pp.el (pp-default-function): Change default.
(pp--within-fill-column-p): New helper function.
(pp-fill): New function.
2023-06-17 17:24:38 -04:00
Stefan Monnier
184106be26 pp.el (pp-default-function): New custom var
* lisp/emacs-lisp/pp.el (pp-use-max-width): Make obsolete.
(pp-default-function): New custom var.
(pp--object, pp--region): New helper functions.
(pp-29): New function, extracted from `pp-to-string`.
(pp-to-string): Add `pp-function` arg and obey `pp-default-function`.
(pp-28): New function, extracted from `pp-buffer`.
(pp-buffer): Rewrite, to obey `pp-default-function`.
(pp): Obey `pp-default-function`.
(pp-emacs-lisp-code): Add new calling convention to apply it to a region.
2023-06-17 17:21:03 -04:00
Stefan Monnier
f411cc3a95 * lisp/emacs-lisp/lisp-mode.el (lisp-ppss): Fix performance bug
(nth 2 ppss) can be absent but not incorrect, so don't recompute ppss
for (nth 2 ppss) when (nth 2 ppss) is already provided.
When calling `lisp-indent-line` on all the lines in a region, this
sometimes introduced a gratuitous O(N²) complexity.
2023-06-17 17:10:50 -04:00
Stefan Monnier
020fd63018 Avoid using `(lambda ...) to build function values
* lisp/emacs-lisp/nadvice.el (advice-eval-interactive-spec): Avoid
`(lambda ...).
2023-06-14 17:06:37 -04:00
Mattias Engdegård
ef1394fca0 Move quoted lambda funarg check and expand coverage
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
Move check for incorrectly quoted lambda arguments from here...
* lisp/emacs-lisp/bytecomp.el (byte-compile-form):
... to here, which should provide more detection opportunities.
Expand the set of functions for which this check is performed, now
also for some keyword arguments.
2023-06-13 14:27:48 +02:00
Mattias Engdegård
560c15a04f ; * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): minor tweaks
Don't lose `funcall` symbol position.  Remove outdated comment.
2023-06-12 10:24:32 +02:00
Eli Zaretskii
acfd261a61 Merge from origin/emacs-29
0d8b69e0ad Don't ding when completion succeeded
f11e2d3699 ; * admin/git-bisect-start: Update failing commits
9855a3ea74 ; * src/xdisp.c (redisplay_tool_bar): Fix a typo in a com...
f4ee696b88 Improve documentation of color-related functions
90eadc3e23 Revert "* package.el (package--get-activatable-pkg): Pref...
65f355ea0a ; Update my mail address
a3a69ec234 Fix connection-local user options handling (bug#63300)
240803cc3e Document 'startup-redirect-eln-cache'
026afb2298 ; * etc/PROBLEMS: Entry about crashes due to anti-virus (...
bcc222251e Fix `emacs-lisp-native-compile-and-load' for C-h f (bug#5...
07c8211ca3 Add 'infer' as a keyword to typescript-ts-mode (bug#63880)
dd2d8ff2f5 ; * etc/NEWS: Mention the issue with PGTK on WSL (bug#633...
fa8135f891 Revert changes to the order in which package descs are lo...
27fcfa2c0a ; * etc/NEWS: Improve instructions for grammar libraries.
2a84ab905c Handle point in last file-name component in minibuffer co...
05f25238b7 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...
4bc043ff45 Avoid asking redundant question in emacsbug.el
2eadf328d0 * test/infra/Dockerfile.emba (emacs-base): Don't install ...
583ba1db7e typescript-ts-mode: Add a rule for function_signature

# Conflicts:
#	etc/NEWS
#	lisp/minibuffer.el
2023-06-10 06:42:43 -04:00
Mattias Engdegård
c9c0d1cf7f ; fix important-return-value-fns mistake
* lisp/emacs-lisp/bytecomp.el (important-return-value-fns):
Remove assoc-string; it's already side-effect-free.
2023-06-08 19:25:16 +02:00
Mattias Engdegård
0d411a0a6d Remove special fset byte-compilation warning
* lisp/emacs-lisp/bytecomp.el (fset, byte-compile-fset):
Remove special warning for fset, subsumed by the more general quoted
lambda funarg warning.
2023-06-08 19:25:16 +02:00
Eli Zaretskii
90eadc3e23 Revert "* package.el (package--get-activatable-pkg): Prefer source packages"
This reverts commit fb87d5008e.
It caused problems when new versions of packages are installed
without deleting old versions.  (Bug#63757)
2023-06-08 12:23:11 +03:00
Andrea Corallo
65f355ea0a ; Update my mail address
* 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.
2023-06-08 11:04:10 +02:00
Sean Whitton
d751915ef4 eval-command-interactive-spec: Shorten code
* lisp/emacs-lisp/subr-x.el (eval-command-interactive-spec): Don't
reimplement checking for an 'interactive-form symbol property.
`interactive-form' already does this.  Thanks to Stefan Monnier.
2023-06-06 12:15:30 +01:00
Andrea Corallo
bcc222251e Fix `emacs-lisp-native-compile-and-load' for C-h f (bug#58314)
* lisp/emacs-lisp/comp.el (comp-write-bytecode-file): New function
spilling code from `batch-byte+native-compile'.
(batch-byte+native-compile): Make use of.
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load): Produce the elc file and ask
to have it loaded.
2023-06-06 12:21:43 +02:00
Sean Whitton
a30781399b * subr-x (eval-command-interactive-spec): New function. 2023-06-04 20:16:55 +01:00
Mattias Engdegård
6058b4559d Better internal-make-closure optimisation
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Optimise closed-over values in closure creation like any other, which
can lead to stack variables being eliminated.
2023-06-04 19:17:15 +02:00
Andrea Corallo
5d3d84066f * lisp/emacs-lisp/comp-cstr.el (cl-macs): Require it. 2023-06-04 16:43:13 +02:00
Andrea Corallo
b5f171f98f * lisp/emacs-lisp/comp.el (comp-function-type-spec): Improve. 2023-06-04 16:25:14 +02:00
Philip Kaludercic
fa8135f891 Revert changes to the order in which package descs are loaded
* lisp/emacs-lisp/package.el (package-load-all-descriptors):  Remove
NOSORT argument to 'directory-files', reverting back to the behaviour
as of Emacs 28.  (Bug#63757)
2023-06-04 15:21:13 +02:00
Eli Zaretskii
3f9e0281ad ; Minor doc copyedits in comp.el
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix
commentary.
(comp-function-type-spec): Doc fix.
2023-06-04 15:28:25 +03:00
Mattias Engdegård
508005b3cf ; * lisp/emacs-lisp/comp.el (comp-funciton-type-spec): typo 2023-06-04 14:09:39 +02:00
Andrea Corallo
53dc1f3fe0 Print know function types in C-h f
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Improve comment.
(comp-funciton-type-spec): New function.
* lisp/help-fns.el (help-fns--signature): Update to make use of
`comp-funciton-type-spec'.
2023-06-04 13:06:39 +02:00
Andrea Corallo
9ed24bfb04 * Have `comp-cstr-to-type-spec' handle comp-cstr-f as well
* lisp/emacs-lisp/comp-cstr.el (comp--simple-cstr-to-type-spec): New
function.
(comp-cstr-to-type-spec): Make use of.
2023-06-04 12:53:38 +02:00
Andrea Corallo
ac1532a7c9 * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix line lengths 2023-06-04 12:53:38 +02:00
Andrea Corallo
fe91af936d * lisp/emacs-lisp/comp.el: Improve 85cb075b1b. 2023-06-04 12:53:38 +02:00
Andrea Corallo
85cb075b1b * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Tweak framep. 2023-06-04 10:59:04 +02:00