Commit graph

9017 commits

Author SHA1 Message Date
Andrea Corallo
0bd96806ef * Rename `comp--typeof-builtin-types'
* lisp/emacs-lisp/comp-cstr.el (comp--typeof-builtin-types): Rename.
(comp-normalize-valset, comp-common-supertype-2): Update.
2022-08-18 23:41:39 +02:00
Andrea Corallo
715f1ebea3 * lisp/emacs-lisp/comp-cstr.el (comp--all-builtin-types): Remove 2022-08-18 23:36:19 +02:00
Stefan Kangas
f97668c38f Merge from origin/emacs-28
ef1e68f11d * lisp/image-mode.el (image-mode-as-hex): Fix toggle instr...
dc0fce3a7d ; lisp/image-mode.el: Fix typo.
254ba1d3e5 * lisp/image-mode.el: Improve commentary.
ac43ac1af9 cl-reduce doc string improvement
2022-08-18 19:21:32 +02:00
Mattias Engdegård
1ad0d60740 Fix string-to-syntax signature in comp-known-type-specifiers
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers):
`string-to-syntax` can return nil.
2022-08-18 17:25:41 +02:00
Andrea Corallo
67ec994180 * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix some type 2022-08-18 17:11:59 +02:00
Mattias Engdegård
9361c83318 More non-nil-returning functions in source optimisation
This change was partially generated and mechanically cross-validated
with function type information from comp-known-type-specifiers in
comp.el.

* lisp/emacs-lisp/byte-opt.el (byte-compile-trueconstp):
Extend list of functions and fix a typo (logxor).
2022-08-18 17:10:46 +02:00
Lars Ingebrigtsen
74e830768d Make GEN message from loaddefs-generate nicer
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Shorten the
informational GEN file relative to the stated directory
(bug#57265).  This makes the message nicer for ELPA packages.
2022-08-18 15:12:55 +02:00
Colin Woodbury
ac43ac1af9 cl-reduce doc string improvement
* lisp/emacs-lisp/cl-seq.el (cl-reduce): Explain what happens when
using :from-end (bug#57273).
2022-08-18 15:07:08 +02:00
Stefan Kangas
dae4fc3adf Improve cryptic syntax switch message in re-builder
* lisp/emacs-lisp/re-builder.el (reb-restart-font-lock): Move message
from here...
* lisp/emacs-lisp/re-builder.el (reb-change-syntax): ...to here.
Change it to be less cryptic.
2022-08-18 13:19:42 +02:00
Philip Kaludercic
d3f03666bb
Merge remote-tracking branch 'origin/master' into feature/package+vc 2022-08-18 09:23:45 +02:00
Andrea Corallo
3e042c80ce * lisp/emacs-lisp/bytecomp.el (byte-compile-log-1): Create buffer if necessary 2022-08-17 23:35:46 +02:00
Mattias Engdegård
fb98c4a406 Improved null (alias not) optimisation
Take static boolean information of the argument into account.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-not): New.
2022-08-16 20:44:50 +02:00
Mattias Engdegård
621550c076 Improved and and or optimisation
* lisp/emacs-lisp/byte-opt.el (byte-optimize-and, byte-optimize-or):
Rewrite.  Avoid branching on arguments statically known to be true or
false, and hoist code out to an unconditional prefix when possible.
2022-08-16 20:44:50 +02:00
Mattias Engdegård
e618b6faee Improved if and while optimisation
Recognise some more special cases:

  (if X nil t)      -> (not X)
  (if X t)          -> (not (not X))
  (if X t nil)      -> (not (not X))
  (if VAR VAR X...) -> (or VAR (progn X...))

* lisp/emacs-lisp/byte-opt.el (byte-opt-negate): New.
(byte-optimize-if): Add transformations above and refactor.
(byte-optimize-while): Better static nil-detection.
2022-08-16 20:44:50 +02:00
Mattias Engdegård
869db699ee Improved static detection of nil and non-nil expressions
* lisp/emacs-lisp/byte-opt.el (byte-opt--bool-value-form): New.
(byte-compile-trueconstp, byte-compile-nilconstp): Determine a static
nil or non-nil result in more cases.  These functions have grown and
are no longer defsubst.
2022-08-16 20:44:50 +02:00
Yury Kholodkov
d5ee49c25c Fix variable types in warnings-suppress
* lisp/emacs-lisp/warnings.el (warnings-suppress): The type of
these user options is a list of lists of symbols, not a list of
symbols (bug#57183).

Copyright-paperwork-exempt: yes
2022-08-15 09:36:06 +02:00
Lars Ingebrigtsen
ead4b914ca Fix up the exclusion logic in loaddefs-generate
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Allow
excluding files completely (bug#57144).
2022-08-15 08:29:28 +02:00
Lars Ingebrigtsen
d33a6b9069 Tweak autoloads of defsubsts containing spaces/control chars
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form):
Escape control chars in bodies so that we don't end up with
trailing spaces if we're autoloading a defsubst containing
"\\`[ \t\n\r]*\\'".
2022-08-15 08:24:29 +02:00
Lars Ingebrigtsen
90b4ee6575 Further lisp-current-defun-name tweaks
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Further
tweaks to make (autoload 'foo) work again.  Perhaps this should
all be reverted to the original version and then given a new rething.
2022-08-15 07:30:25 +02:00
Stefan Monnier
3a9c803f24 * lisp/emacs-lisp/ring.el (ring): Define as a type 2022-08-14 12:30:06 -04:00
Stefan Monnier
1faeef7924 (compiled-function-p): New function (bug#56648)
* lisp/subr.el (compiled-function-p): New function.

* test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1):
* lisp/gnus/gnus.el (gnus):
* lisp/mh-e/mh-e.el (mh-version):
* lisp/emacs-lisp/macroexp.el (emacs-startup-hook):
* lisp/emacs-lisp/cl-macs.el (compiled-function):
* lisp/emacs-lisp/bytecomp.el (byte-compile-fdefinition)
(byte-compile, display-call-tree):
* lisp/emacs-lisp/byte-opt.el (<toplevel-end>):
* lisp/emacs-lisp/advice.el (ad-compiled-p):
* lisp/cedet/semantic/bovine.el (semantic-bovinate-stream):
* lisp/loadup.el (macroexpand-all):
* admin/unidata/unidata-gen.el (unidata--ensure-compiled): Use it.

* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Add entries for it.
(pcase--split-pred): Use it.

* lisp/help-fns.el (help-fns-function-description-header): Use `functionp`.
(help-fns--var-safe-local): Use `compiled-function-p`.
2022-08-14 12:30:05 -04:00
Mattias Engdegård
1d8712bcc9 Strength-reduce apply with (list ...) as tail argument
* lisp/emacs-lisp/byte-opt.el (byte-optimize-apply):
Transform (apply F ... (list X ...)) -> (funcall F ... X ...)
2022-08-14 15:43:12 +02:00
Mattias Engdegård
e99d7c4d62 Simplify code using take, ntake and butlast
* lisp/calc/calc-vec.el (calcFunc-rhead):
* lisp/calc/calc.el (calc-top-list, calc-pop):
* lisp/emacs-lisp/ert.el (ert-summarize-tests-batch-and-exit):
Simplify.
2022-08-14 15:43:12 +02:00
Štěpán Němec
b93e14fa0f ; advice--interactive-form: Fix a typo introduced in recent change
* lisp/emacs-lisp/nadvice.el (advice--interactive-form): Fix a typo.
2022-08-14 10:23:29 +02:00
Stefan Monnier
dd2973bf50 nadvice.el: Avoid exponential blow up in interactive-form recursion
* lisp/emacs-lisp/nadvice.el (advice--interactive-form): Sink the call
to `commandp` into the autoloaded function case since it's redundant in
the other branch.
(advice--make-interactive-form): Take just the interactive forms rather
than the actual functions as arguments.
(oclosure-interactive-form): Use `advice--interactive-form` rather than
`commandp` since we'd call `advice--interactive-form` afterwards anyway.
2022-08-13 12:04:29 -04:00
Lars Ingebrigtsen
2bbb007e16 Allow EXCLUDED-FILES in loaddefs-generate to be relative
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Allow the
excluded files to be relative (bug#57144).
2022-08-13 14:07:41 +02:00
Stefan Kangas
c4505fed53 Hide local variable section in emacs-news-modes
* lisp/textmodes/emacs-authors-mode.el
(emacs-authors-mode--hide-local-variables): Move from here...
* lisp/emacs-lisp/subr-x.el (emacs-etc--hide-local-variables):
...to here.

* lisp/textmodes/emacs-authors-mode.el (subr-x): Require.
(emacs-authors-mode): Use above renamed function.

* lisp/textmodes/emacs-news-mode.el (subr-x): Require.
(emacs-news--mode-common): Call 'emacs-etc--hide-local-variables'
to hide local variables section.
2022-08-12 22:28:17 +02:00
Lars Ingebrigtsen
316d3111a3 Don't update loaddefs.el timestamps uselessly in loaddefs-generate
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Don't
re-write the loaddefs.el file when there's no reason to.
2022-08-12 20:22:26 +02:00
Philip Kaludercic
57e16b316d
* package-vc.el (package-vc-fetch): Autoload it 2022-08-12 17:02:20 +02:00
Philip Kaludercic
1823349e6a
Merge remote-tracking branch 'origin/master' into feature/package+vc 2022-08-12 16:05:05 +02:00
Lars Ingebrigtsen
c0d761bf7f Further seq-uniq speed-ups for lists
* lisp/emacs-lisp/seq.el (seq-uniq): Speed up more for long lists
(bug#57079).
2022-08-12 15:16:39 +02:00
Stefan Kangas
8ae68308a1 Use help-key-binding face in package list help
* lisp/emacs-lisp/package.el (package--prettify-quick-help-key):
Use help-key-binding face.
2022-08-12 15:08:19 +02:00
Eli Zaretskii
a99ea4b761 ; Fix documentation of 'loaddefs-generate' (bug#57144)
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Doc fix.
2022-08-12 09:49:35 +03:00
Stefan Kangas
8854b321c2 Make ad-version variable obsolete
* lisp/emacs-lisp/advice.el (ad-version): Make obsolete in favor
of emacs-version.  It has not been bumped since 1994.
2022-08-11 17:34:59 +02:00
Stefan Kangas
89f5167379 Don't show status message in Helper-describe-bindings
* lisp/emacs-lisp/helper.el (Helper-describe-bindings): Don't show
status message.
2022-08-11 14:35:23 +02:00
Philip Kaludercic
faa7f03b0c
Add "send patches" note to package-vc TODO section 2022-08-11 14:19:26 +02:00
Philip Kaludercic
dd98fedd0c
* package.el (describe-package-1): Add news if avaliable 2022-08-11 14:06:43 +02:00
Philip Kaludercic
fb87d5008e
* package.el (package--get-activatable-pkg): Prefer source packages 2022-08-11 13:35:47 +02:00
Philip Kaludercic
f5bb6b0131
Allow updating source packages
* lisp/emacs-lisp/package-vc.el (package-vc-update): Add new function.
* lisp/emacs-lisp/package.el (package-update): Use 'package-vc-update'.
2022-08-11 13:23:51 +02:00
Philip Kaludercic
9ddc23cd34
Ignore files in .elpaignore during byte compilation
* package.el (package--parse-elpaignore): Add new function.
(package--compile): Bind 'byte-compile-ignore-files' to the result of
'package--parse-elpaignore'.
2022-08-11 12:47:28 +02:00
Philip Kaludercic
878cacc712
* package-vc.el (package-vc-unpack): Detect TeXinfo manuals 2022-08-11 12:40:17 +02:00
Philip Kaludercic
8638aace3f
Allow ignoring files during byte compilation
* bytecomp.el (byte-compile-ignore-files): Add new variable.
(byte-recompile-directory): Respect 'byte-compile-ignore-files'.
2022-08-11 12:18:59 +02:00
Philip Kaludercic
5fe97dd9dd
; Require rx during byte compilation 2022-08-11 10:55:43 +02:00
Philip Kaludercic
98381366b5
Guess Git repositories from the URL header
* package-vc.el (package-vc-probable-repository-regexp): Add new user option.
(package-vc-sourced-packages-list): Add new function using
'package-vc-probable-repository-regexp'.
(package-vc-fetch): Use 'package-vc-sourced-packages-list'.
2022-08-11 10:53:55 +02:00
Mattias Engdegård
d8d582dc3c ; * lisp/emacs-lisp/subr-x.el (string-pad): Optimise. 2022-08-10 13:06:12 +02:00
Mattias Engdegård
9d35afed49 Extend LAP optimisations to more operations
Extend the set of eligible opcodes for certain peephole
transformations, which then provide further optimisation
opportunities.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Optimise empty save-current-buffer in the same way as we already
do for save-excursion and save-restriction.  This is safe
because (save-current-buffer) is a no-op.
(byte-compile-side-effect-and-error-free-ops): Add list3, list4 and
listN.  These were all apparent oversights as list1 and list2 were
already included.
(byte-after-unbind-ops): Add stack-ref, stack-set, discard, list3,
list4 and listN.  Stack manipulation is safe because unbind cannot
read or modify stack entries.
2022-08-10 12:51:40 +02:00
Stefan Kangas
f002fa8bfc Delete dead code in checkdoc.el
* lisp/emacs-lisp/checkdoc.el: Delete code commented out since
1997.
2022-08-10 11:28:17 +02:00
Stefan Kangas
581fa3d958 Autoload string-blank-p
* lisp/eshell/em-hist.el (subr-x):
* lisp/net/eudc.el (subr-x): Don't require.
* lisp/emacs-lisp/subr-x.el (string-blank-p): Autoload.
2022-08-09 21:58:00 +02:00
Lars Ingebrigtsen
b2bf91003d Further lisp-current-defun-name tweaks
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Tweak so
that cl-defmethod and friends work again.
2022-08-09 19:21:36 +02:00
Lars Ingebrigtsen
5269842833 Add a faster seq-uniq for lists
* lisp/emacs-lisp/seq.el (seq-uniq): Add a faster method for lists
(bug#57079).
2022-08-09 19:21:36 +02:00