Commit graph

869 commits

Author SHA1 Message Date
Philip Kaludercic
9be140466a
Ensure package archives are loaded for 'package-isolate'
* lisp/emacs-lisp/package.el (package-isolate): Use
'package--archive-contents' instead of the actual variable, to
ensure that we load the archive contents if missing.  This is
likely the case if 'package-isolate' is the first package
function invoked during a session.
2026-05-03 20:25:53 +02:00
Stefan Monnier
e682959b6b (package--builtin-alist): Don't use defconst since we later change it
* lisp/emacs-lisp/package.el (package--builtin-alist): Use `defvar`.
2026-05-03 13:32:51 -04:00
Paul Eggert
4fcc8a473a ; Spelling fixes. 2026-04-29 22:45:51 -07:00
Philip Kaludercic
475bb02345
Do not regard selected packages as removable
* lisp/emacs-lisp/package.el (package--removable-packages):
Handle the fact that 'package--dependencies' doesn't return the
package itself as a dependency, so we have to check
'package-selected-packages' separately.  Also fix the way we
check the return value of 'package--dependencies', keeping in
mind that the value is an alist.  (Bug#80907)
2026-04-27 11:48:58 +02:00
Philip Kaludercic
89c6b632c4
Ensure that 'package--builtin-alist' can be populated
This is a partial reversion of 931e04a34b.

* lisp/emacs-lisp/package.el (package--builtin-alist): Add a
function that loads 'finder-inf', which in turn will populate
'package--builtins', if necessary, caching the result.
(package--upgradeable-packages, describe-package-1)
(package-menu--refresh, package--mapc, package-get-descriptor):
Use the function instead of the variable.
2026-04-27 11:48:58 +02:00
Philip Kaludercic
ec70112ac5
Use 'package-get-descriptor' in 'package--query-desc'
* lisp/emacs-lisp/package.el (package--query-desc): Replace
manual 'assoc' call.
2026-04-25 20:31:08 +02:00
Philip Kaludercic
ca2c477d01
Improve 'package-get-descriptor' performance
* lisp/emacs-lisp/package.el (package-get-descriptor): Use
'assq' to look up element in package alists instead of iterative
over them manually.  This was initially not possible, since we
merged all alists into one, which would require using a consing
function like 'map-merge-with' to look up all package descriptor
objects we want to consider in a single 'assq' call.  As we
ended up not merging lists, we can assume that there are no
duplicate keys in the alists, making the efficient 'assq'
viable.
2026-04-25 20:31:08 +02:00
Philip Kaludercic
d378e4355f
Prevent force reloading of package archive contents
* lisp/emacs-lisp/package.el (package--compatible-packages):
Drop 'package-read-all-archive-contents' call, as
'package--build-compatibility-table' will load the archive
contents on demand via 'package--mapc' anyway.  (Bug#80902)
2026-04-25 20:31:08 +02:00
Philip Kaludercic
931e04a34b
Replace 'package--builtin-alist' function with constant
* lisp/emacs-lisp/package.el (package--builtin-alist):
(package--upgradeable-packages, package--mapc)
(package-get-descriptor):
* lisp/emacs-lisp/package.el (package--builtin-alist): Replace
function with constant, as the result of the function is always
the same within an Emacs session, since the set of built-in
packages don't change during execution.
(package--upgradeable-packages, package--mapc)
(package-get-descriptor): Use variable instead of function.
(package-menu--refresh, describe-package-1): Lookup desc in
alist instead of calling 'package--from-builtin'.

(Bug#80902)
2026-04-25 20:31:08 +02:00
Philip Kaludercic
4acb0f775d
Restore previous 'package-get-descriptor' signature
* lisp/emacs-lisp/package.el (package-get-descriptor): Allow
SOURCES to not be specified for the sake of backwards
compatibility.
2026-04-25 20:29:53 +02:00
Philip Kaludercic
6a1c43fe62
; Add a comment to elaborate changes in 0051e2b7 2026-04-21 08:02:37 +02:00
Philip Kaludercic
789e98e54f
Extend utility of 'package-get-descriptor'
The general idea here is to make it easier to handle situations
where you might have a symbol designating a package name or a
'package-desc' object, but you really want the latter.

* lisp/emacs-lisp/package.el (package--get-deps): Remove
function superseded by 'package--dependencies'.
(package--builtin-alist, package--archive-contents): Add new
functions.
(package--removable-packages): Use 'package--dependencies'.
(package--dependencies): Check for circular dependencies.
(package-upgrade, package--upgradeable-packages)
(package--user-installed-p, package-reinstall, package-recompile)
(describe-package-1, package-desc-status, package--mapc)
(package-menu--find-upgrades): Use 'package-get-descriptor'.
(package-get-descriptor): Add optional arguments to allow for
different kinds of queries.

* lisp/emacs-lisp/package-vc.el
(package-vc-install-selected-packages)
(package-vc--generate-description-file)
(package-vc-install-dependencies, package-vc--read-package-desc)
(package-vc-install, package-vc-checkout): Use
'package-get-descriptor'.
2026-04-21 08:02:37 +02:00
Philip Kaludercic
0ed0ff69e5
; Fix cl-loop related typo from 27434c0f 2026-04-18 14:49:06 +02:00
Philip Kaludercic
0051e2b707
Suppress queries when installing package from file
* lisp/emacs-lisp/package.el (package-install-file): Assume it
is OK to set the visited file name, since we are not actually
touching anything on disk, and prevent the modified flag from
preventing us to kill the temporary buffer.  The flag is set by
tar-mode.
2026-04-18 14:29:07 +02:00
Philip Kaludercic
27434c0f9d
Use git-diff(1) in 'package-review-diff-command' if available
* lisp/emacs-lisp/package.el (package--review-git-diff-command):
Add new constant to avoid duplicating the exact command as the
default value and in the type of the user option.
(package-review-diff-command): Use git-diff(1) if Git is
installed, and fall back to regular diff(1) otherwise.  The
previous default value has been moved to the user option, as a
suggested alternative.
(package-review): Support the ability to use symbols, that get
replaced and expanded into the list of switches.

(Bug#80684)

Co-Authored-By: Daniel Mendler <mail@daniel-mendler.de>
2026-04-18 14:29:07 +02:00
Philip Kaludercic
c4902924b6
; Add missing docstring for 'package-matches-selector-p'
* lisp/emacs-lisp/package.el (package-matches-selector-p): New
docstring based on 'package-review-policy'.
2026-04-18 14:29:07 +02:00
Philip Kaludercic
be2b4a9831
Clean up 'Info-directory-list' after deleting package
* lisp/emacs-lisp/package.el (package--delete-directory): Remove
manual before physically deleting the package.  (Bug#80776)
2026-04-12 13:10:57 +02:00
Philip Kaludercic
b6e7c7d43b
Add face for obsolete packages in package menu
* lisp/emacs-lisp/package.el (package-status-obsolete): New face.
(package-menu-status-faces): Use new face instead of hard-coding
a font-lock face.
2026-04-12 12:37:17 +02:00
Philip Kaludercic
5589d44ce6
; Use 'ensure-proper-list' to get uniform maintainer lists
* lisp/emacs-lisp/package.el (describe-package-1)
(package-maintainers): Remove manual checks that :maintainer is
not just a cons-cell.
2026-04-05 18:29:12 +02:00
Philip Kaludercic
4473f76261
Mention package version in 'package-autoremove' prompt
* lisp/emacs-lisp/package.el (package--removable-packages):
Return package descriptors instead of names.
(package-autoremove): Adapt code to handle package descriptors
instead of names.
2026-04-05 18:29:12 +02:00
Philip Kaludercic
418319c155
; Use lookup table for package menu faces
* lisp/emacs-lisp/package.el (package-menu-status-faces): Add
new constant.
(package-menu--print-info-simple): Replace 'pcase' form with
'alist-get', which is my measurements is slightly faster.
2026-04-05 18:29:12 +02:00
Eli Zaretskii
0a62e6c304 ; Fix documentation of last change
* lisp/emacs-lisp/package.el (package--compatible-packages): Doc
fix.

* etc/NEWS: Improve and expand wording in the new entry.
(Bug#80695)
2026-04-05 07:33:14 +03:00
Philip Kaludercic
0bfdb068f2
List recursive dependencies in the package description
* lisp/emacs-lisp/package.el (describe-package-1): List and
indicate if a package will require a recursive dependency.
2026-04-04 23:07:20 +02:00
Philip Kaludercic
6a15c02a59
Recursively check dependencies for package compatibility
* lisp/emacs-lisp/package.el (package--compatible-packages): Add
new function.
(package-install): Use new function to restrict suggestions to
not include incompatible packages.
(package--incompatible-p): Check all dependencies to determine
package compatibility.
* etc/NEWS: Mention change.  (Bug#80695)
2026-04-04 23:07:20 +02:00
Philip Kaludercic
4e65e05ea4
Adjust return format of 'package--dependencies'
* lisp/emacs-lisp/package.el (package--dependencies): Return
required dependency version along with every dependency.
(package-menu--list-to-prompt): Discard required versions.
2026-04-04 23:07:20 +02:00
Tassilo Horn
8ae0877416 Fix wrong-type-argument error in package-upgrade
* lisp/emacs-lisp/package.el (package-upgrade): Fix wrong-type-argument
error when upgrading a builtin package (bug#80633).
2026-03-21 07:15:35 +01:00
Stefan Monnier
e2004eb56f Merge remote-tracking branch 'origin/scratch/error-API' 2026-03-15 17:17:21 -04:00
Philip Kaludercic
8bf0981452
; Fix bug in 'package-maintainers'
* lisp/emacs-lisp/package.el (package-maintainers): Detect if
:maintainers contains on a single cons-cell, denoting a single
maintainer, in which case we wrap it in a singleton list.
2026-03-12 08:56:45 +01:00
Stefan Monnier
9348c19b82 Use single-arg form of signal to re-throw an error
* lisp/vc/smerge-mode.el (smerge-extend):
* lisp/vc/diff-mode.el (diff-beginning-of-file-and-junk):
* lisp/transient.el (transient--with-emergency-exit):
* lisp/textmodes/tex-mode.el (latex-forward-sexp):
* lisp/tar-mode.el (tar-mode):
* lisp/savehist.el (savehist--reload):
* lisp/progmodes/octave.el (inferior-octave-resync-dirs):
* lisp/progmodes/js.el (js--re-search-forward):
* lisp/plstore.el (plstore--decrypt):
* lisp/net/dbus.el (dbus-ignore-errors, dbus-register-signal)
(dbus-handle-event):
* lisp/mouse.el (mouse-drag-track, mouse-drag-region-rectangle):
* lisp/minibuffer.el (completion-pcm--find-all-completions):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2047.el (rfc2047-encode-region):
* lisp/jit-lock.el (jit-lock-fontify-now):
* lisp/international/ja-dic-utl.el (skkdic-lookup-key):
* lisp/gnus/nnselect.el (nnselect-generate-artlist):
* lisp/gnus/mml-sec.el (mml-secure-epg-encrypt, mml-secure-epg-sign):
* lisp/gnus/mail-source.el (mail-source-fetch-pop)
(mail-source-check-pop):
* lisp/gnus/gnus-art.el (gnus-article-read-summary-keys):
* lisp/files.el (basic-save-buffer-2, files--ensure-directory)
(files--force, copy-directory):
* lisp/eshell/esh-io.el (eshell-output-object-to-target):
* lisp/epa.el (epa-decrypt-file, epa-verify-file, epa-sign-file)
(epa-encrypt-file, epa-decrypt-region, epa-verify-region)
(epa-sign-region, epa-encrypt-region, epa-delete-keys)
(epa-export-keys, epa-insert-keys):
* lisp/emacs-lisp/package.el (package--unless-error):
* lisp/emacs-lisp/multisession.el (multisession--read-file-value):
* lisp/emacs-lisp/lisp.el (up-list-default-function):
* lisp/desktop.el (desktop-kill):
* lisp/calendar/time-date.el (date-to-time):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calc/calc.el (calc-do):
* lisp/bookmark.el (bookmark-handle-bookmark):
* src/fileio.c (report_file_errno):
* lisp/vc/vc.el (vc-checkout, vc-pull): Use `(signal err)` instead
of `(signal (car err) (cdr err))`.
2026-03-10 10:48:22 -04:00
Philip Kaludercic
91c8c0cc98
Fix prompting of packages for 'package-report-bug'
* lisp/emacs-lisp/package.el (package--query-desc): Load
'package-alist' if this hasn't already occurred.
(package-report-bug): Drop unnecessary ALIST argument when
invoking 'package--query-desc'.
2026-02-28 10:50:55 +01:00
Philip Kaludercic
4b253c39b1
Improve 'package-report-bug' robustness
* lisp/emacs-lisp/package.el (package-maintainers): Add
fallbacks if a package doesn't list a single maintainer.
(package-report-bug): Check if "emacs-devel@gnu.org" is listed
as a maintainer, in which case the message is redirected to
bug-gnu-emacs@gnu.org and the X-Debbugs-CC header is set.

(Bug#80478)
2026-02-28 10:50:55 +01:00
Philip Kaludercic
668c42c4ac
Allow more fine configuration of package retention
* lisp/emacs-lisp/package.el (package-upgrade-keep-previous):
Rename user option to 'package-retention-policy'.
(package--policy-type): New constant for policy types.
(package-retention-policy): New option.
(package-review-policy): Use new type constant.
(package--review-p): Rename and generalise to
'package-matches-selector-p'.
(package-matches-selector-p): New function.
(package-upgrade, package-menu--mark-upgrades-1): Respect
'package-retention-policy'.
* doc/emacs/package.texi (Package Installation): Document new option.
* etc/NEWS: Update NEWS entry.  (Bug#79957)
2026-02-28 10:50:55 +01:00
Philip Kaludercic
e744e8a7a7
Indicate if 'package-isolate' had to download a package
* lisp/emacs-lisp/package.el (package-isolate): Change
formatting to indicate dependencies to include a note if the
package was downloaded in a temporary directory.
2026-02-28 10:50:55 +01:00
Philip Kaludercic
356d74b943
Fix 'package-isolate' in combination with quickload
* lisp/emacs-lisp/package.el (package-isolate): Call
'package--activate-all' directly, to ensure that all the package
directories are properly loaded.
2026-02-28 10:50:55 +01:00
Philip Kaludercic
33c63d24de
; Prevent 'package-isolate' from creating cyclic lists
* lisp/emacs-lisp/package.el (package-isolate): Do not use
destructive 'mapcan' to create a list of dependencies, as
'package-desc-reqs' doesn't return a fresh list.
2026-02-28 10:50:55 +01:00
Jeremy Bryant
0ca7040096
Add option to keep previous package versions on upgrade
This change adds a conditional to keep old package versions on upgrade.
This allows users to keep running multiple Emacsen without a package
upgrade in one Emacs breaking another running Emacs.

* lisp/emacs-lisp/package.el (package-upgrade-keep-previous):
New boolean user option.
(package-upgrade): Use it.
(package-menu--mark-upgrades-1): Use it.
(package-menu--find-upgrades): Make consistent with new option.
* etc/NEWS: Announce it.

(Bug#79957)
2026-02-28 10:50:55 +01:00
Philip Kaludercic
ee7c4ed5d8
Don't invoke Dired with -R when reviewing packages
* lisp/emacs-lisp/package.el (package-review): Remove
potentially unportable "-R" switch when calling 'dired'.
2026-02-14 16:29:33 +01:00
Philip Kaludercic
36f35a774b
; Remove 'package-vc-version' declaration 2026-02-14 16:29:33 +01:00
Philip Kaludercic
49c8dd44af
; Remove unnecessary 'inline' require from package.el
* lisp/emacs-lisp/package-activate.el (package-vc-p): Define
using a regular 'defun'.
2026-02-14 16:29:33 +01:00
Philip Kaludercic
d734b240fb
Do not upgrade VC packages using 'package-upgrade'
* lisp/emacs-lisp/package.el (package-upgrade): Trigger error
redirecting user to use 'package-vc-upgrade'.
(package--upgradeable-packages): Exclude VC packages from list
of "upgradable" packages.
2026-02-14 16:29:32 +01:00
Philip Kaludercic
52b24ed7aa
Only check regular files for package metadata
* lisp/emacs-lisp/package.el (package-dir-info): Do not check
files that do not satisfy 'file-regular-p' when trying to find
the file with the package metadata.  (Bug#79742)
2026-02-13 22:47:59 +01:00
Philip Kaludercic
567155047c
Improve 'package-upgrade-all' robustness
* lisp/emacs-lisp/package.el (package-upgrade-all): Do not quit
because a single upgrade fails with an error.  (Bug#80357)
2026-02-13 22:23:01 +01:00
Philip Kaludercic
7470151179
Autoload 'diff-no-select'
* lisp/emacs-lisp/package.el (package-review): Remove
unnecessary 'require'.
* lisp/eshell/em-unix.el: Remove declaration.
* lisp/files.el (save-some-buffers-action-alist): Remove
unnecessary 'require'.
* lisp/vc/diff.el (diff-no-select): Autoload it.

(Bug#80288)
2026-02-13 19:53:12 +01:00
Eli Zaretskii
48525f500e ; Improve documentation of 'package-autosuggest-mode'
* lisp/emacs-lisp/package.el (package--autosuggest-install-and-enable)
(package--autosugest-prompt, package-autosuggest): Doc fixes.
* lisp/emacs-lisp/package-activate.el (package-autosuggest-style)
(package-autosuggest-once, package-autosuggest-mode)
(package--suggestion-applies-p)
(package--autosuggest-find-candidates)
(package--autosugest-line-format)
(package--autosuggest-after-change-mode): Fix doc strings and add
:version tags.

* etc/NEWS (bindings):
* doc/emacs/package.texi (Package Installation): Improve wording,
markup and indexing.
2026-02-13 09:39:02 +02:00
Philip Kaludercic
1b02bf1214
Ensure package contents for package suggestions
* lisp/emacs-lisp/package.el (package--autosugest-prompt): Query
archives if the package being described is not listed in
package-archive-contents'.
2026-02-12 18:24:47 +01:00
Philip Kaludercic
ae5ee77f48
Enable fewer minor modes in package suggestion buffers
* lisp/emacs-lisp/package.el (package--autosugest-prompt): Do
not enable 'enriched-mode' and 'variable-pitch-mode'.
2026-02-09 21:22:37 +01:00
Philip Kaludercic
1aabe135e6
; Fix partial revert from c31e7ef4d5
* lisp/emacs-lisp/package.el (package-autosuggest-style)
(package-autosuggest-mode, package--autosuggest-suggested)
(package--suggestion-applies-p, package--autosuggest-database)
(package--autosuggest-find-candidates)
(package--autosugest-line-format, package-autosuggest-face)
(package--autosuggest-after-change-mode, package-autosuggest):
Remove definitions that were kept in package-activate.el.
2026-02-07 11:02:19 +01:00
Philip Kaludercic
c31e7ef4d5
Revert "Enable 'package-autosuggest-mode' at startup"
This reverts commit ae67318362.
2026-02-07 10:39:18 +01:00
Philip Kaludercic
6314c08c6b
Link to "Major Mode" node in manual when suggesting packges
* lisp/emacs-lisp/package.el (package--autosugest-prompt): Add
another button.
2026-02-06 22:37:06 +01:00
Philip Kaludercic
ae67318362
Enable 'package-autosuggest-mode' at startup
* lisp/emacs-lisp/package.el (package-autosuggest-style)
(package-autosuggest-mode, package--autosuggest-suggested)
(package--suggestion-applies-p, package--autosuggest-database)
(package--autosuggest-find-candidates)
(package--autosugest-line-format, package-autosuggest-face)
(package--autosuggest-after-change-mode, package-autosuggest):
Remove definitions needed to recognise suggestions from here.

* lisp/emacs-lisp/package-activate.el (package-autosuggest-style)
(package--autosuggest-database, package--autosuggest-suggested)
(package--suggestion-applies-p)
(package--autosuggest-find-candidates)
(package--autosugest-line-format, package-autosuggest)
(package--autosuggest-after-change-mode)
(package-autosuggest-mode): Move definitions from package.el.

(package--activated, package-installed-p, package-get-version)
(package-activate-all, package-activate-all): Remove unnecessary
autoloads.

* lisp/loadup.el: Load "package-activate.el".
2026-02-06 21:15:29 +01:00