Commit graph

9260 commits

Author SHA1 Message Date
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
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
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
Eli Zaretskii
970f94a2dd Merge from origin/emacs-29
ede3535051 ; Fix last change
8ec786349e Fix apostrophe handling in rust-ts-mode and go-ts-mode (B...
0eba9cf651 * test/infra/Dockerfile.emba (emacs-base): Install also g...
4897c98b6c Fix 'python-util-clone-local-variables'
6b2c8dc905 Revert "Enhance Python font-lock to support multilines"
348e4504c6 Fix typo in calc.texi
03663b8798 Update to Transient v0.4.1
dc7acb1aaf Avoid errors in 'delete-forward-char' deleting static com...
2f94f6de9d Make VS-15 and VS-16 compositions work correctly
753f8aa1f1 Fix project-name for vc-aware backend in non-file buffers
17c7915ab9 ; Fix 'package-install-upgrade-built-in' check for packag...
e252ce26ea Add type_predicate 'is' as keyword in typescript-ts-mode ...
0a354d6578 Fix infloop in info-look.el
83b22139e4 Fix several todo-mode.el item editing bugs (bug#63811)
ed4cd3eddf dockerfile-ts-mode: Prevent empty categories in imenu (Bu...
2e20e318da Brush up doc strings and terminology in plstore.el
372bc1278c Add internal documentation on plstore.el
23a14e7b90 Add compact_constructor_declaration font-locking to java-...
500abc4dc3 * lisp/tmm.el (tmm-completion-delete-prompt): Add more ch...
afc1f32935 Allow to disable the DWIMish behavior of 'x' in package menu
08104c0150 Allow dired to invoke secondary browser
a3063f0bc8 Add a binding for enriched-toggle-markup
d8ba28fa39 Fix order of tmm-menubar when 'tmm-mid-prompt' is nil

# Conflicts:
#	etc/NEWS
2023-06-03 05:50:58 -04:00
Andrea Corallo
9f5ca95ef7 * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix a bunch of 2023-06-01 21:18:06 +02:00
Andrea Corallo
dacc535a80 * lisp/emacs-lisp/comp.el (comp-jump-table-optimizable): Refactor. 2023-06-01 11:48:24 +02:00
Philip Kaludercic
17c7915ab9 ; Fix 'package-install-upgrade-built-in' check for package menu
* lisp/emacs-lisp/package.el (package-menu--find-upgrades): Use
correct check to verify if a built-in packages in the package menu can
be upgraded or not.

This change improves upon a faulty assumption from
ba2c76fa2b.  (Bug#63587)
2023-05-31 23:54:29 +02:00
Mattias Engdegård
ddf8587bb5 Disable unused-return-value warning for delq and delete, again
* lisp/emacs-lisp/bytecomp.el (important-return-value-fns):
Remove `delq` and `delete` since they resulted in false
positives that nobody was interested in silencing (bug#61730).
2023-05-31 17:09:12 +02:00
Mattias Engdegård
49c56f3335 Add function declarations
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns):
Add get-byte, string-width, unibyte-string, special-variable-p, frexp,
buffer-hash, buffer-line-statistics, load-average, md5, secure-hash,
string-collate-equalp, string-collate-lessp, string-to-unibyte,
string-version-lessp, current-cpu-time.
(side-effect-and-error-free-fns): Add equal-including-properties.
(pure-fns): Add equal-including-properties, string-version-lessp.
* lisp/emacs-lisp/bytecomp.el (important-return-value-fns):
Add match-data.
* lisp/subr.el (buffer-local-boundp, subr-primitive-p, gensym)
(frame-configuration-p, apply-partially, make-composed-keymap)
(keymap-canonicalize, listify-key-sequence, event-modifiers)
(event-basic-type, mouse-event-p, event-start, event-end)
(event-click-count, event-line-count, posnp, posn-window, posn-area)
(posn-point, posn-x-y, posn-col-row, posn-actual-col-row)
(posn-timestamp, posn-string, posn-image, posn-object)
(posn-object-x-y, posn-object-width-height, provided-mode-derived-p)
(derived-mode-p, autoloadp, locate-eln-file, symbol-file)
(process-lines-handling-status, process-lines)
(process-lines-ignore-status, process-get)
(copy-overlay, shell-quote-argument, field-at-pos):
Add appropriate function declarations.
2023-05-30 17:46:06 +02:00
Mattias Engdegård
08291e6f17 Clean up defcustom type quote check
* lisp/emacs-lisp/bytecomp.el
(byte-compile--suspicious-defcustom-choice): Rename to...
(byte-compile--defcustom-type-quoted): ...this and rewrite to make
more sense.  All callers updated.
(byte-compile-nogroup-warn): Better warning message.
* test/lisp/emacs-lisp/bytecomp-tests.el
(test-bytecomp-defgroup-choice): This never failed because it wasn't
actually a test.  Turn it into...
(bytecomp-test-defcustom-type-quoted): ...this, which is.
2023-05-30 09:51:10 +02:00
Andrea Corallo
fbc96dcc4e Revert "* Nativecomp disable propagation of pre slot access type check..."
This reverts commit c8e527cbee as
56a8d57d03 fixes the root cause.
2023-05-29 18:07:20 +02:00
Andrea Corallo
56a8d57d03 comp: Recompute type slots after byte compilation for user types
* lisp/emacs-lisp/comp-cstr.el (comp--compute-typeof-types)
(comp--compute--pred-type-h): New functions.
(comp-cstr-ctxt): Make use of.
(comp-cstr-ctxt-update-type-slots): New function.

* lisp/emacs-lisp/comp.el (comp-spill-lap): Use
`comp-cstr-ctxt-update-type-slots'.
2023-05-29 18:04:30 +02:00
Eli Zaretskii
afc1f32935 Allow to disable the DWIMish behavior of 'x' in package menu
* lisp/emacs-lisp/package.el
(package-menu-use-current-if-no-marks): New defcustom.
(package-menu-execute): Use it.  (Bug#62563)

* etc/NEWS: Announce the new option.
2023-05-29 16:44:48 +03:00
Andrea Corallo
c8e527cbee * Nativecomp disable propagation of pre slot access type check (bug#63710)
* lisp/emacs-lisp/comp.el (comp-add-cond-cstrs): Temporary disable
propagation of pre slot access type check.
2023-05-28 15:07:31 +02:00
Stefan Monnier
321ed8ebae * lisp/emacs-lisp/package.el (package-buffer-info): Fix last change
The code that follows expects point to be at/near the end of the buffer.
2023-05-26 11:18:49 -04:00
Mattias Engdegård
ef778f5143 Add more function declarations
* lisp/subr.el (buffer-narrowed-p, sha1, match-substitute-replacement)
(version-to-list, version<, version<=, version=)
(function-get, subregexp-context-p, split-string)
(combine-and-quote-strings, split-string-and-unquote)
(replace-regexp-in-string, syntax-after)
(string-trim-left, string-trim):
* lisp/emacs-lisp/subr-x.el (hash-table-empty-p, hash-table-keys)
(hash-table-values, string-glyph-split)
(string-clean-whitespace, string-fill, string-limit)
(string-pixel-width):
* lisp/env.el (substitute-env-vars, substitute-env-in-file-name)
(setenv-internal):
* lisp/emacs-lisp/rx.el (rx-to-string):
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth)
(regexp-opt-charset):
Add appropriate declarations: pure, side-effect-free, and/or
important-return-value.
2023-05-26 13:57:02 +02:00
Eli Zaretskii
eacee3e536 Merge from origin/emacs-29
6f6071c526 Avoid duplicate load-path entry when generating package a...
117b29c6f6 ; Improve documentation of Isearch command properties
a347b26cba Disable loading SQLite3 extensions when SQLite3 version i...
fe22bf503f ; * lisp/progmodes/project.el (project-switch-use-entire-...
64dbbde3b7 Fix visiting HTML files encoded in iso-2022 variants
5c95239aca ; Fix markup of some treesit vars in Elisp manual.
6ad041939b Support 'isearch-allow-scroll' in 'pixel-scroll-precision...
ecccdc07a0 shr: allow moving between adjacent anchors
504ef25ef3 ; * etc/NEWS: Fix typos.
d6fb868cdd Fix multihop file name expansion in Tramp
dd3e4e14fd Remove obsolete information from Gnus manual
2a5c946f87 Preserve mark in comint-history-isearch
6b60c8142e Fix systemd unit completion for old versions of systemd
8c56557cd9 Fix Skeletons menu-bar menu in Python modes
58eb38cfb4 ; * etc/NEWS: missing definite article
cf40362869 ; * etc/NEWS: PGTK cannot switch to -new automatically (b...
ead3a2abbf Fix loading SQLite extensions
a6bddd1765 ; * etc/NEWS: Fix typos.
f49fe936ab * etc/NEWS: Note dotimes loop variable scoping change (bu...
cec9333dc5 Fix c-ts-mode--top-level-declarator
f571e8f1bb Improve c-ts-mode font-lock for function names (bug#63390)
42a28ffdc2 * lisp/tab-bar.el: Don't use 'minibuffer-selected-window'...
8e61d23f71 Split windows horizontally in places that use split to cr...
459d08c7fe Fix tree-sitter test (bug#63481)
3bc5efb87e ; * lisp/emacs-lisp/benchmark.el (benchmark-progn): Fix d...

# Conflicts:
#	etc/NEWS
2023-05-26 07:03:07 -04:00
Andrea Corallo
b2b2be98da Fix nativecomp ICE compiling structure related code (bug#63674)
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Define the predicate to
be effective at compile time as native comp relies on `cl-typep' that
relies o predicates to work.

* test/src/comp-resources/comp-test-funcs.el (cl-lib): Require.
(comp-test-struct): Define struct.
(comp-test-63674-1-f): Add new test.
2023-05-24 17:20:38 +02:00
Andrea Corallo
6c781b5d25 comp: Propagate pre slot access type check
* lisp/loadup.el (max-lisp-eval-depth): Increase
`max-lisp-eval-depth' to 3400.

* lisp/emacs-lisp/comp.el (comp-add-cond-cstrs): Pattern match pre
slot access type check and add constraint.

* lisp/emacs-lisp/comp-cstr.el (comp-cstr-cl-tag-p)
(comp-cstr-cl-tag): New functions.

* lisp/emacs-lisp/comp.el (make-comp-mvar): Add neg parameter.
2023-05-23 16:39:06 +02:00
Andrea Corallo
d03dd07774 comp: Make use of predicates in propagation for non builtin types
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-ctxt): Add `pred-type-h'
slot.
* lisp/emacs-lisp/comp.el (comp-known-predicate-p)
(comp-pred-to-cstr): Update.
2023-05-23 16:39:06 +02:00
Andrea Corallo
f4de81af8f * lisp/emacs-lisp/comp.el (comp-fwprop-call): Extend to understand `record' 2023-05-23 16:39:05 +02:00
Andrea Corallo
92ccb6ba83 comp: Account non builtin types in type hierarchy
* lisp/emacs-lisp/cl-macs.el (cl--struct-all-parents): Add comment.

* lisp/emacs-lisp/cl-preloaded.el (cl--struct-get-class): Likewise.

* lisp/emacs-lisp/comp-cstr.el (comp--cl-class-hierarchy)
(comp--all-classes): New functions.
(comp-cstr-ctxt): Add `typeof-types' field.

* lisp/emacs-lisp/comp-cstr.el (comp-supertypes)
(comp-union-typesets): Update to use non builtin types.
2023-05-23 16:39:05 +02:00
Robert Pluim
1d5b164109 Stop adding the package directory to the load path
The generated autoloads files for packages have been updating the
load-path for the last decade.

* lisp/emacs-lisp/package.el (package-activate-1): Don't update
load-path with package directory.
2023-05-23 15:13:50 +02:00
Robert Pluim
6f6071c526 Avoid duplicate load-path entry when generating package autoloads
'file-name-directory' produces a path ending in '/', so that needs to be
run through 'directory-file-name' to avoid duplicate entries in
'load-path'.  (Bug#63625)

* lisp/emacs-lisp/package.el (package-generate-autoloads): Call
'directory-file-name' on the directory of 'load-file-name'.
2023-05-23 14:12:21 +02:00