Commit graph

8806 commits

Author SHA1 Message Date
Philip Kaludercic
17b017d55c ; Avoid loading package-vc in 'package-load-descriptor'
* lisp/emacs-lisp/package.el (package-load-descriptor): Remove the
:commit check.

The property is mostly unused anyway, and this unnecessarily slows
down initialisation if a package is installed from source.
2022-10-31 10:51:40 +01:00
Philip Kaludercic
462a66e79e ; Actually check if NAME-OR-URL is a string
* lisp/emacs-lisp/package-vc.el (package-vc-install): Use stringp as
predicate instead of binding it as a variable.
2022-10-31 10:02:03 +01:00
Philip Kaludercic
c2088c0849 Allow specifying and pinning source packages to be installed
* lisp/emacs-lisp/package-vc.el (package-vc--select-packages): Add
custom setter for 'package-vc-selected-packages'.
(package-vc-selected-packages): Add user option.
2022-10-31 10:02:03 +01:00
Philip Kaludercic
8e7bb5bb87 ; Update TODO section 2022-10-30 21:12:48 +01:00
Philip Kaludercic
2a4f37fe52 Merge remote-tracking branch 'origin/master' into feature/package+vc 2022-10-30 18:45:37 +01:00
Philip Kaludercic
d33998ed3b Have 'last-change' accept a line number instead of a range
* lisp/emacs-lisp/package-vc.el (package-vc-release-rev): Use new
signature.
* lisp/vc/vc-git.el (vc-git-last-change): Update signature
* lisp/vc/vc.el (vc-default-last-change): Update signature and use
'annotate-command'.
2022-10-30 16:52:08 +01:00
Philip Kaludercic
bb86ed20e1 Display a message after installing source packages
* lisp/emacs-lisp/package-vc.el (package-vc-unpack-1): Print message
and return t.
2022-10-30 14:57:11 +01:00
Philip Kaludercic
ec3f102b8c Prefer "Package-Version" over "Version" if available
* lisp/emacs-lisp/package-vc.el (package-vc-release-rev): Search for
both in sequence.
2022-10-30 14:43:10 +01:00
Philip Kaludercic
8b49d553b6 ; Avoid a type error on malformed "elpa-packages.eld" input
* lisp/emacs-lisp/package-vc.el: Use 'eq' instead of '='
2022-10-30 14:07:56 +01:00
Philip Kaludercic
30f1e7c1e9 Extract last source package release from local VCS data
* lisp/emacs-lisp/package-vc.el (package-vc-archive-spec-alist):
Unmention :release-rev
(package-vc-desc->spec): Fall back on other archives if a
specification is missing.
(package-vc-main-file): Add new function, copying the behaviour of
elpa-admin.el.
(package-vc-generate-description-file): Use 'package-vc-main-file'.
(package-vc-unpack): Handle special value ':last-release'.
(package-vc-release-rev): Add new function using 'last-change'.
(package-vc-install): Pass ':last-release' as REV instead of a
release.
* lisp/vc/vc-git.el (vc-git-last-change): Add Git 'last-change'
implementation.
* lisp/vc/vc.el (vc-default-last-change): Add default 'last-change'
implementation.

This attempts to replicate the behaviour of elpa-admin.el's
"elpaa--get-last-release-commit".
2022-10-30 14:04:52 +01:00
Basil L. Contovounesios
1d62c96423 ; Silence warning in last hierarchy.el change. 2022-10-30 00:44:44 +03:00
Eli Zaretskii
df7ca69920 Set 'native-comp-debug' to zero on MS-Windows
* lisp/emacs-lisp/comp.el (native-comp-debug): Don't emit debug
symbols on MS-Windows.  The default was originally made 1 because
without that, C backtraces on Windows would not show
natively-compiled functions correctly, or would even stop short of
reaching the topmost call frame.  But that turned out to be due to
a bug in GDB, which was meanwhile fixed in GDB 12.  So we can now
reset the value back to zero, and gain smaller *.eln files on
MS-Windows.
2022-10-29 18:59:04 +03:00
Alan Mackenzie
31e7b9c073 Fix the subr-arity returned by native compiled functions with lots of args
This fixes bug #58739.  Make subr-arity return, e.g., (12 . 12) rather than
(12 . many) for a function with a fixed number of arguments more than 8.

* lisp/emacs-lisp/comp.el (comp-prepare-args-for-top-level): Only return a cdr
of 'many when there are &rest arguments.

* src/eval.c (eval_sub): Also check for a fixed number of args over 8 when
using the nargs + *args calling convention.
(funcall_subr): Also check numargs <= 8 before using the fixed args calling
convention.  Include the case numargs > 8 in the aMany calling convention.

* src/lisp.h (DEFUN): Amend the comment about MANY.
2022-10-29 13:21:39 +00:00
Philip Kaludercic
a52cec7b6b
Explicitly handle :vc-backend in a package specification
* lisp/emacs-lisp/package-vc.el (package-vc-archive-spec-alist):
Document the feature.
(package-vc-unpack): Check for :vc-backend in both PKG-SPEC and the
archive specification data.
2022-10-28 20:13:28 +02:00
Philip Kaludercic
4097781655
Ensure that package specifications are always fetched
* lisp/emacs-lisp/package-vc.el (package-vc--archives-initialize): Add
new function, extending 'package--archives-initialize'.
(package-vc-install): Use new function.
(package-vc-link-directory): Use new function.
2022-10-28 20:10:30 +02:00
Philip Kaludercic
60b3eb0754
Allow specifying the VC backend used by 'package-vc-install'
* lisp/emacs-lisp/package-vc.el (package-vc-install): Add argument BACKEND.
2022-10-28 20:01:48 +02:00
Philip Kaludercic
a00ec87c0b
Update handling for new elpa-packages.eld format
* lisp/emacs-lisp/package-vc.el (package-vc-elpa-packages-version):
Add constant.
(package-vc-archive-data-alist): Add variable.
(package-vc--read-archive-data): Separate package specifications from
metadata.
(package-vc-unpack): Check archive metadata.
2022-10-28 19:58:05 +02:00
Stefan Monnier
d79cdcd4ff cconv.el: Fix regression in cconv-tests-interactive-closure-bug51695
The new code to make interpreted closures safe-for-space introduced
a regression in `cconv-tests-interactive-closure-bug51695`, only seen
when using TEST_LOAD_EL.
A few other issues were found and fixed along the way.

* lisp/emacs-lisp/cconv.el (cconv-fv): Change calling convention and
focus on finding the free variables.
(cconv-make-interpreted-closure): New function.

* lisp/loadup.el: Use `compiled-function-p` rather than
`byte-code-function-p` so we also use safe-for-space interpreted
closures when we build with native compilation.
(internal-make-interpreted-closure-function):
Use `cconv-make-interpreted-closure`.

* src/eval.c (syms_of_eval): Rename `internal-filter-closure-env-function`
to `internal-make-interpreted-closure-function`.
(Ffunction): Let that new var build the actual closure.

* test/lisp/emacs-lisp/cconv-tests.el
(cconv-tests-interactive-closure-bug51695): Test specifically the
interpreted case.
2022-10-28 11:33:24 -04:00
Stefan Monnier
c0f7a276cf * lisp/emacs-lisp/re-builder.el: Cosmetic changes
(reb-valid-string): Declare it risky so the mode-line will obey its
text-properties.
(reb-lisp-syntax-p): No need to make it `defsubst`.
(reb-target-value): New function to replace the
`reb-target-binding` macro.  Adjust all callers.
(reb-auto-update): Give a more informative error message than just
"invalid" and give it a warning face.
(reb-update-regexp): Always update `reb-regexp-src` (it's harmless),
rather than only when it's necessary (reduces the need for advice in pcre.el).
2022-10-28 09:36:40 -04:00
Wamm K. D
c6ec08e49a Allow Hierarchy to delay computation of children
This adds an option to allow callers to specify that computing
the children of the hierarchy should be delayed to when the
user calls for them, by utilizing the tree-widget :expander
property.
* lisp/emacs-lisp/hierarchy.el (hierarchy-add-tree)
(hierarchy-add-trees): Add parameter 'delay-children-p'.
* lisp/emacs-lisp/hierarchy.el
(hierarchy--create-delayed-tree-widget): Add function.
* lisp/emacs-lisp/hierarchy.el (hierarchy-convert-to-tree-widget):
Utilize ':expander' if delaying children.  (Bug#55900)

* test/lisp/emacs-lisp/hierarchy-tests.el: Add tests for
delayed-children functionality.
2022-10-27 20:12:24 +03:00
Stefan Kangas
db2ed9f333 ; Fix several symbol name typos 2022-10-26 23:04:23 +02:00
Basil L. Contovounesios
38bcad5451 Pacify recent unused/ignored lexvar warnings
Lexvars with special names like 'ignored' or 'unused' are no longer
treated specially.

* lisp/ansi-color.el (ansi-color-process-output):
* lisp/cus-edit.el (customize-apropos-options):
* lisp/cus-theme.el (customize-create-theme):
* lisp/dired-aux.el (dired-hide-all):
* lisp/emacs-lisp/crm.el (crm--choose-completion-string):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-revert):
* lisp/ido.el (ido-choose-completion-string):
* lisp/international/mule-diag.el (describe-font-internal):
* lisp/mail/sendmail.el (sendmail-user-agent-compose):
* lisp/progmodes/fortran.el (fortran-uncomment-region):
* lisp/progmodes/prolog.el (prolog-inferior-guess-flavor):
* lisp/progmodes/ruby-mode.el (ruby-indent-line, ruby-indent-exp):
* lisp/url/url.el (url-mm-callback):
* lisp/xwidget.el (xwidget-webkit-history-reload): Prepend an
underscore to unused function parameter names.
* lisp/emacs-lisp/cconv.el (cconv--dummy-var): Remove unused
constant.
* lisp/files.el (hack-local-variables-filter): Remove unused lexvar.
2022-10-26 16:35:59 +03:00
Philip Kaludercic
eaafc10f67
Add support for :release-rev in 'package-vc-archive-spec-alist'
* lisp/emacs-lisp/package-vc.el (package-vc-archive-spec-alist):
Update docstring.
(package-vc-install): Use :release-rev if invoked with a prefix argument.
2022-10-26 10:37:00 +02:00
Andrea Corallo
5ad5b797f7 Set `comp-no-spawn' earlier using -no-comp-spawn
* src/emacs.c (standard_args): Add '-no-comp-spawn' cmd line option.
* lisp/startup.el (command-line): Parse '-no-comp-spawn' cmd line
option.
* lisp/emacs-lisp/comp.el (comp-run-async-workers, comp-final):
Use '-no-comp-spawn'.
2022-10-26 08:30:09 +02:00
Stefan Monnier
1b1ffe0789 (Ffunction): Make interpreted closures safe for space
Interpreted closures currently just grab a reference to the complete
lexical environment, so (lambda (x) (+ x y)) can end up looking like

    (closure ((foo ...) (y 7) (bar ...) ...)
             (x) (+ x y))

where the foo/bar/... bindings are not only useless but can prevent
the GC from collecting that memory (i.e. it's a representation that is
not "safe for space") and it can also make that closure "unwritable"
(or more specifically, it can cause the closure's print
representation to be u`read`able).

Compiled closures don't suffer from this problem because `cconv.el`
actually looks at the code and only stores in the compiled closure
those variables which are actually used.

So, we fix this discrepancy by letting the existing code in `cconv.el` tell
`Ffunction` which variables are actually used by the body of the
function such that it can filter out the irrelevant elements and
return a closure of the form:

    (closure ((y 7)) (x) (+ x y))

* lisp/loadup.el: Preload `cconv` and set
`internal-filter-closure-env-function` once we have a usable `cconv-fv`.

* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): Adjust to new
calling convention of `cconv-closure-convert`.
(byte-compile-not-lexical-var-p): Delete function, moved to `cconv.el`.
(byte-compile-bind): Use `cconv--not-lexical-var-p`.

* lisp/emacs-lisp/cconv.el (cconv--dynbound-variables): New var.
(cconv-closure-convert): New arg `dynbound-vars`
(cconv--warn-unused-msg): Remove special case for `ignored`,
so we don't get confused when a function uses an argument called
`ignored`, e.g. holding a list of things that it should ignore.
(cconv--not-lexical-var-p): New function, moved from `bytecomp.el`.
Don't special case keywords and `nil` and `t` since they are already
`special-variable-p`.
(cconv--analyze-function): Use `cconv--not-lexical-var-p`.
(cconv--dynbindings): New dynbound var.
(cconv-analyze-form): Use `cconv--not-lexical-var-p`.
Remember in `cconv--dynbindings` the vars for which we used
dynamic scoping.
(cconv-analyze-form): Use `cconv--dynbound-variables` rather than
`byte-compile-bound-variables`.
(cconv-fv): New function.

* src/eval.c (Fsetq, eval_sub): Remove optimization designed when
`lexical-binding == nil` was the common case.
(Ffunction): Use `internal-filter-closure-env-function` when available.
(eval_sub, Ffuncall): Improve error info for `excessive_lisp_nesting`.
(internal-filter-closure-env-function): New defvar.
2022-10-25 14:24:54 -04:00
Juri Linkov
c06b5961ee * lisp/tab-bar.el: Use customizable button icons (bug#51309, bug#51648)
* lisp/tab-bar.el (tab-bar--load-buttons): Use 'define-icon' to
define icons for tab-bar-new, tab-bar-close, tab-bar-menu-bar.
Also set tab-bar-new-button, tab-bar-close-button, tab-bar-menu-bar-button
to the specified icon-string.
(tab-bar-history-mode): Use 'define-icon' to
define icons for tab-bar-back, tab-bar-forward.
Also set tab-bar-back-button, tab-bar-forward-button
to the specified icon-string.

* lisp/emacs-lisp/icons.el (icons--create)<image>: Allow to easy
add new image props by using 'apply' on them.  Add :margin.
2022-10-24 10:33:41 +03:00
Philip Kaludercic
8149fdd820
;Fix typo "pacakge" -> "package" 2022-10-23 18:46:25 +02:00
Philip Kaludercic
e31c84f4e7
Extract separate function 'package-vc-guess-backend'
* lisp/emacs-lisp/package-vc.el (package-vc-guess-backend): New
function.
(package-vc-unpack): Use it.
(package-vc-sourced-packages-list): Use it.
(package-vc-install): Use it.
2022-10-23 18:41:36 +02:00
Philip Kaludercic
a3cd8d43ae
;Fix typo "heusitic" -> "heuristic" 2022-10-23 18:38:12 +02:00
Philip Kaludercic
ca61e768d0
Use user option 'package-vc-default-backend' when cloning
* lisp/emacs-lisp/package-vc.el (package-vc-unpack): Respect
'package-vc-default-backend'.
2022-10-23 18:27:07 +02:00
Philip Kaludercic
85555ad3b7
; Require map only during compilation
As map is only used by 'pcase' during macro-expansion, it is not
necessary to load it all the time.
2022-10-23 18:20:30 +02:00
Philip Kaludercic
0e6452ccd7
; Update TODO list 2022-10-23 18:18:37 +02:00
Philip Kaludercic
2154219059
Immediately check out the right branch or revision
* lisp/emacs-lisp/package-vc.el (package-vc-unpack) Use REV to avoid
checking out the wrong branch/revision first.
* lisp/vc/vc-bzr.el: Handle REV.
* lisp/vc/vc-git.el: Handle REV.
* lisp/vc/vc-hg.el: Handle REV.
* lisp/vc/vc-svn.el: Handle REV.
* lisp/vc/vc.el: Make BACKEND optional and add REV.
2022-10-23 18:04:55 +02:00
Philip Kaludercic
a0532e148c
; Remove unnecessary "TODO"s from the package header 2022-10-23 13:15:28 +02:00
Philip Kaludercic
ab46a0df7b
; Remove unnecessary 'let' binding
* lisp/emacs-lisp/package-vc.el (pacakge-vc-desc->spec): Simplify function.
2022-10-23 13:07:48 +02:00
Philip Kaludercic
7640b0751b
Add auxiliary function to query package specifications
* lisp/emacs-lisp/package-vc.el (package-vc-query-spec): Add
inline function.
2022-10-23 13:02:25 +02:00
Basil L. Contovounesios
9da2efb670 Audit some plist uses with new predicate argument
* doc/lispref/lists.texi (Plist Access): Improve description of
default predicate.
* lisp/emacs-lisp/cl-extra.el (cl-getf, cl--set-getf): Assume
plist-member always returns a cons.
* lisp/emacs-lisp/gv.el (plist-get): Support new optional predicate
argument (bug#47425#91).
* lisp/emacs-lisp/map.el: Bump minor version.
(map--dispatch): Remove now that bug#58563 is fixed.  Break two
remaining uses out into corresponding cl-defmethods.
(map--plist-p): Add docstring.
(map--plist-has-predicate, map--plist-member-1, map--plist-member)
(map--plist-put-1, map--plist-put): New definitions for supporting
predicate argument backward compatibly.
(map-elt): Fix generalized variable getter under a
predicate (bug#58531).  Use predicate when given a plist.
(map-put): Avoid gratuitous warnings when called without the hidden
predicate argument.  Improve obsoletion message.
(map-put!): Use predicate when given a plist.
(map-contains-key): Ditto.  Declare forgotten
advertised-calling-convention (bug#58531#19).
(map--put): Group definition in file together with that of map-put!.
* lisp/files-x.el (connection-local-normalize-criteria): Simplify
using mapcan + plist-get.
* lisp/net/eudc.el (eudc--plist-member): New convenience function.
(eudc-plist-member, eudc-plist-get, eudc-lax-plist-get): Use it
instead of open-coding plist-member.
* src/fns.c (Fplist_get, plist_get, Fplist_put, plist_put): Pass the
plist element as the first argument to the predicate, for
consistency with assoc + alist-get.
(Fplist_member, plist_member): Move from widget to plist section.
Open-code the EQ case in plist_member, and call it from
Fplist_member in that case, rather than the other way around.

* test/lisp/apropos-tests.el (apropos-tests-format-plist): Avoid
polluting obarray.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-getf): Extend test with
generalized variables, degenerate plists, and improper lists.
* test/lisp/emacs-lisp/gv-tests.el: Byte-compile file; in the
meantime bug#24402 seems to have been fixed or worked around.
(gv-setter-edebug): Inhibit printing messages.
(gv-plist-get): Avoid modifying constant literals.  Also test with a
predicate argument.
* test/lisp/emacs-lisp/map-tests.el (with-maps-do): Simplify
docstring.
(test-map-elt-testfn): Rename...
(test-map-elt-testfn-alist): ...to this.  Also test with a predicate
argument.
(test-map-elt-testfn-plist, test-map-elt-gv, test-map-elt-signature)
(test-map-put!-plist, test-map-put!-signature)
(test-map-contains-key-signature, test-map-plist-member)
(test-map-plist-put): New tests.
(test-map-contains-key-testfn): Also test with a predicate argument.
(test-map-setf-alist-overwrite-key, test-map-setf-plist-insert-key)
(test-map-setf-plist-overwrite-key): Avoid modifying constant
literals.
(test-hash-table-setf-insert-key)
(test-hash-table-setf-overwrite-key): Fix indentation.
(test-setf-map-with-function): Make test more precise.
* test/lisp/net/eudc-tests.el: New file.
* test/lisp/subr-tests.el (test-plistp): Extend test with circular
list.
* test/src/fns-tests.el (test-cycle-equal, test-cycle-nconc): Move
from plist section to circular list section.
(plist-put/odd-number-of-elements): Avoid modifying constant
literals.
(plist-member/improper-list): Simplify.
(test-plist): Move to plist section.  Also test with a predicate
argument.
2022-10-22 19:33:12 +03:00
Philip Kaludercic
ab283bddb2
Request "elpa-packages.eld" instead of "elpa-packages"
* lisp/emacs-lisp/package-vc.el
(package-vc--read-archive-data): Apply change.
(package-vc--download-and-read-archives): Apply change.
2022-10-22 00:06:04 +02:00
Philip Kaludercic
5694278af3
Remove 'package-vc-install' alias 'package-checkout'
* lisp/emacs-lisp/package-vc.el (package-checkout): Remove it.
2022-10-21 20:39:33 +02:00
Nacho Barrientos
40a361fbd6 Bindat (src, strz): Operate on vectors too
Copyright-paperwork-exempt: yes

* lisp/emacs-lisp/bindat.el (bindat--unpack-str, bindat--unpack-strz):
Fix the non-string case.
* test/lisp/emacs-lisp/bindat-tests.el (bindat-test--strz-array-unpack)
(bindat-test--str-simple-array-unpack,bindat-test--str-combined-array-unpack):
New tests.
2022-10-21 11:26:36 -04:00
Eli Zaretskii
8ce2b89aa1 Improve and extend documentation of ElDoc
* lisp/emacs-lisp/eldoc.el (eldoc-documentation-strategy)
(eldoc-documentation-enthusiast)
(eldoc-documentation-compose-eagerly)
(eldoc-documentation-compose, eldoc-documentation-default)
(eldoc-minibuffer-message, eldoc-idle-delay)
(eldoc-print-after-edit)
(eldoc-echo-area-display-truncation-message)
(eldoc-echo-area-use-multiline-p)
(eldoc-echo-area-prefer-doc-buffer): Doc string fixes.

* doc/emacs/emacs.texi (Top):
* doc/emacs/programs.texi (Documentation, Programming Language Doc):
Rename "Lisp Doc" to "Programming Language Doc", including in
parent menus.  All references changed.
(Programming Language Doc): Formerly "Lisp Doc".  Rewrite to not
be specific to Emacs Lisp.  Improve markup and wording.  Document
more commands and variables.
* doc/emacs/maintaining.texi (Maintaining): Improve indexing.
2022-10-21 16:10:08 +03:00
Philip Kaludercic
faeb66ae42
Have 'package-vc-link-directory' use name if given
* lisp/emacs-lisp/package-vc.el (package-vc-link-directory): Use the
NAME argument.
2022-10-20 21:45:17 +02:00
Philip Kaludercic
2dabcba148
Build documentation like elpa-admin.el
* lisp/emacs-lisp/package-vc.el (package-vc-build-documentation): Add
function to build a documentation file.
(package-vc-unpack-1): Use 'package-vc-build-documentation'.
2022-10-20 21:34:48 +02:00
Philip Kaludercic
37bfb623e4
Merge remote-tracking branch 'origin/master' into feature/package+vc 2022-10-20 20:00:32 +02:00
Andrea Corallo
56c63ca21b * Fix async native compilation (bug#58637)
* lisp/emacs-lisp/comp.el (comp--native-compile): Fix gate condition.
(comp-run-async-workers): Add assetion.
2022-10-19 22:21:03 +02:00
Philip Kaludercic
e08e9bc40f
Remove modifications to the list of ignored files in source packages
* lisp/emacs-lisp/package-vc.el (package-vc-unpack-1): Remove
'vc-ignore' calls.
2022-10-18 22:44:35 +02:00
Philip Kaludercic
5d60ea47f6
Use 'elpa-packages' files for VC metadata
* lisp/emacs-lisp/package-vc.el (package-vc-default-backend): Add new
option.
(package-vc-archive-spec-alist): Add new variable to store the
contents of 'elpa-packages' for each archive.
(pacakge-vc-desc->spec): Add function to query package specifications.
(package-vc--read-archive-data): Add a 'package-read-archive-hook'
implementation.
(package-vc--download-and-read-archives): Add a
'package-refresh-contents-hook' implementation.
(package-vc-main-file): Remove function.
(package-vc-generate-description-file): Use package specifications.
(package-vc-unpack-1): Adapt to previous changes.
(package-vc-unpack): Adapt to previous changes.
(package-vc-sourced-packages-list): Adapt to previous changes.
(package-vc-install): Adapt to previous changes.
* lisp/emacs-lisp/package.el (package-read-archive-hook): Allow
extending 'package-read-all-archive-contents' using a hook.
(package-read-all-archive-contents): Use 'package-read-archive-hook'.
(package-refresh-contents-hook): Allow extending
'package-refresh-contents' using a hook.
(package-refresh-contents): Use 'package-refresh-contents-hook'.
2022-10-18 22:35:25 +02:00
Philip Kaludercic
65fa87329c
Merge remote-tracking branch 'origin/master' into feature/package+vc 2022-10-18 21:53:25 +02:00
Stefan Monnier
c5e2566774 (byte-compile--first-symbol-with-pos): Fix bug#58601
* lisp/emacs-lisp/bytecomp.el: Require `subr-x`.
(byte-compile--first-symbol-with-pos): Avoid inf-loops on circular data.
2022-10-18 10:49:43 -04:00
Lars Ingebrigtsen
6cabef8799 Fix previous loaddefs-gen fix 2022-10-18 13:17:52 +02:00