From 04c4c578c71cae77b3b782497808bb2321da3be1 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 14 Feb 2022 12:45:17 +0100 Subject: Allow for packages to be installed directly from VCS Packages installed via package-fetch are of the kind 'source, and their extra properties may include a :upstream key (a list consisting of the VC backend, a remote repository, a branch and a path within the repository) and :rev key (indicating a specific revision to checkout). * package.el (package-devel-dir): Add new option. (package-desc): Allow an empty version string to be passed to package-desc-from-define. (package-desc-full-name): Handle source packages. (vc-working-revision): Declare function for package-devel-commit. (package-devel-commit): Add function. (package-load-descriptor): Detect and handle source packages. (package-load-all-descriptors): Use package-devel-dir. (vc-clone): Declare function for package-unpack. (package-unpack): Handle source packages. (package-generate-description-file): Handle source packages by ommiting a version number. (package-install-from-archive): Check if a package is a source package. (package-fetch): Add new command (package-desc-status): Check for source packages. (package--remove-hidden): Hide regular packages from the package list if a source package was installed. (package-status-from-source): Add new face. (package-menu--print-info-simple): Handle source packages. (package-menu-mark-delete): Allow deleting source packages. (package-menu--status-predicate): Sort source packages after dependencies but before unsigned packages. (package-menu-filter-by-status): Allow filtering by source packages. --- lisp/emacs-lisp/package.el | 261 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 202 insertions(+), 59 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6aa82e576d9..c3f6174c19a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -303,6 +303,17 @@ packages in `package-directory-list'." :risky t :version "24.1") +(defcustom package-devel-dir (expand-file-name "devel" package-user-dir) + "Directory containing the user's Emacs Lisp package checkouts. +The directory name should be absolute. +Apart from this directory, Emacs also looks for system-wide +packages in `package-directory-list'." + :type 'directory + :initialize #'custom-initialize-delay + :set-after '(package-user-dir) + :risky t + :version "29.1") + ;;;###autoload (defcustom package-directory-list ;; Defaults are subdirs named "elpa" in the site-lisp dirs. @@ -459,7 +470,7 @@ synchronously." &rest rest-plist &aux (name (intern name-string)) - (version (version-to-list version-string)) + (version (and version-string (version-to-list version-string))) (reqs (mapcar (lambda (elt) (list (car elt) (version-to-list (cadr elt)))) @@ -560,7 +571,9 @@ This is, approximately, the inverse of `version-to-list'. This is the name of the package with its version appended." (format "%s-%s" (package-desc-name pkg-desc) - (package-version-join (package-desc-version pkg-desc)))) + (if (eq (package-desc-kind pkg-desc) 'source) + "devel" + (package-version-join (package-desc-version pkg-desc))))) (defun package-desc-suffix (pkg-desc) "Return file-name extension of package-desc object PKG-DESC. @@ -666,6 +679,16 @@ are sorted with the highest version first." nil))) new-pkg-desc))) +(declare-function vc-working-revision "vc" (file &optional backend)) +(defun package-devel-commit (pkg) + "Extract the commit of a development package PKG." + (cl-assert (eq (package-desc-kind pkg) 'source)) + (require 'vc) + (cl-loop with dir = (package-desc-dir pkg) + for file in (directory-files dir t "\\.el\\'" t) + when (vc-working-revision file) return it + finally return "unknown")) + (defun package-load-descriptor (pkg-dir) "Load the package description file in directory PKG-DIR. Create a new `package-desc' object, add it to `package-alist' and @@ -681,6 +704,14 @@ return it." (read (current-buffer))) (error "Can't find define-package in %s" pkg-file)))) (setf (package-desc-dir pkg-desc) pkg-dir) + (when (file-exists-p (expand-file-name + (symbol-name (package-desc-name pkg-desc)) + package-devel-dir)) + ;; XXX: This check seems dirty, there should be a better + ;; way to deduce if a package is in the devel directory. + (setf (package-desc-kind pkg-desc) 'source) + (push (cons :commit (package-devel-commit pkg-desc)) + (package-desc-extras pkg-desc))) (if (file-exists-p signed-file) (setf (package-desc-signed pkg-desc) t)) pkg-desc))))) @@ -694,13 +725,13 @@ controls which package subdirectories may be loaded. In each valid package subdirectory, this function loads the description file containing a call to `define-package', which updates `package-alist'." - (dolist (dir (cons package-user-dir package-directory-list)) + (dolist (dir (cl-list* package-user-dir + package-devel-dir + package-directory-list)) (when (file-directory-p dir) - (dolist (subdir (directory-files dir)) - (unless (equal subdir "..") - (let ((pkg-dir (expand-file-name subdir dir))) - (when (file-directory-p pkg-dir) - (package-load-descriptor pkg-dir)))))))) + (dolist (pkg-dir (directory-files dir t "^[^.]" t)) + (when (file-directory-p pkg-dir) + (package-load-descriptor pkg-dir)))))) (defun package--alist () "Return `package-alist', after computing it if needed." @@ -916,12 +947,51 @@ untar into a directory named DIR; otherwise, signal an error." (apply #'nconc (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist)))) +(declare-function vc-clone "vc" (backend remote &optional directory)) + (defun package-unpack (pkg-desc) "Install the contents of the current buffer as a package." (let* ((name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) (pkg-dir (expand-file-name dirname package-user-dir))) (pcase (package-desc-kind pkg-desc) + ('source + (setq pkg-dir (expand-file-name (symbol-name name) package-devel-dir)) + (when (file-exists-p pkg-dir) + (if (and (called-interactively-p 'interactive) + (yes-or-no-p "Overwrite previous checkout?")) + (delete-directory pkg-dir t) + (error "There already exists a checkout for %s" name))) + (pcase-let* ((attr (package-desc-extras pkg-desc)) + (`(,backend ,repo ,dir ,branch) + (or (alist-get :upstream attr) + (error "Source package has no repository")))) + (require 'vc) + (make-directory (file-name-directory (file-name-directory pkg-dir)) t) + (unless (setf (car (alist-get :upstream attr)) + (vc-clone backend repo pkg-dir)) + (error "Failed to clone %s from %s" name repo)) + (when-let ((rev (or (alist-get :rev attr) branch))) + (vc-retrieve-tag pkg-dir rev)) + (when dir (setq pkg-dir (file-name-concat pkg-dir dir))) + ;; In case the package was installed directly from source, the + ;; dependency list wasn't know beforehand, and they might have + ;; to be installed explicitly. + (let (deps) + (dolist (file (directory-files pkg-dir t "\\.el\\'" t)) + (with-temp-buffer + (insert-file-contents file) + (when-let* ((require-lines (lm-header-multiline "package-requires"))) + (thread-last + (mapconcat #'identity require-lines " ") + package-read-from-string + package--prepare-dependencies + (nconc deps) + (setq deps))))) + (dolist (dep deps) + (cl-callf version-to-list (cadr dep))) + (package-download-transaction + (package-compute-transaction nil (delete-dups deps)))))) ('dir (make-directory pkg-dir t) (let ((file-list @@ -935,7 +1005,7 @@ untar into a directory named DIR; otherwise, signal an error." ;; indistinguishable from a `tar' or a `single'. Let's make ;; things simple by ensuring we're one of them. (setf (package-desc-kind pkg-desc) - (if (> (length file-list) 1) 'tar 'single)))) + (if (length> file-list 1) 'tar 'single)))) ('tar (make-directory package-user-dir t) (let* ((default-directory (file-name-as-directory package-user-dir))) @@ -948,8 +1018,9 @@ untar into a directory named DIR; otherwise, signal an error." (package--make-autoloads-and-stuff pkg-desc pkg-dir) ;; Update package-alist. (let ((new-desc (package-load-descriptor pkg-dir))) - (unless (equal (package-desc-full-name new-desc) - (package-desc-full-name pkg-desc)) + (unless (or (equal (package-desc-full-name new-desc) + (package-desc-full-name pkg-desc)) + (eq (package-desc-kind pkg-desc) 'source)) (error "The retrieved package (`%s') doesn't match what the archive offered (`%s')" (package-desc-full-name new-desc) (package-desc-full-name pkg-desc))) ;; Activation has to be done before compilation, so that if we're @@ -983,7 +1054,8 @@ untar into a directory named DIR; otherwise, signal an error." (nconc (list 'define-package (symbol-name name) - (package-version-join (package-desc-version pkg-desc)) + (and (not (eq (package-desc-kind pkg-desc) 'source)) + (package-version-join (package-desc-version pkg-desc))) (package-desc-summary pkg-desc) (let ((requires (package-desc-reqs pkg-desc))) (list 'quote @@ -1995,50 +2067,52 @@ if all the in-between dependencies are also in PACKAGE-LIST." (cdr (assoc (package-desc-archive desc) package-archives))) (defun package-install-from-archive (pkg-desc) - "Download and install a tar package defined by PKG-DESC." + "Download and install a package defined by PKG-DESC." ;; This won't happen, unless the archive is doing something wrong. (when (eq (package-desc-kind pkg-desc) 'dir) (error "Can't install directory package from archive")) - (let* ((location (package-archive-base pkg-desc)) - (file (concat (package-desc-full-name pkg-desc) - (package-desc-suffix pkg-desc)))) - (package--with-response-buffer location :file file - (if (or (not (package-check-signature)) - (member (package-desc-archive pkg-desc) - package-unsigned-archives)) - ;; If we don't care about the signature, unpack and we're - ;; done. - (let ((save-silently t)) - (package-unpack pkg-desc)) - ;; If we care, check it and *then* write the file. - (let ((content (buffer-string))) - (package--check-signature - location file content nil - ;; This function will be called after signature checking. - (lambda (&optional good-sigs) - ;; Signature checked, unpack now. - (with-temp-buffer ;FIXME: Just use the previous current-buffer. - (set-buffer-multibyte nil) - (cl-assert (not (multibyte-string-p content))) - (insert content) - (let ((save-silently t)) - (package-unpack pkg-desc))) - ;; Here the package has been installed successfully, mark it as - ;; signed if appropriate. - (when good-sigs - ;; Write out good signatures into NAME-VERSION.signed file. - (write-region (mapconcat #'epg-signature-to-string good-sigs "\n") - nil - (expand-file-name - (concat (package-desc-full-name pkg-desc) ".signed") - package-user-dir) - nil 'silent) - ;; Update the old pkg-desc which will be shown on the description buffer. - (setf (package-desc-signed pkg-desc) t) - ;; Update the new (activated) pkg-desc as well. - (when-let* ((pkg-descs (cdr (assq (package-desc-name pkg-desc) - package-alist)))) - (setf (package-desc-signed (car pkg-descs)) t)))))))))) + (if (eq (package-desc-kind pkg-desc) 'source) + (package-unpack pkg-desc) + (let* ((location (package-archive-base pkg-desc)) + (file (concat (package-desc-full-name pkg-desc) + (package-desc-suffix pkg-desc)))) + (package--with-response-buffer location :file file + (if (or (not (package-check-signature)) + (member (package-desc-archive pkg-desc) + package-unsigned-archives)) + ;; If we don't care about the signature, unpack and we're + ;; done. + (let ((save-silently t)) + (package-unpack pkg-desc)) + ;; If we care, check it and *then* write the file. + (let ((content (buffer-string))) + (package--check-signature + location file content nil + ;; This function will be called after signature checking. + (lambda (&optional good-sigs) + ;; Signature checked, unpack now. + (with-temp-buffer ;FIXME: Just use the previous current-buffer. + (set-buffer-multibyte nil) + (cl-assert (not (multibyte-string-p content))) + (insert content) + (let ((save-silently t)) + (package-unpack pkg-desc))) + ;; Here the package has been installed successfully, mark it as + ;; signed if appropriate. + (when good-sigs + ;; Write out good signatures into NAME-VERSION.signed file. + (write-region (mapconcat #'epg-signature-to-string good-sigs "\n") + nil + (expand-file-name + (concat (package-desc-full-name pkg-desc) ".signed") + package-user-dir) + nil 'silent) + ;; Update the old pkg-desc which will be shown on the description buffer. + (setf (package-desc-signed pkg-desc) t) + ;; Update the new (activated) pkg-desc as well. + (when-let* ((pkg-descs (cdr (assq (package-desc-name pkg-desc) + package-alist)))) + (setf (package-desc-signed (car pkg-descs)) t))))))))))) ;;;###autoload (defun package-installed-p (package &optional min-version) @@ -2132,6 +2206,61 @@ to install it but still mark it as selected." (message "Package `%s' installed." name)) (message "`%s' is already installed" name)))) +;;;###autoload +(defun package-fetch (name-or-url &optional name rev) + "Fetch the source of NAME-OR-URL. +If NAME-OR-URL is a URL, then the package will be downloaded from +the repository indicated by the URL. The function will try to +guess the name of the package using `file-name-base'. This can +be overridden by manually passing the optional NAME. Otherwise +NAME-OR-URL is taken to be a package name, and the package +metadata will be consulted for the URL. An explicit revision can +be requested using REV." + (interactive + (progn + ;; Initialize the package system to get the list of package + ;; symbols for completion. + (package--archives-initialize) + (let* ((input (completing-read + "Fetch package source (name or URL): " + package-archive-contents)) + (name (file-name-base input))) + (list input (intern (string-remove-prefix "emacs-" name)))))) + (package--archives-initialize) + (package-install + (cond + ((and (stringp name-or-url) + (url-type (url-generic-parse-url name-or-url))) + (package-desc-create + :name (or name (intern (file-name-base name-or-url))) + :kind 'source + :extras `((:upstream . ,(list nil name-or-url nil nil)) + (:rev . ,rev)))) + ((when-let* ((desc (cadr (assoc name-or-url package-archive-contents + #'string=))) + (spec (or (alist-get :vc (package-desc-extras desc)) + (user-error "Package has no VC header")))) + (unless (string-match + (rx bos + (group (+ alnum)) + (+ blank) (group (+ (not blank))) + (? (+ blank) (group (+ (not blank))) + (? (+ blank) (group (+ (not blank))))) + eos) + spec) + (user-error "Invalid repository specification %S" spec)) + (package-desc-create + :name (if (stringp name-or-url) + (intern name-or-url) + name-or-url) + :kind 'source + :extras `((:upstream . ,(list (intern (match-string 1 spec)) + (match-string 2 spec) + (match-string 3 spec) + (match-string 4 spec))) + (:rev . ,rev))))) + ((user-error "Unknown package to fetch: %s" name-or-url))))) + (defun package-strip-rcs-id (str) "Strip RCS version ID from the version string STR. If the result looks like a dotted numeric version, return it. @@ -2940,6 +3069,7 @@ of these dependencies, similar to the list returned by (signed (or (not package-list-unsigned) (package-desc-signed pkg-desc)))) (cond + ((eq (package-desc-kind pkg-desc) 'source) "source") ((eq dir 'builtin) "built-in") ((and lle (null held)) "disabled") ((stringp held) @@ -3028,8 +3158,9 @@ to their archives." (if (not installed) filtered-by-priority (let ((ins-version (package-desc-version installed))) - (cl-remove-if (lambda (p) (version-list-= (package-desc-version p) - ins-version)) + (cl-remove-if (lambda (p) (or (version-list-= (package-desc-version p) + ins-version) + (eq (package-desc-kind installed) 'source))) filtered-by-priority)))))))) (defcustom package-hidden-regexps nil @@ -3231,6 +3362,11 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." "Face used on the status and version of installed packages." :version "25.1") +(defface package-status-from-source + '((t :inherit font-lock-negation-char-face)) + "Face used on the status and version of installed packages." + :version "29.1") + (defface package-status-dependency '((t :inherit package-status-installed)) "Face used on the status and version of dependency packages." @@ -3268,6 +3404,7 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." ("held" 'package-status-held) ("disabled" 'package-status-disabled) ("installed" 'package-status-installed) + ("source" 'package-status-from-source) ("dependency" 'package-status-dependency) ("unsigned" 'package-status-unsigned) ("incompat" 'package-status-incompat) @@ -3279,9 +3416,12 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." follow-link t package-desc ,pkg action package-menu-describe-package) - ,(propertize (package-version-join - (package-desc-version pkg)) - 'font-lock-face face) + ,(propertize + (if (eq (package-desc-kind pkg) 'source) + (package-devel-commit pkg) + (package-version-join + (package-desc-version pkg))) + 'font-lock-face face) ,(propertize status 'font-lock-face face) ,@(if (cdr package-archives) (list (propertize (or (package-desc-archive pkg) "") @@ -3356,7 +3496,7 @@ If optional arg BUTTON is non-nil, describe its associated package." (interactive "p" package-menu-mode) (package--ensure-package-menu-mode) (if (member (package-menu-get-status) - '("installed" "dependency" "obsolete" "unsigned")) + '("installed" "source" "dependency" "obsolete" "unsigned")) (tabulated-list-put-tag "D" t) (forward-line))) @@ -3674,6 +3814,8 @@ This is used for `tabulated-list-format' in `package-menu-mode'." ((string= sB "installed") nil) ((string= sA "dependency") t) ((string= sB "dependency") nil) + ((string= sA "source") t) + ((string= sB "source") nil) ((string= sA "unsigned") t) ((string= sB "unsigned") nil) ((string= sA "held") t) @@ -3969,6 +4111,7 @@ packages." "held" "incompat" "installed" + "source" "new" "unsigned"))) package-menu-mode) -- cgit v1.2.3 From edd73bd0d5474b71cbd4261c6a722be8f652bb9a Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 14 Feb 2022 13:47:31 +0100 Subject: Add command to contact maintainer * package.el (package-menu-mode-map): Add package-contact-maintainer. (package--query-desc): Extract a common utility function. (package-browse-url): Use package--query-desc. (package-contact-maintainer): Add command. --- lisp/emacs-lisp/package.el | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index c3f6174c19a..58fc55da124 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2917,6 +2917,7 @@ either a full name or nil, and EMAIL is a valid email address." "r" #'revert-buffer "~" #'package-menu-mark-obsolete-for-deletion "w" #'package-browse-url + "m" #'package-contact-maintainer "x" #'package-menu-execute "h" #'package-menu-quick-help "H" #'package-menu-hide-package @@ -4378,11 +4379,22 @@ beginning of the line." (package-version-join (package-desc-version package-desc)) (package-desc-summary package-desc)))) +(defun package--query-desc (&optional alist) + "Query the user for a package or return the package at point. +The optional argument ALIST must consist of elements with the +form (PKG-NAME PKG-DESC). If not specified, it will default to +`package-alist'." + (or (tabulated-list-get-id) + (let ((alist (or alist package-alist))) + (cadr (assoc (completing-read "Package: " alist nil t) + alist #'string=))))) + (defun package-browse-url (desc &optional secondary) "Open the website of the package under point in a browser. -`browse-url' is used to determine the browser to be used. -If SECONDARY (interactively, the prefix), use the secondary browser." - (interactive (list (tabulated-list-get-id) +`browse-url' is used to determine the browser to be used. If +SECONDARY (interactively, the prefix), use the secondary browser. +DESC must be a `package-desc' object." + (interactive (list (package--query-desc) current-prefix-arg) package-menu-mode) (unless desc @@ -4394,6 +4406,28 @@ If SECONDARY (interactively, the prefix), use the secondary browser." (funcall browse-url-secondary-browser-function url) (browse-url url)))) +;; TODO: Allow attaching a patch to send directly to the maintainer. +;; Ideally this should be able to detect the local changes, convert +;; these into patches. +(defun package-contact-maintainer (desc) + "Prepare a message to send to the maintainers of a package. +DESC must be a `package-desc' object." + (interactive (list (package--query-desc package-archive-contents)) + package-menu-mode) + (unless desc + (user-error "No package here")) + (let* ((extras (package-desc-extras desc)) + (maint (alist-get :maintainer extras)) + (name (package-desc-name desc)) + (subject (read-string "Subject: "))) + (unless maint + (user-error "Package has no explicit maintainer")) + (compose-mail + (with-temp-buffer + (package--print-email-button maint) + (string-trim (substring-no-properties (buffer-string)))) + (format "[%s] %s" name subject)))) + ;;;; Introspection (defun package-get-descriptor (pkg-name) -- cgit v1.2.3 From f3e7820b480b4aa7a70f3ae6b2d775eba468a472 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 31 Jul 2022 21:32:38 +0200 Subject: Extract package-fetch and related functionality Note that the "package kind" was renamed from "source" to "vc". * package-vc.el: (package-vc-commit): Copy from package.el (package-vc-version): Add new function (package-vc-generate-description-file): Add new function. (package-vc-unpack): Add new function. (package-vc-fetch): Copy from package.el (package-checkout): Add alias for package-vc-fetch * package.el (package-devel-dir): Remove option. The checkouts are stored in package-user-dir (package-desc): Handle (vc . VERS) version strings (package-desc-full-name): Return the plain name for vc packages (package-devel-commit): Move function to package-vc (package-load-descriptor): Refactor according to other changes (package-load-all-descriptors): Remove package-devel-dir (package-unpack): Remove vc package handling (package-generate-description-file): Remove special handling for vc packages (package-install-from-archive): Remove special handling for vc packages (package-fetch): Move function to package-vc (package-desc-status): Use "vc" instead of "source" (package--remove-hidden): Use "vc" instead of "source" (package-menu--print-info-simple): Refactor according to other changes --- lisp/emacs-lisp/package-vc.el | 216 +++++++++++++++++++++++++++++++++ lisp/emacs-lisp/package.el | 270 ++++++++++++------------------------------ 2 files changed, 294 insertions(+), 192 deletions(-) create mode 100644 lisp/emacs-lisp/package-vc.el (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el new file mode 100644 index 00000000000..f95c79ccf2e --- /dev/null +++ b/lisp/emacs-lisp/package-vc.el @@ -0,0 +1,216 @@ +;;; package-vc.el --- Manage packages from VC checkouts -*- lexical-binding: t; -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. + +;; Author: Philip Kaludercic +;; Keywords: tools + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; While packages managed by package.el use tarballs for distributing +;; the source code, this extension allows for packages to be fetched +;; and updated directly from a version control system. + +;;; Code: + +(require 'package) +(require 'lisp-mnt) +(require 'vc) + +(defgroup package-vc nil + "Manage packages from VC checkouts." + :group 'package + :version "29.1") + +(declare-function vc-clone "vc" (backend remote &optional directory)) + +(defun package-vc-commit (pkg) + "Extract the commit of a development package PKG." + (cl-assert (eq (package-desc-kind pkg) 'vc)) + ;; FIXME: vc should be extended to allow querying the commit of a + ;; directory (as is possible when dealing with git repositores). + ;; This should be a fallback option. + (cl-loop with dir = (package-desc-dir pkg) + for file in (directory-files dir t "\\.el\\'" t) + when (vc-working-revision file) return it + finally return "unknown")) + +(defun package-vc-version (pkg) + "Extract the commit of a development package PKG." + (cl-assert (eq (package-desc-kind pkg) 'vc)) + (cl-loop with dir = (package-desc-dir pkg) ;FIXME: dir is nil + for file in (sort (directory-files dir t "\\.el\\'") + (lambda (s1 s2) + (< (length s1) (length s2)))) + when (with-temp-buffer + (insert-file-contents file) + (package-strip-rcs-id + (or (lm-header "package-version") + (lm-header "version")))) + return it + finally return "0")) + +(defun package-vc-generate-description-file (pkg-desc pkg-file) + "Generate a package description file for PKG-DESC. +The output is written out into PKG-FILE." + (let* ((name (package-desc-name pkg-desc))) + (let ((print-level nil) + (print-quoted t) + (print-length nil)) + (write-region + (concat + ";;; Generated package description from " + (replace-regexp-in-string + "-pkg\\.el\\'" ".el" + (file-name-nondirectory pkg-file)) + " -*- no-byte-compile: t -*-\n" + (prin1-to-string + (nconc + (list 'define-package + (symbol-name name) + (cons 'vc (package-vc-version pkg-desc)) + (package-desc-summary pkg-desc) + (let ((requires (package-desc-reqs pkg-desc))) + (list 'quote + ;; Turn version lists into string form. + (mapcar + (lambda (elt) + (list (car elt) + (package-version-join (cadr elt)))) + requires)))) + (package--alist-to-plist-args + (package-desc-extras pkg-desc)))) + "\n") + nil pkg-file nil 'silent)))) + +(defun package-vc-unpack (pkg-desc) + "Install the package described by PKG-DESC." + (let* ((name (package-desc-name pkg-desc)) + (dirname (package-desc-full-name pkg-desc)) + (pkg-dir (expand-file-name dirname package-user-dir))) + (setf (package-desc-dir pkg-desc) pkg-dir) + (when (file-exists-p pkg-dir) + (if (yes-or-no-p "Overwrite previous checkout?") + (delete-directory pkg-dir t) + (error "There already exists a checkout for %s" name))) + (pcase-let* ((attr (package-desc-extras pkg-desc)) + (`(,backend ,repo ,dir ,branch) + (or (alist-get :upstream attr) + (error "Source package has no repository")))) + (make-directory (file-name-directory pkg-dir) t) + (unless (setf (car (alist-get :upstream attr)) + (vc-clone backend repo pkg-dir)) + (error "Failed to clone %s from %s" name repo)) + (when-let ((rev (or (alist-get :rev attr) branch))) + (vc-retrieve-tag pkg-dir rev)) + (when dir (setq pkg-dir (file-name-concat pkg-dir dir))) + + ;; In case the package was installed directly from source, the + ;; dependency list wasn't know beforehand, and they might have + ;; to be installed explicitly. + (let (deps) + (dolist (file (directory-files pkg-dir t "\\.el\\'" t)) + (with-temp-buffer + (insert-file-contents file) + (when-let* ((require-lines (lm-header-multiline "package-requires"))) + (thread-last + (mapconcat #'identity require-lines " ") + package-read-from-string + package--prepare-dependencies + (nconc deps) + (setq deps))))) + (dolist (dep deps) + (cl-callf version-to-list (cadr dep))) + (package-download-transaction + (package-compute-transaction nil (delete-dups deps))))) + + (package-vc-generate-description-file + pkg-desc (file-name-concat pkg-dir (package--description-file pkg-dir))) + ;; Update package-alist. + (let ((new-desc (package-load-descriptor pkg-dir))) + ;; Activation has to be done before compilation, so that if we're + ;; upgrading and macros have changed we load the new definitions + ;; before compiling. + (when (package-activate-1 new-desc :reload :deps) + ;; FIXME: Compilation should be done as a separate, optional, step. + ;; E.g. for multi-package installs, we should first install all packages + ;; and then compile them. + (package--compile new-desc) + (when package-native-compile + (package--native-compile-async new-desc)) + ;; After compilation, load again any files loaded by + ;; `activate-1', so that we use the byte-compiled definitions. + (package--reload-previously-loaded new-desc))))) + +(defun package-vc-fetch (name-or-url &optional name rev) + "Fetch the source of NAME-OR-URL. +If NAME-OR-URL is a URL, then the package will be downloaded from +the repository indicated by the URL. The function will try to +guess the name of the package using `file-name-base'. This can +be overridden by manually passing the optional NAME. Otherwise +NAME-OR-URL is taken to be a package name, and the package +metadata will be consulted for the URL. An explicit revision can +be requested using REV." + (interactive + (progn + ;; Initialize the package system to get the list of package + ;; symbols for completion. + (package--archives-initialize) + (let* ((input (completing-read + "Fetch package source (name or URL): " + package-archive-contents)) + (name (file-name-base input))) + (list input (intern (string-remove-prefix "emacs-" name)))))) + (package--archives-initialize) + (package-vc-unpack + (cond + ((and (stringp name-or-url) + (url-type (url-generic-parse-url name-or-url))) + (package-desc-create + :name (or name (intern (file-name-base name-or-url))) + :kind 'vc + :extras `((:upstream . ,(list nil name-or-url nil nil)) + (:rev . ,rev)))) + ((when-let* ((desc (cadr (assoc name-or-url package-archive-contents + #'string=))) + (spec (or (alist-get :vc (package-desc-extras desc)) + (user-error "Package has no VC header")))) + (unless (string-match + (rx bos + (group (+ alnum)) + (+ blank) (group (+ (not blank))) + (? (+ blank) (group (+ (not blank))) + (? (+ blank) (group (+ (not blank))))) + eos) + spec) + (user-error "Invalid repository specification %S" spec)) + (package-desc-create + :name (if (stringp name-or-url) + (intern name-or-url) + name-or-url) + :kind 'vc + :extras `((:upstream . ,(list (intern (match-string 1 spec)) + (match-string 2 spec) + (match-string 3 spec) + (match-string 4 spec))) + (:rev . ,rev))))) + ((user-error "Unknown package to fetch: %s" name-or-url))))) + +;;;###autoload +(defalias 'package-checkout #'package-vc-fetch) + +(provide 'package-vc) +;;; package-vc.el ends here diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 858214611f6..a5821486405 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -304,17 +304,6 @@ packages in `package-directory-list'." :group 'applications :version "24.1") -(defcustom package-devel-dir (expand-file-name "devel" package-user-dir) - "Directory containing the user's Emacs Lisp package checkouts. -The directory name should be absolute. -Apart from this directory, Emacs also looks for system-wide -packages in `package-directory-list'." - :type 'directory - :initialize #'custom-initialize-delay - :set-after '(package-user-dir) - :risky t - :version "29.1") - ;;;###autoload (defcustom package-directory-list ;; Defaults are subdirs named "elpa" in the site-lisp dirs. @@ -472,14 +461,18 @@ synchronously." &rest rest-plist &aux (name (intern name-string)) - (version (and version-string (version-to-list version-string))) + (version (if (eq (car-safe version-string) 'vc) + (version-to-list (cdr version-string)) + (version-to-list version-string))) (reqs (mapcar (lambda (elt) (list (car elt) (version-to-list (cadr elt)))) (if (eq 'quote (car requirements)) (nth 1 requirements) requirements))) - (kind (plist-get rest-plist :kind)) + (kind (if (eq (car-safe version-string) 'vc) + 'vc + (plist-get rest-plist :kind))) (archive (plist-get rest-plist :archive)) (extras (let (alist) (while rest-plist @@ -571,10 +564,10 @@ This is, approximately, the inverse of `version-to-list'. (defun package-desc-full-name (pkg-desc) "Return full name of package-desc object PKG-DESC. This is the name of the package with its version appended." - (format "%s-%s" - (package-desc-name pkg-desc) - (if (eq (package-desc-kind pkg-desc) 'source) - "devel" + (if (eq (package-desc-kind pkg-desc) 'vc) + (symbol-name (package-desc-name pkg-desc)) + (format "%s-%s" + (package-desc-name pkg-desc) (package-version-join (package-desc-version pkg-desc))))) (defun package-desc-suffix (pkg-desc) @@ -654,6 +647,8 @@ loaded and/or activated, customize `package-load-list'.") ;; `package-load-all-descriptors', which ultimately populates the ;; `package-alist' variable. +(declare-function package-vc-version "package-vc" (pkg)) + (defun package-process-define-package (exp) "Process define-package expression EXP and push it to `package-alist'. EXP should be a form read from a foo-pkg.el file. @@ -682,15 +677,7 @@ are sorted with the highest version first." nil))) new-pkg-desc))) -(declare-function vc-working-revision "vc" (file &optional backend)) -(defun package-devel-commit (pkg) - "Extract the commit of a development package PKG." - (cl-assert (eq (package-desc-kind pkg) 'source)) - (require 'vc) - (cl-loop with dir = (package-desc-dir pkg) - for file in (directory-files dir t "\\.el\\'" t) - when (vc-working-revision file) return it - finally return "unknown")) +(declare-function package-vc-commit "package-vc" (pkg)) (defun package-load-descriptor (pkg-dir) "Load the package description file in directory PKG-DIR. @@ -707,13 +694,9 @@ return it." (read (current-buffer))) (error "Can't find define-package in %s" pkg-file)))) (setf (package-desc-dir pkg-desc) pkg-dir) - (when (file-exists-p (expand-file-name - (symbol-name (package-desc-name pkg-desc)) - package-devel-dir)) - ;; XXX: This check seems dirty, there should be a better - ;; way to deduce if a package is in the devel directory. - (setf (package-desc-kind pkg-desc) 'source) - (push (cons :commit (package-devel-commit pkg-desc)) + (when (eq (package-desc-kind pkg-desc) 'vc) + (require 'package-vc) + (push (cons :commit (package-vc-commit pkg-desc)) (package-desc-extras pkg-desc))) (if (file-exists-p signed-file) (setf (package-desc-signed pkg-desc) t)) @@ -728,9 +711,7 @@ controls which package subdirectories may be loaded. In each valid package subdirectory, this function loads the description file containing a call to `define-package', which updates `package-alist'." - (dolist (dir (cl-list* package-user-dir - package-devel-dir - package-directory-list)) + (dolist (dir (cons package-user-dir package-directory-list)) (when (file-directory-p dir) (dolist (pkg-dir (directory-files dir t "^[^.]" t)) (when (file-directory-p pkg-dir) @@ -964,51 +945,12 @@ untar into a directory named DIR; otherwise, signal an error." (apply #'nconc (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist)))) -(declare-function vc-clone "vc" (backend remote &optional directory)) - (defun package-unpack (pkg-desc) "Install the contents of the current buffer as a package." (let* ((name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) (pkg-dir (expand-file-name dirname package-user-dir))) (pcase (package-desc-kind pkg-desc) - ('source - (setq pkg-dir (expand-file-name (symbol-name name) package-devel-dir)) - (when (file-exists-p pkg-dir) - (if (and (called-interactively-p 'interactive) - (yes-or-no-p "Overwrite previous checkout?")) - (delete-directory pkg-dir t) - (error "There already exists a checkout for %s" name))) - (pcase-let* ((attr (package-desc-extras pkg-desc)) - (`(,backend ,repo ,dir ,branch) - (or (alist-get :upstream attr) - (error "Source package has no repository")))) - (require 'vc) - (make-directory (file-name-directory (file-name-directory pkg-dir)) t) - (unless (setf (car (alist-get :upstream attr)) - (vc-clone backend repo pkg-dir)) - (error "Failed to clone %s from %s" name repo)) - (when-let ((rev (or (alist-get :rev attr) branch))) - (vc-retrieve-tag pkg-dir rev)) - (when dir (setq pkg-dir (file-name-concat pkg-dir dir))) - ;; In case the package was installed directly from source, the - ;; dependency list wasn't know beforehand, and they might have - ;; to be installed explicitly. - (let (deps) - (dolist (file (directory-files pkg-dir t "\\.el\\'" t)) - (with-temp-buffer - (insert-file-contents file) - (when-let* ((require-lines (lm-header-multiline "package-requires"))) - (thread-last - (mapconcat #'identity require-lines " ") - package-read-from-string - package--prepare-dependencies - (nconc deps) - (setq deps))))) - (dolist (dep deps) - (cl-callf version-to-list (cadr dep))) - (package-download-transaction - (package-compute-transaction nil (delete-dups deps)))))) ('dir (make-directory pkg-dir t) (let ((file-list @@ -1035,9 +977,8 @@ untar into a directory named DIR; otherwise, signal an error." (package--make-autoloads-and-stuff pkg-desc pkg-dir) ;; Update package-alist. (let ((new-desc (package-load-descriptor pkg-dir))) - (unless (or (equal (package-desc-full-name new-desc) - (package-desc-full-name pkg-desc)) - (eq (package-desc-kind pkg-desc) 'source)) + (unless (equal (package-desc-full-name new-desc) + (package-desc-full-name pkg-desc)) (error "The retrieved package (`%s') doesn't match what the archive offered (`%s')" (package-desc-full-name new-desc) (package-desc-full-name pkg-desc))) ;; Activation has to be done before compilation, so that if we're @@ -1071,8 +1012,7 @@ untar into a directory named DIR; otherwise, signal an error." (nconc (list 'define-package (symbol-name name) - (and (not (eq (package-desc-kind pkg-desc) 'source)) - (package-version-join (package-desc-version pkg-desc))) + (package-version-join (package-desc-version pkg-desc)) (package-desc-summary pkg-desc) (let ((requires (package-desc-reqs pkg-desc))) (list 'quote @@ -1087,6 +1027,7 @@ untar into a directory named DIR; otherwise, signal an error." "\n") nil pkg-file nil 'silent)))) + ;;;; Autoload (declare-function autoload-rubric "autoload" (file &optional type feature)) @@ -2099,48 +2040,46 @@ if all the in-between dependencies are also in PACKAGE-LIST." ;; This won't happen, unless the archive is doing something wrong. (when (eq (package-desc-kind pkg-desc) 'dir) (error "Can't install directory package from archive")) - (if (eq (package-desc-kind pkg-desc) 'source) - (package-unpack pkg-desc) - (let* ((location (package-archive-base pkg-desc)) - (file (concat (package-desc-full-name pkg-desc) - (package-desc-suffix pkg-desc)))) - (package--with-response-buffer location :file file - (if (or (not (package-check-signature)) - (member (package-desc-archive pkg-desc) - package-unsigned-archives)) - ;; If we don't care about the signature, unpack and we're - ;; done. - (let ((save-silently t)) - (package-unpack pkg-desc)) - ;; If we care, check it and *then* write the file. - (let ((content (buffer-string))) - (package--check-signature - location file content nil - ;; This function will be called after signature checking. - (lambda (&optional good-sigs) - ;; Signature checked, unpack now. - (with-temp-buffer ;FIXME: Just use the previous current-buffer. - (set-buffer-multibyte nil) - (cl-assert (not (multibyte-string-p content))) - (insert content) - (let ((save-silently t)) - (package-unpack pkg-desc))) - ;; Here the package has been installed successfully, mark it as - ;; signed if appropriate. - (when good-sigs - ;; Write out good signatures into NAME-VERSION.signed file. - (write-region (mapconcat #'epg-signature-to-string good-sigs "\n") - nil - (expand-file-name - (concat (package-desc-full-name pkg-desc) ".signed") - package-user-dir) - nil 'silent) - ;; Update the old pkg-desc which will be shown on the description buffer. - (setf (package-desc-signed pkg-desc) t) - ;; Update the new (activated) pkg-desc as well. - (when-let* ((pkg-descs (cdr (assq (package-desc-name pkg-desc) - package-alist)))) - (setf (package-desc-signed (car pkg-descs)) t))))))))))) + (let* ((location (package-archive-base pkg-desc)) + (file (concat (package-desc-full-name pkg-desc) + (package-desc-suffix pkg-desc)))) + (package--with-response-buffer location :file file + (if (or (not (package-check-signature)) + (member (package-desc-archive pkg-desc) + package-unsigned-archives)) + ;; If we don't care about the signature, unpack and we're + ;; done. + (let ((save-silently t)) + (package-unpack pkg-desc)) + ;; If we care, check it and *then* write the file. + (let ((content (buffer-string))) + (package--check-signature + location file content nil + ;; This function will be called after signature checking. + (lambda (&optional good-sigs) + ;; Signature checked, unpack now. + (with-temp-buffer ;FIXME: Just use the previous current-buffer. + (set-buffer-multibyte nil) + (cl-assert (not (multibyte-string-p content))) + (insert content) + (let ((save-silently t)) + (package-unpack pkg-desc))) + ;; Here the package has been installed successfully, mark it as + ;; signed if appropriate. + (when good-sigs + ;; Write out good signatures into NAME-VERSION.signed file. + (write-region (mapconcat #'epg-signature-to-string good-sigs "\n") + nil + (expand-file-name + (concat (package-desc-full-name pkg-desc) ".signed") + package-user-dir) + nil 'silent) + ;; Update the old pkg-desc which will be shown on the description buffer. + (setf (package-desc-signed pkg-desc) t) + ;; Update the new (activated) pkg-desc as well. + (when-let* ((pkg-descs (cdr (assq (package-desc-name pkg-desc) + package-alist)))) + (setf (package-desc-signed (car pkg-descs)) t)))))))))) ;;;###autoload (defun package-installed-p (package &optional min-version) @@ -2234,61 +2173,6 @@ to install it but still mark it as selected." (message "Package `%s' installed." name)) (message "`%s' is already installed" name)))) -;;;###autoload -(defun package-fetch (name-or-url &optional name rev) - "Fetch the source of NAME-OR-URL. -If NAME-OR-URL is a URL, then the package will be downloaded from -the repository indicated by the URL. The function will try to -guess the name of the package using `file-name-base'. This can -be overridden by manually passing the optional NAME. Otherwise -NAME-OR-URL is taken to be a package name, and the package -metadata will be consulted for the URL. An explicit revision can -be requested using REV." - (interactive - (progn - ;; Initialize the package system to get the list of package - ;; symbols for completion. - (package--archives-initialize) - (let* ((input (completing-read - "Fetch package source (name or URL): " - package-archive-contents)) - (name (file-name-base input))) - (list input (intern (string-remove-prefix "emacs-" name)))))) - (package--archives-initialize) - (package-install - (cond - ((and (stringp name-or-url) - (url-type (url-generic-parse-url name-or-url))) - (package-desc-create - :name (or name (intern (file-name-base name-or-url))) - :kind 'source - :extras `((:upstream . ,(list nil name-or-url nil nil)) - (:rev . ,rev)))) - ((when-let* ((desc (cadr (assoc name-or-url package-archive-contents - #'string=))) - (spec (or (alist-get :vc (package-desc-extras desc)) - (user-error "Package has no VC header")))) - (unless (string-match - (rx bos - (group (+ alnum)) - (+ blank) (group (+ (not blank))) - (? (+ blank) (group (+ (not blank))) - (? (+ blank) (group (+ (not blank))))) - eos) - spec) - (user-error "Invalid repository specification %S" spec)) - (package-desc-create - :name (if (stringp name-or-url) - (intern name-or-url) - name-or-url) - :kind 'source - :extras `((:upstream . ,(list (intern (match-string 1 spec)) - (match-string 2 spec) - (match-string 3 spec) - (match-string 4 spec))) - (:rev . ,rev))))) - ((user-error "Unknown package to fetch: %s" name-or-url))))) - ;;;###autoload (defun package-update (name) "Update package NAME if a newer version exists." @@ -3188,7 +3072,7 @@ of these dependencies, similar to the list returned by (signed (or (not package-list-unsigned) (package-desc-signed pkg-desc)))) (cond - ((eq (package-desc-kind pkg-desc) 'source) "source") + ((eq (package-desc-kind pkg-desc) 'vc) "source") ((eq dir 'builtin) "built-in") ((and lle (null held)) "disabled") ((stringp held) @@ -3279,7 +3163,7 @@ to their archives." (let ((ins-version (package-desc-version installed))) (cl-remove-if (lambda (p) (or (version-list-= (package-desc-version p) ins-version) - (eq (package-desc-kind installed) 'source))) + (eq (package-desc-kind installed) 'vc))) filtered-by-priority)))))))) (defcustom package-hidden-regexps nil @@ -3536,8 +3420,10 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." package-desc ,pkg action package-menu-describe-package) ,(propertize - (if (eq (package-desc-kind pkg) 'source) - (package-devel-commit pkg) + (if (eq (package-desc-kind pkg) 'vc) + (progn + (require 'package-vc) + (package-vc-commit pkg)) (package-version-join (package-desc-version pkg))) 'font-lock-face face) @@ -4334,22 +4220,22 @@ Unlike other filters, this leaves the marks intact." (while (not (eobp)) (setq mark (char-after)) (unless (eq mark ?\s) - (setq pkg-id (tabulated-list-get-id)) + (setq pkg-id (tabulated-list-get-id)) (setq entry (package-menu--print-info-simple pkg-id)) - (push entry found-entries) - ;; remember the mark - (push (cons pkg-id mark) marks)) + (push entry found-entries) + ;; remember the mark + (push (cons pkg-id mark) marks)) (forward-line)) (if found-entries (progn (setq tabulated-list-entries found-entries) (package-menu--display t nil) - ;; redo the marks, but we must remember the marks!! - (goto-char (point-min)) - (while (not (eobp)) - (setq mark (cdr (assq (tabulated-list-get-id) marks))) - (tabulated-list-put-tag (char-to-string mark) t))) - (user-error "No packages found"))))) + ;; redo the marks, but we must remember the marks!! + (goto-char (point-min)) + (while (not (eobp)) + (setq mark (cdr (assq (tabulated-list-get-id) marks))) + (tabulated-list-put-tag (char-to-string mark) t))) + (user-error "No packages found"))))) (defun package-menu-filter-upgradable () "Filter \"*Packages*\" buffer to show only upgradable packages." @@ -4555,7 +4441,7 @@ DESC must be a `package-desc' object." (unless url (user-error "No website for %s" (package-desc-name desc))) (if secondary - (funcall browse-url-secondary-browser-function url) + (funcall browse-url-secondary-browser-function url) (browse-url url)))) ;; TODO: Allow attaching a patch to send directly to the maintainer. -- cgit v1.2.3 From 9ddc23cd3438cba85b8a41e78d335c0d5071a212 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 11 Aug 2022 12:42:37 +0200 Subject: 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'. --- lisp/emacs-lisp/package-vc.el | 1 - lisp/emacs-lisp/package.el | 23 ++++++++++++++++++++++- lisp/vc/vc.el | 5 +++++ 3 files changed, 27 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 5a707e1a600..0f5ee4305a8 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -29,7 +29,6 @@ ;; - Allow for automatic updating TODO ;; * Detect merge conflicts TODO ;; * Check if there are upstream changes TODO -;; - Respect the .elpaignore file TODO ;; - Allow finding revisions that bump the version tag TODO ;; * Allow for `package-vc-fetch' to use the version ;; of the package if already installed. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a5821486405..1321c3728e8 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -599,6 +599,25 @@ package." "Return the priority of the archive of package-desc object PKG-DESC." (package-archive-priority (package-desc-archive pkg-desc))) +(defun package--parse-elpaignore (pkg-desc) + "Return the of regular expression to match files ignored by PKG-DESC." + (let* ((pkg-dir (file-name-as-directory (package-desc-dir pkg-desc))) + (ignore (expand-file-name ".elpaignore" pkg-dir)) + files) + (when (file-exists-p ignore) + (with-temp-buffer + (insert-file-contents ignore) + (goto-char (point-min)) + (while (not (eobp)) + (push (wildcard-to-regexp + (let ((line (buffer-substring + (line-beginning-position) + (line-end-position)))) + (file-name-concat pkg-dir (string-trim-left line "/")))) + files) + (forward-line))) + files))) + (cl-defstruct (package--bi-desc (:constructor package-make-builtin (version summary)) (:type vector)) @@ -1073,11 +1092,13 @@ untar into a directory named DIR; otherwise, signal an error." ;;;; Compilation (defvar warning-minimum-level) +(defvar byte-compile-ignore-files) (defun package--compile (pkg-desc) "Byte-compile installed package PKG-DESC. This assumes that `pkg-desc' has already been activated with `package-activate-1'." - (let ((warning-minimum-level :error) + (let ((byte-compile-ignore-files (package--parse-elpaignore pkg-desc)) + (warning-minimum-level :error) (load-path load-path)) (byte-recompile-directory (package-desc-dir pkg-desc) 0 t))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 2dcf8f56542..290054d523e 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -573,6 +573,11 @@ ;; ;; Attempt to clone a REMOTE repository, into a local DIRECTORY. ;; Returns the symbol of the backend used if successful. +;; +;; - send-patch (addr &optional rev-list) +;; +;; Send a patch to ADDR + ;;; Changes from the pre-25.1 API: ;; -- cgit v1.2.3 From f5bb6b01318fe3a21493992e94908cf685e9b26b Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 11 Aug 2022 13:23:51 +0200 Subject: 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'. --- lisp/emacs-lisp/package-vc.el | 6 ++++++ lisp/emacs-lisp/package.el | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 0f5ee4305a8..04821d43c4a 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -227,6 +227,12 @@ The output is written out into PKG-FILE." t)))) package-archive-contents)) +(defun package-vc-update (pkg-desc) + "Attempt to update the packager PKG-DESC." + (let ((default-directory (package-desc-dir pkg-desc))) + (with-demoted-errors "Error during package update: %S" + (vc-pull)))) + (defun package-vc-fetch (name-or-url &optional name rev) "Fetch the source of NAME-OR-URL. If NAME-OR-URL is a URL, then the package will be downloaded from diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 1321c3728e8..1ee39f87529 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2194,17 +2194,22 @@ to install it but still mark it as selected." (message "Package `%s' installed." name)) (message "`%s' is already installed" name)))) +(declare-function package-vc-update "package-vc" (pkg)) + ;;;###autoload (defun package-update (name) "Update package NAME if a newer version exists." (interactive (list (completing-read "Update package: " (package--updateable-packages) nil t))) - (let ((package (if (symbolp name) - name - (intern name)))) - (package-delete (cadr (assq package package-alist)) 'force) - (package-install package 'dont-select))) + (let* ((package (if (symbolp name) + name + (intern name))) + (pkg-desc (cadr (assq package package-alist)))) + (if (eq (package-desc-kind pkg-desc) 'vc) + (package-vc-update pkg-desc) + (package-delete pkg-desc 'force) + (package-install package 'dont-select)))) (defun package--updateable-packages () ;; Initialize the package system to get the list of package -- cgit v1.2.3 From fb87d5008e21d1bc03547c1edf2280fb4cb8311e Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 11 Aug 2022 13:35:47 +0200 Subject: * package.el (package--get-activatable-pkg): Prefer source packages --- lisp/emacs-lisp/package.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 1ee39f87529..0145306dc4e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -898,14 +898,22 @@ correspond to previously loaded files (those returned by (defun package--get-activatable-pkg (pkg-name) ;; Is "activatable" a word? - (let ((pkg-descs (cdr (assq pkg-name package-alist)))) + (let ((pkg-descs (sort (cdr (assq pkg-name package-alist)) + (lambda (p1 p2) + (let ((v1 (package-desc-version p1)) + (v2 (package-desc-version p2))) + (or + ;; Prefer source packages. + (eq (package-desc-kind p1) 'vc) + (not (eq (package-desc-kind p2) 'vc)) + ;; Prefer builtin packages. + (package-disabled-p p1 v1) + (not (package-disabled-p p2 v2)))))))) ;; Check if PACKAGE is available in `package-alist'. (while (when pkg-descs (let ((available-version (package-desc-version (car pkg-descs)))) - (or (package-disabled-p pkg-name available-version) - ;; Prefer a builtin package. - (package-built-in-p pkg-name available-version)))) + (package-disabled-p pkg-name available-version))) (setq pkg-descs (cdr pkg-descs))) (car pkg-descs))) -- cgit v1.2.3 From dd98fedd0c7f27bfba046d761042c19181cb461d Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 11 Aug 2022 14:05:01 +0200 Subject: * package.el (describe-package-1): Add news if avaliable --- lisp/emacs-lisp/package.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 0145306dc4e..ab1a652188f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2658,7 +2658,10 @@ Helper function for `describe-package'." (incompatible-reason (package--incompatible-p desc)) (signed (if desc (package-desc-signed desc))) (maintainer (cdr (assoc :maintainer extras))) - (authors (cdr (assoc :authors extras)))) + (authors (cdr (assoc :authors extras))) + (news (and-let* ((file (expand-file-name "news" pkg-dir)) + ((file-readable-p file))) + file))) (when (string= status "avail-obso") (setq status "available obsolete")) (when incompatible-reason @@ -2857,6 +2860,14 @@ Helper function for `describe-package'." t) (insert (or readme-string "This package does not provide a description."))))) + + ;; Insert news if available. + (when news + (insert "\n" (make-separator-line) "\n" + (propertize "* News" 'face 'package-help-section-name) + "\n\n") + (insert-file-contents news)) + ;; Make library descriptions into links. (goto-char start-of-description) (package--describe-add-library-links) -- cgit v1.2.3 From 7c11398ca0a77eaf97448f0760800d6ec05fe22c Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 6 Oct 2022 21:45:36 +0200 Subject: Add a generic bug reporting command for packages * lisp/emacs-lisp/package.el (package-menu-mode-map): Bind 'package-report-bug'. (package-report-bug): Add new command. --- lisp/emacs-lisp/package.el | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2de5056475d..e0fb4b05723 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2964,6 +2964,7 @@ either a full name or nil, and EMAIL is a valid email address." "~" #'package-menu-mark-obsolete-for-deletion "w" #'package-browse-url "m" #'package-contact-maintainer + "b" #'package-report-bug "x" #'package-menu-execute "h" #'package-menu-quick-help "H" #'package-menu-hide-package @@ -4516,6 +4517,37 @@ DESC must be a `package-desc' object." (string-trim (substring-no-properties (buffer-string)))) (format "[%s] %s" name subject)))) +(defun package-report-bug (desc) + "Prepare a message to send to the maintainers of a package. +DESC must be a `package-desc' object." + (interactive (list (package--query-desc package-alist)) + package-menu-mode) + (unless desc + (user-error "Package must be non-nil")) + (let* ((extras (package-desc-extras desc)) + (maint (alist-get :maintainer extras)) + vars) + (unless maint + (user-error "Package %s has no explicit maintainer" + (package-desc-name desc))) + (let ((check (apply-partially #'file-equal-p (package-desc-dir desc)))) + (dolist-with-progress-reporter (group custom-current-group-alist) + "Scanning for modified user options..." + (dolist (ent (get (cdr group) 'custom-group)) + (when (and (custom-variable-p (car ent)) + (boundp (car ent)) + (not (eq (custom--standard-value (car ent)) + (default-toplevel-value (car ent)))) + (locate-dominating-file (car group) check)) + (push (car ent) vars))))) + (dlet ((reporter-prompt-for-summary-p t)) + (reporter-submit-bug-report + (with-temp-buffer + (package--print-email-button maint) + (string-trim (substring-no-properties (buffer-string)))) + (symbol-name (package-desc-name desc)) + vars)))) + ;;;; Introspection (defun package-get-descriptor (pkg-name) -- cgit v1.2.3 From 6c956de80a7dadcb9d929c9a59b852b27fe83f2b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 7 Oct 2022 11:20:37 +0200 Subject: Improve package-check-signature docstring * lisp/emacs-lisp/package.el (package-check-signature): Improve docstring. --- lisp/emacs-lisp/package.el | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 812e1eb0ff7..4268f7d27a7 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -346,21 +346,28 @@ default directory." (defcustom package-check-signature 'allow-unsigned "Non-nil means to check package signatures when installing. -More specifically the value can be: -- nil: package signatures are ignored. -- `allow-unsigned': install a package even if it is unsigned, but - if it is signed, we have the key for it, and OpenGPG is - installed, verify the signature. -- t: accept a package only if it comes with at least one verified signature. -- `all': same as t, except when the package has several signatures, - in which case we verify all the signatures. This also applies to the \"archive-contents\" file that lists the -contents of the archive." +contents of the archive. + +The value can be one of: + + t Accept a package only if it comes with at least + one verified signature. + + `all' Same as t, but verify all signatures if there + are more than one. + + `allow-unsigned' Install a package even if it is unsigned, + but verify the signature if possible (that + is, if it is signed, we have the key for it, + and GnuPG is installed). + + nil Package signatures are ignored." :type '(choice (const :value nil :tag "Never") (const :value allow-unsigned :tag "Allow unsigned") (const :value t :tag "Check always") - (const :value all :tag "Check all signatures")) + (const :value all :tag "Check always (all signatures)")) :risky t :version "27.1") -- cgit v1.2.3 From e75994f2ff0fb863cb978e354926d0d138d5b362 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 7 Oct 2022 18:41:24 +0200 Subject: Add an inline procedure for checking for source packages * package.el (eval-when-compile): Require 'inline during compilation. (package-vc-p): Add inline function. (package-desc-full-name): Use it. (package-load-descriptor): Use it. (package--get-activatable-pkg): Use it. (package-install-from-archive): Use it. (package-update): Use it. (package-desc-status): Use it. (package--remove-hidden): Use it. (package-menu--print-info-simple): Use it. --- lisp/emacs-lisp/package.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index b0659cd585f..48d78fab83a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -146,6 +146,7 @@ (require 'cl-lib) (eval-when-compile (require 'subr-x)) (eval-when-compile (require 'epg)) ;For setf accessors. +(eval-when-compile (require 'inline)) ;For `define-inline' (require 'seq) (require 'tabulated-list) @@ -456,6 +457,11 @@ synchronously." (defvar package--default-summary "No description available.") +(define-inline package-vc-p (pkg-desc) + "Return non-nil if PKG-DESC is a source package." + (inline-letevals (pkg-desc) + (inline-quote (eq (package-desc-kind ,pkg-desc) 'vc)))) + (cl-defstruct (package-desc ;; Rename the default constructor from `make-package-desc'. (:constructor package-desc-create) @@ -571,7 +577,7 @@ This is, approximately, the inverse of `version-to-list'. (defun package-desc-full-name (pkg-desc) "Return full name of package-desc object PKG-DESC. This is the name of the package with its version appended." - (if (eq (package-desc-kind pkg-desc) 'vc) + (if (package-vc-p pkg-desc) (symbol-name (package-desc-name pkg-desc)) (format "%s-%s" (package-desc-name pkg-desc) @@ -720,7 +726,7 @@ return it." (read (current-buffer))) (error "Can't find define-package in %s" pkg-file)))) (setf (package-desc-dir pkg-desc) pkg-dir) - (when (eq (package-desc-kind pkg-desc) 'vc) + (when (package-vc-p pkg-desc) (require 'package-vc) (push (cons :commit (package-vc-commit pkg-desc)) (package-desc-extras pkg-desc))) @@ -911,8 +917,8 @@ correspond to previously loaded files (those returned by (v2 (package-desc-version p2))) (or ;; Prefer source packages. - (eq (package-desc-kind p1) 'vc) - (not (eq (package-desc-kind p2) 'vc)) + (package-vc-p p1) + (package-vc-p p2) ;; Prefer builtin packages. (package-disabled-p p1 v1) (not (package-disabled-p p2 v2)))))))) @@ -2076,7 +2082,7 @@ if all the in-between dependencies are also in PACKAGE-LIST." (defun package-install-from-archive (pkg-desc) "Download and install a package defined by PKG-DESC." ;; This won't happen, unless the archive is doing something wrong. - (when (eq (package-desc-kind pkg-desc) 'dir) + (when (package-vc-p pkg-desc) (error "Can't install directory package from archive")) (let* ((location (package-archive-base pkg-desc)) (file (concat (package-desc-full-name pkg-desc) @@ -2226,7 +2232,7 @@ to install it but still mark it as selected." name (intern name))) (pkg-desc (cadr (assq package package-alist)))) - (if (eq (package-desc-kind pkg-desc) 'vc) + (if (package-vc-p pkg-desc) (package-vc-update pkg-desc) (package-delete pkg-desc 'force) (package-install package 'dont-select)))) @@ -3134,7 +3140,7 @@ of these dependencies, similar to the list returned by (signed (or (not package-list-unsigned) (package-desc-signed pkg-desc)))) (cond - ((eq (package-desc-kind pkg-desc) 'vc) "source") + ((package-vc-p pkg-desc) "source") ((eq dir 'builtin) "built-in") ((and lle (null held)) "disabled") ((stringp held) @@ -3225,7 +3231,7 @@ to their archives." (let ((ins-version (package-desc-version installed))) (cl-remove-if (lambda (p) (or (version-list-= (package-desc-version p) ins-version) - (eq (package-desc-kind installed) 'vc))) + (package-vc-p installed))) filtered-by-priority)))))))) (defcustom package-hidden-regexps nil @@ -3482,7 +3488,7 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." package-desc ,pkg action package-menu-describe-package) ,(propertize - (if (eq (package-desc-kind pkg) 'vc) + (if (package-vc-p pkg) (progn (require 'package-vc) (package-vc-commit pkg)) -- cgit v1.2.3 From effe1f20f58bd92443e28cda2f0f65c681f1b387 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 7 Oct 2022 18:52:17 +0200 Subject: Extract package maintainer guessing code into a separate function * package.el (package-maintainers): Add new function. (package-contact-maintainer): Use it. (package-report-bug): Use it. --- lisp/emacs-lisp/package.el | 50 +++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 48d78fab83a..9ac94fa6bca 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4516,6 +4516,21 @@ DESC must be a `package-desc' object." (funcall browse-url-secondary-browser-function url) (browse-url url)))) +(defun package-maintainers (pkg-desc) + "Return an email address for the maintainers of PKG-DESC. +The email address may contain commas, if there are multiple +maintainers. If no maintainers are found, an error will be +thrown." + (unless pkg-desc + (user-error "Invalid package description")) + (let* ((extras (package-desc-extras pkg-desc)) + (maint (alist-get :maintainer extras))) + (unless maint + (user-error "Package has no explicit maintainer")) + (with-temp-buffer + (package--print-email-button maint) + (string-trim (substring-no-properties (buffer-string)))))) + ;; TODO: Allow attaching a patch to send directly to the maintainer. ;; Ideally this should be able to detect the local changes, convert ;; these into patches. @@ -4524,33 +4539,19 @@ DESC must be a `package-desc' object." DESC must be a `package-desc' object." (interactive (list (package--query-desc package-archive-contents)) package-menu-mode) - (unless desc - (user-error "No package here")) - (let* ((extras (package-desc-extras desc)) - (maint (alist-get :maintainer extras)) - (name (package-desc-name desc)) - (subject (read-string "Subject: "))) - (unless maint - (user-error "Package has no explicit maintainer")) - (compose-mail - (with-temp-buffer - (package--print-email-button maint) - (string-trim (substring-no-properties (buffer-string)))) - (format "[%s] %s" name subject)))) + (let ((maint (package-maintainers desc)) + (name (package-desc-name desc)) + (subject (read-string "Subject: "))) + (compose-mail maint (format "[%s] %s" name subject)))) (defun package-report-bug (desc) "Prepare a message to send to the maintainers of a package. DESC must be a `package-desc' object." (interactive (list (package--query-desc package-alist)) package-menu-mode) - (unless desc - (user-error "Package must be non-nil")) - (let* ((extras (package-desc-extras desc)) - (maint (alist-get :maintainer extras)) - vars) - (unless maint - (user-error "Package %s has no explicit maintainer" - (package-desc-name desc))) + (let ((maint (package-maintainers desc)) + (name (symbol-name (package-desc-name desc))) + vars) (let ((check (apply-partially #'file-equal-p (package-desc-dir desc)))) (dolist-with-progress-reporter (group custom-current-group-alist) "Scanning for modified user options..." @@ -4562,12 +4563,7 @@ DESC must be a `package-desc' object." (locate-dominating-file (car group) check)) (push (car ent) vars))))) (dlet ((reporter-prompt-for-summary-p t)) - (reporter-submit-bug-report - (with-temp-buffer - (package--print-email-button maint) - (string-trim (substring-no-properties (buffer-string)))) - (symbol-name (package-desc-name desc)) - vars)))) + (reporter-submit-bug-report maint name vars)))) ;;;; Introspection -- cgit v1.2.3 From e092e60f1539898a42ed157b87bdd32f512109e0 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 7 Oct 2022 18:57:00 +0200 Subject: Add a package-vc command for submitting ptches * lisp/emacs-lisp/package-vc.el (package-vc-read-pkg): Add auxiliary command for querying source packages. (package-vc-prepare-patch): Add it. * lisp/emacs-lisp/package.el (package-maintainers): Add an optional NO-ERROR argument. --- lisp/emacs-lisp/package-vc.el | 21 +++++++++++++++++++++ lisp/emacs-lisp/package.el | 17 ++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 2a45bacf6e9..d3850a5e2c0 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -286,5 +286,26 @@ be requested using REV." ;;;###autoload (defalias 'package-checkout #'package-vc-fetch) +(defun package-vc-read-pkg (prompt) + "Query for a source package description with PROMPT." + (completing-read + prompt + package-alist + (lambda (pkg) (package-vc-p (cadr pkg))) + t)) + +(defun package-vc-prepare-patch (pkg subject revisions) + "Send a patch to the maintainer of a package PKG. +SUBJECT and REVISIONS are used passed on to `vc-prepare-patch'. +PKG must be a package description." + (interactive + (list (package-vc-read-pkg "Package to prepare a patch for: ") + (and (not vc-prepare-patches-separately) + (read-string "Subject: " "[PATCH] " nil nil t)) + (or (log-view-get-marked) + (vc-read-multiple-revisions "Revisions: ")))) + (vc-prepare-patch (package-maintainers pkg t) + subject revisions)) + (provide 'package-vc) ;;; package-vc.el ends here diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 9ac94fa6bca..6e891fede1f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4516,20 +4516,23 @@ DESC must be a `package-desc' object." (funcall browse-url-secondary-browser-function url) (browse-url url)))) -(defun package-maintainers (pkg-desc) +(defun package-maintainers (pkg-desc &optional no-error) "Return an email address for the maintainers of PKG-DESC. The email address may contain commas, if there are multiple maintainers. If no maintainers are found, an error will be -thrown." +signalled. If the optional argument NO-ERROR is non-nil no error +will be signalled in that case." (unless pkg-desc - (user-error "Invalid package description")) + (error "Invalid package description")) (let* ((extras (package-desc-extras pkg-desc)) (maint (alist-get :maintainer extras))) - (unless maint + (cond + ((and (null maint) (null no-error)) (user-error "Package has no explicit maintainer")) - (with-temp-buffer - (package--print-email-button maint) - (string-trim (substring-no-properties (buffer-string)))))) + ((not (null maint)) + (with-temp-buffer + (package--print-email-button maint) + (string-trim (substring-no-properties (buffer-string)))))))) ;; TODO: Allow attaching a patch to send directly to the maintainer. ;; Ideally this should be able to detect the local changes, convert -- cgit v1.2.3 From 7c66223dfba64c29afddf2f13cbf322d4cc4d12a Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 7 Oct 2022 22:36:12 +0200 Subject: * lisp/emacs-lisp/package.el (package-report-bug): Use 'file-in-directory-p' --- lisp/emacs-lisp/package.el | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6e891fede1f..ad01dbc197e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4555,16 +4555,15 @@ DESC must be a `package-desc' object." (let ((maint (package-maintainers desc)) (name (symbol-name (package-desc-name desc))) vars) - (let ((check (apply-partially #'file-equal-p (package-desc-dir desc)))) - (dolist-with-progress-reporter (group custom-current-group-alist) - "Scanning for modified user options..." - (dolist (ent (get (cdr group) 'custom-group)) - (when (and (custom-variable-p (car ent)) - (boundp (car ent)) - (not (eq (custom--standard-value (car ent)) - (default-toplevel-value (car ent)))) - (locate-dominating-file (car group) check)) - (push (car ent) vars))))) + (dolist-with-progress-reporter (group custom-current-group-alist) + "Scanning for modified user options..." + (dolist (ent (get (cdr group) 'custom-group)) + (when (and (custom-variable-p (car ent)) + (boundp (car ent)) + (not (eq (custom--standard-value (car ent)) + (default-toplevel-value (car ent)))) + (file-in-directory-p (car group) (package-desc-dir desc))) + (push (car ent) vars)))) (dlet ((reporter-prompt-for-summary-p t)) (reporter-submit-bug-report maint name vars)))) -- cgit v1.2.3 From a4a825df829670f824de9b15583972f6898e0e18 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 8 Oct 2022 00:13:55 +0200 Subject: Clone packages into a separate directory * lisp/emacs-lisp/package-vc.el (package-vc-repository-store): Add new user option. (package-vc-unpack): Use 'package-vc-repository-store'. * lisp/emacs-lisp/package.el (package--delete-directory): Check and handle source packages. (package-delete): Invoke 'package--delete-directory' with an additional argument. --- lisp/emacs-lisp/package-vc.el | 33 +++++++++++++++++++++++++++------ lisp/emacs-lisp/package.el | 21 +++++++++++++++++---- 2 files changed, 44 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index d9903b3ca3d..678b4f7a953 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -44,6 +44,7 @@ (require 'lisp-mnt) (require 'vc) (require 'seq) +(require 'xdg) (defgroup package-vc nil "Manage packages from VC checkouts." @@ -89,6 +90,12 @@ vc-handled-backends))) :version "29.1") +(defcustom package-vc-repository-store + (expand-file-name "emacs/vc-packages" (xdg-data-home)) + "Directory used by `package-vc-unpack' to store repositories." + :type 'directory + :version "29.1") + (defun package-vc-commit (pkg) "Extract the commit of a development package PKG." (cl-assert (package-vc-p pkg)) @@ -150,25 +157,39 @@ The output is written out into PKG-FILE." (defun package-vc-unpack (pkg-desc) "Install the package described by PKG-DESC." + (unless (file-exists-p package-vc-repository-store) + (make-directory package-vc-repository-store t)) (let* ((name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) (pkg-dir (expand-file-name dirname package-user-dir))) (setf (package-desc-dir pkg-desc) pkg-dir) (when (file-exists-p pkg-dir) (if (yes-or-no-p "Overwrite previous checkout?") - (package--delete-directory pkg-dir) + (package--delete-directory pkg-dir pkg-desc) (error "There already exists a checkout for %s" name))) (pcase-let* ((attr (package-desc-extras pkg-desc)) (`(,backend ,repo ,dir ,branch) (or (alist-get :upstream attr) - (error "Source package has no repository")))) - (make-directory (file-name-directory pkg-dir) t) + (error "Source package has no repository"))) + (repo-dir (file-name-concat + package-vc-repository-store + ;; FIXME: We aren't sure this directory + ;; will be unique, but we can try other + ;; names to avoid an unnecessary error. + (file-name-base repo)))) + + ;; Clone the repository into `repo-dir'. + (make-directory (file-name-directory repo-dir) t) (unless (setf (car (alist-get :upstream attr)) - (vc-clone backend repo pkg-dir)) + (vc-clone backend repo repo-dir)) (error "Failed to clone %s from %s" name repo)) - (when-let ((rev (or (alist-get :rev attr) branch))) + + ;; Link from the right position in `repo-dir' to the package + ;; directory in the ELPA store. + (make-symbolic-link (file-name-concat repo-dir dir) pkg-dir) + (when-let ((default-directory repo-dir) + (rev (or (alist-get :rev attr) branch))) (vc-retrieve-tag pkg-dir rev)) - (when dir (setq pkg-dir (file-name-concat pkg-dir dir))) ;; In case the package was installed directly from source, the ;; dependency list wasn't know beforehand, and they might have diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ad01dbc197e..2748adddfb6 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2407,15 +2407,28 @@ installed), maybe you need to \\[package-refresh-contents]") pkg)) (declare-function comp-el-to-eln-filename "comp.c") -(defun package--delete-directory (dir) - "Delete DIR recursively. +(defvar package-vc-repository-store) +(defun package--delete-directory (dir pkg-desc) + "Delete PKG-DESC directory DIR recursively. Clean-up the corresponding .eln files if Emacs is native compiled." (when (featurep 'native-compile) (cl-loop for file in (directory-files-recursively dir "\\.el\\'") do (comp-clean-up-stale-eln (comp-el-to-eln-filename file)))) - (delete-directory dir t)) + (cond + ((not (package-vc-p pkg-desc)) + (delete-directory dir t)) + ((progn + (require 'package-vc) ;load `package-vc-repository-store' + (file-in-directory-p dir package-vc-repository-store)) + (delete-directory + (expand-file-name + (car (file-name-split + (file-relative-name dir package-vc-repository-store))) + package-vc-repository-store) + t) + (delete-file (directory-file-name dir))))) (defun package-delete (pkg-desc &optional force nosave) "Delete package PKG-DESC. @@ -2469,7 +2482,7 @@ If NOSAVE is non-nil, the package is not removed from (package-desc-name pkg-used-elsewhere-by))) (t (add-hook 'post-command-hook #'package-menu--post-refresh) - (package--delete-directory dir) + (package--delete-directory dir pkg-desc) ;; Remove NAME-VERSION.signed and NAME-readme.txt files. ;; ;; NAME-readme.txt files are no longer created, but they -- cgit v1.2.3 From 8de7995ae6388e5ae5418cb6af579281121f14a4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 8 Oct 2022 12:19:40 -0400 Subject: package.el: Understand a few more variations in tarball formats * lisp/emacs-lisp/package.el (package-untar-buffer): Fix thinko. (package-tar-file-info): Handle the case where the first file is in a subdirectory. * test/lisp/emacs-lisp/package-tests.el (package-test-bug58367): New test. * test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar: * test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar: New files. --- lisp/emacs-lisp/package.el | 10 ++++++--- .../package-resources/ustar-withsub-0.1.tar | Bin 0 -> 10240 bytes .../package-resources/v7-withsub-0.1.tar | Bin 0 -> 10240 bytes test/lisp/emacs-lisp/package-tests.el | 24 +++++++++++++++++++-- 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar create mode 100644 test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4268f7d27a7..d619142d64c 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -930,7 +930,7 @@ untar into a directory named DIR; otherwise, signal an error." (or (string-match regexp name) ;; Tarballs created by some utilities don't list ;; directories with a trailing slash (Bug#13136). - (and (string-equal dir name) + (and (string-equal (expand-file-name dir) name) (eq (tar-header-link-type tar-data) 5)) (error "Package does not untar cleanly into directory %s/" dir))))) (tar-untar-buffer)) @@ -1192,8 +1192,12 @@ Return the pkg-desc, with desc-kind set to KIND." "Find package information for a tar file. The return result is a `package-desc'." (cl-assert (derived-mode-p 'tar-mode)) - (let* ((dir-name (file-name-directory - (tar-header-name (car tar-parse-info)))) + (let* ((dir-name (named-let loop + ((filename (tar-header-name (car tar-parse-info)))) + (let ((dirname (file-name-directory filename))) + ;; The first file can be in a subdir: look for the top. + (if dirname (loop (directory-file-name dirname)) + (file-name-as-directory filename))))) (desc-file (package--description-file dir-name)) (tar-desc (tar-get-file-descriptor (concat dir-name desc-file)))) (unless tar-desc diff --git a/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar b/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar new file mode 100644 index 00000000000..009c4fc420c Binary files /dev/null and b/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar differ diff --git a/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar b/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar new file mode 100644 index 00000000000..16c79e529f4 Binary files /dev/null and b/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar differ diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index b903cd781ba..ffe4d7cd5fd 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -275,11 +275,31 @@ Must called from within a `tar-mode' buffer." (let* ((pkg-el "multi-file-0.2.3.tar") (source-file (expand-file-name pkg-el (ert-resource-directory)))) - (package-initialize) (should-not (package-installed-p 'multie-file)) (package-install-file source-file) (should (package-installed-p 'multi-file)) - (package-delete (cadr (assq 'multi-file package-alist)))) + (package-delete (cadr (assq 'multi-file package-alist)))))) + +(ert-deftest package-test-bug58367 () + "Check variations in tarball formats." + (with-package-test (:basedir (ert-resource-directory)) + (package-initialize) + + ;; A package whose first entry is the main dir but without trailing /. + (let* ((pkg-el "ustar-withsub-0.1.tar") + (source-file (expand-file-name pkg-el (ert-resource-directory)))) + (should-not (package-installed-p 'ustar-withsub)) + (package-install-file source-file) + (should (package-installed-p 'ustar-withsub)) + (package-delete (cadr (assq 'ustar-withsub package-alist)))) + + ;; A package whose first entry is a file in a subdir. + (let* ((pkg-el "v7-withsub-0.1.tar") + (source-file (expand-file-name pkg-el (ert-resource-directory)))) + (should-not (package-installed-p 'v7-withsub)) + (package-install-file source-file) + (should (package-installed-p 'v7-withsub)) + (package-delete (cadr (assq 'v7-withsub package-alist)))) )) (ert-deftest package-test-install-file-EOLs () -- cgit v1.2.3 From 4a25205ec121926ffdbe2beee64dc10241b4cc6c Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 12 Oct 2022 14:49:23 +0200 Subject: Only use 'package-vc-repository-store' if necessary * lisp/emacs-lisp/package-vc.el (package-vc-unpack): Check if the upstream data indicates a custom lisp directory. * lisp/emacs-lisp/package.el (package--delete-directory): Adapt accordingly. --- lisp/emacs-lisp/package-vc.el | 26 +++++++++++++++----------- lisp/emacs-lisp/package.el | 26 +++++++++++++------------- 2 files changed, 28 insertions(+), 24 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index f5cf90963fa..fd8639e4c54 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -155,8 +155,6 @@ The output is written out into PKG-FILE." (defun package-vc-unpack (pkg-desc) "Install the package described by PKG-DESC." - (unless (file-exists-p package-vc-repository-store) - (make-directory package-vc-repository-store t)) (let* ((name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) (pkg-dir (expand-file-name dirname package-user-dir))) @@ -169,12 +167,17 @@ The output is written out into PKG-FILE." (`(,backend ,repo ,dir ,branch) (or (alist-get :upstream attr) (error "Source package has no repository"))) - (repo-dir (file-name-concat - package-vc-repository-store - ;; FIXME: We aren't sure this directory - ;; will be unique, but we can try other - ;; names to avoid an unnecessary error. - (file-name-base repo)))) + (repo-dir + (if (null dir) + pkg-dir + (unless (file-exists-p package-vc-repository-store) + (make-directory package-vc-repository-store t)) + (file-name-concat + package-vc-repository-store + ;; FIXME: We aren't sure this directory + ;; will be unique, but we can try other + ;; names to avoid an unnecessary error. + (file-name-base repo))))) ;; Clone the repository into `repo-dir'. (make-directory (file-name-directory repo-dir) t) @@ -182,9 +185,10 @@ The output is written out into PKG-FILE." (vc-clone backend repo repo-dir)) (error "Failed to clone %s from %s" name repo)) - ;; Link from the right position in `repo-dir' to the package - ;; directory in the ELPA store. - (make-symbolic-link (file-name-concat repo-dir dir) pkg-dir) + (unless (eq pkg-dir repo-dir) + ;; Link from the right position in `repo-dir' to the package + ;; directory in the ELPA store. + (make-symbolic-link (file-name-concat repo-dir dir) pkg-dir)) (when-let ((default-directory repo-dir) (rev (or (alist-get :rev attr) branch))) (vc-retrieve-tag pkg-dir rev)) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2748adddfb6..106b7d5a8de 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2416,19 +2416,19 @@ compiled." (cl-loop for file in (directory-files-recursively dir "\\.el\\'") do (comp-clean-up-stale-eln (comp-el-to-eln-filename file)))) - (cond - ((not (package-vc-p pkg-desc)) - (delete-directory dir t)) - ((progn - (require 'package-vc) ;load `package-vc-repository-store' - (file-in-directory-p dir package-vc-repository-store)) - (delete-directory - (expand-file-name - (car (file-name-split - (file-relative-name dir package-vc-repository-store))) - package-vc-repository-store) - t) - (delete-file (directory-file-name dir))))) + (if (and (package-vc-p pkg-desc) + (require 'package-vc) ;load `package-vc-repository-store' + (file-in-directory-p dir package-vc-repository-store)) + (progn + (delete-directory + (expand-file-name + (car (file-name-split + (file-relative-name dir package-vc-repository-store))) + package-vc-repository-store) + t) + (delete-file (directory-file-name dir))) + (delete-directory dir t))) + (defun package-delete (pkg-desc &optional force nosave) "Delete package PKG-DESC. -- cgit v1.2.3 From 3f7e746b514759b66c28d30ead24be08f0e01717 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 16 Oct 2022 12:57:51 +0200 Subject: Delete 'package-contact-maintainer' * doc/emacs/package.texi: Remove mention. * etc/NEWS: Remove mention. * lisp/emacs-lisp/package.el: Remove the command. --- doc/emacs/package.texi | 8 +++----- etc/NEWS | 5 ----- lisp/emacs-lisp/package.el | 14 -------------- 3 files changed, 3 insertions(+), 24 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 087e506d6c4..584f85567f2 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -553,16 +553,14 @@ be regarded just like any other package, that can be updated (using @code{package-update}), deleted (using @code{package-delete}) and viewed in the package listing. -@findex package-contact-maintainer @findex package-report-bug @findex package-vc-prepare-patch With the source checkout, you might want to reproduce a bug against the current development head or implement a new feature to scratch an itch. If the package metadata indicates that a maintainer can be -contacted via Email, you can use the commands -@code{package-contact-maintainer} to send them a message, or -@code{package-report-bug} to report a bug that will include all the -user options that you have customised. Patches can be sent out using +contacted via Email, you can use the command @code{package-report-bug} +to report a bug that will include all the user options that you have +customised. Patches can be sent out using @code{package-vc-prepare-patch}, that makes use of @code{vc-prepare-patch} under the hold (@pxref{Preparing Patches}). diff --git a/etc/NEWS b/etc/NEWS index 965d2689b20..0b33718135c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1577,11 +1577,6 @@ symbolic link from the usual package directory to the checkout. This command allows you to send patches to package maintainers, for packages checked out using 'package-vc-install'. -+++ -*** New command 'package-contact-maintainer' -This command gives you a generic way to send messages to package -maintainers. - +++ *** New command 'package-report-bug' This command helps you compose an email for sending bug reports to diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 92f15337671..6c92ff0ba74 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2997,7 +2997,6 @@ either a full name or nil, and EMAIL is a valid email address." "r" #'revert-buffer "~" #'package-menu-mark-obsolete-for-deletion "w" #'package-browse-url - "m" #'package-contact-maintainer "b" #'package-report-bug "x" #'package-menu-execute "h" #'package-menu-quick-help @@ -4551,19 +4550,6 @@ will be signalled in that case." (package--print-email-button maint) (string-trim (substring-no-properties (buffer-string)))))))) -;; TODO: Allow attaching a patch to send directly to the maintainer. -;; Ideally this should be able to detect the local changes, convert -;; these into patches. -(defun package-contact-maintainer (desc) - "Prepare a message to send to the maintainers of a package. -DESC must be a `package-desc' object." - (interactive (list (package--query-desc package-archive-contents)) - package-menu-mode) - (let ((maint (package-maintainers desc)) - (name (package-desc-name desc)) - (subject (read-string "Subject: "))) - (compose-mail maint (format "[%s] %s" name subject)))) - (defun package-report-bug (desc) "Prepare a message to send to the maintainers of a package. DESC must be a `package-desc' object." -- cgit v1.2.3 From 5134eb02cf5cda16455e1b59b29ec82d491b115e Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 16 Oct 2022 13:37:29 +0200 Subject: Mark source packages as always updatable * lisp/emacs-lisp/package.el (package--updateable-packages): Add check for source packages. --- lisp/emacs-lisp/package.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6c92ff0ba74..245e41ee74a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2249,12 +2249,13 @@ to install it but still mark it as selected." #'car (seq-filter (lambda (elt) - (let ((available - (assq (car elt) package-archive-contents))) - (and available - (version-list-< - (package-desc-version (cadr elt)) - (package-desc-version (cadr available)))))) + (or (let ((available + (assq (car elt) package-archive-contents))) + (and available + (version-list-< + (package-desc-version (cadr elt)) + (package-desc-version (cadr available))))) + (package-vc-p (cadr (assq (car elt) package-alist))))) package-alist))) ;;;###autoload -- cgit v1.2.3 From 5d60ea47f6625dc7da6ceb475dc624e33deb198f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 18 Oct 2022 22:34:11 +0200 Subject: 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'. --- lisp/emacs-lisp/package-vc.el | 191 ++++++++++++++++++++++++++++-------------- lisp/emacs-lisp/package.el | 15 +++- 2 files changed, 141 insertions(+), 65 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 7098de2ece3..c420c5f87a7 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -42,6 +42,7 @@ (require 'lisp-mnt) (require 'vc) (require 'seq) +(require 'map) (require 'xdg) (defgroup package-vc nil @@ -94,6 +95,79 @@ :type 'directory :version "29.1") +(defcustom package-vc-default-backend 'Git + "VC backend to use as a fallback." + :type `(choice + ,@(mapcar (lambda (b) (list 'const b)) + vc-handled-backends)) + :version "29.1") + +(defvar package-vc-archive-spec-alist nil + "List of package specifications for each archive. +The list maps package names as string to plist. Valid keys +include + + `:url' (string) + +The URL of the repository used to fetch the package source. + + `:branch' (string) + +If given, the branch to check out after cloning the directory. + + `:lisp-dir' (string) + +The repository-relative directory to use for loading the Lisp +sources. If not given, the value defaults to the root directory +of the repository. + + `:main-file' (string) + +The main file of the project, relevant to gather package +metadata. If not given, the assumed default is the package named +with \".el\" concatenated to the end. + +All other values are ignored.") + +(defun pacakge-vc-desc->spec (pkg-desc &optional name) + "Retrieve the package specification for PKG-DESC. +The optional argument NAME can be used to override the default +name for PKG-DESC." + (let ((spec (alist-get + (or name (package-desc-name pkg-desc)) + (alist-get (intern (package-desc-archive pkg-desc)) + package-vc-archive-spec-alist) + nil nil #'string=))) + spec)) + +(defun package-vc--read-archive-data (archive) + "Update `package-vc-archive-spec-alist' with the contents of ARCHIVE. +This function is meant to be used as a hook for +`package--read-archive-hook'." + (let* ((contents-file (expand-file-name + (format "archives/%s/elpa-packages" archive) + package-user-dir))) + (when (file-exists-p contents-file) + (with-temp-buffer + (let ((coding-system-for-read 'utf-8)) + (insert-file-contents contents-file)) + (setf (alist-get (intern archive) package-vc-archive-spec-alist) + (read (current-buffer))))))) + +(defun package-vc--download-and-read-archives (&optional async) + "Download specifications of all `package-archives' and read them. +Populate `package-vc-archive-spec-alist' with the result. + +If optional argument ASYNC is non-nil, perform the downloads +asynchronously." + (dolist (archive package-archives) + (condition-case-unless-debug nil + (package--download-one-archive archive "elpa-packages" async) + (error (message "Failed to download `%s' archive." (car archive)))))) + +(add-hook 'package-read-archive-hook #'package-vc--read-archive-data 20) +(add-hook 'package-refresh-contents-hook #'package-vc--download-and-read-archives 20) + (defun package-vc-commit (pkg) "Extract the commit of a development package PKG." (cl-assert (package-vc-p pkg)) @@ -120,21 +194,6 @@ return it finally return "0")) -(defun package-vc-main-file (pkg-desc) - "Return the main file of the package PKG-DESC. -If no file can be found that appends \".el\" to the end of the -package name, the file with the closest file name is chosen." - (let* ((default-directory (package-desc-dir pkg-desc)) - (best (format "%s.el" (package-desc-name pkg-desc))) - (distance most-positive-fixnum) next-best) - (if (file-exists-p best) - (expand-file-name best) - (dolist (file (directory-files default-directory nil "\\.el\\'")) - (let ((distance* (string-distance best file))) - (when (< distance* distance) - (setq distance distance* next-best file)))) - next-best))) - (defun package-vc-generate-description-file (pkg-desc pkg-file) "Generate a package description file for PKG-DESC. The output is written out into PKG-FILE." @@ -142,9 +201,17 @@ The output is written out into PKG-FILE." ;; Infer the subject if missing. (unless (package-desc-summary pkg-desc) (setf (package-desc-summary pkg-desc) - (or (and-let* ((pkg (cadr (assq name package-archive-contents)))) + (or (package-desc-summary pkg-desc) + (and-let* ((pkg (cadr (assq name package-archive-contents)))) (package-desc-summary pkg)) - (lm-summary (package-vc-main-file pkg-desc)) + (and-let* ((pkg-spec (pacakge-vc-desc->spec pkg-desc)) + (main-file (plist-get pkg-spec :main-file))) + (lm-summary main-file)) + (and-let* ((main-file (expand-file-name + (format "%s.el" name) + (package-desc-dir pkg-desc))) + ((file-exists-p main-file))) + (lm-summary main-file)) package--default-summary))) (let ((print-level nil) (print-quoted t) @@ -241,8 +308,13 @@ The output is written out into PKG-FILE." (cons (package-desc-name pkg-desc) package-selected-packages))) -(defun package-vc-unpack (pkg-desc) - "Install the package described by PKG-DESC." +(defun package-vc-unpack (pkg-desc pkg-spec &optional rev) + "Install the package described by PKG-DESC. +PKG-SPEC is a package specification is a property list describing +how to fetch and build the package PKG-DESC. See +`package-vc-archive-spec-alist' for details. The optional argument +REV specifies a specific revision to checkout. This overrides +the `:brach' attribute in PKG-SPEC." (let* ((name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) (pkg-dir (expand-file-name dirname package-user-dir))) @@ -251,12 +323,10 @@ The output is written out into PKG-FILE." (if (yes-or-no-p "Overwrite previous checkout?") (package--delete-directory pkg-dir pkg-desc) (error "There already exists a checkout for %s" name))) - (pcase-let* ((attr (package-desc-extras pkg-desc)) - (`(,backend ,repo ,dir ,branch) - (or (alist-get :upstream attr) - (error "Source package has no repository"))) + (pcase-let* ((extras (package-desc-extras pkg-desc)) + ((map :url :branch :lisp-dir) pkg-spec) (repo-dir - (if (null dir) + (if (null lisp-dir) pkg-dir (unless (file-exists-p package-vc-repository-store) (make-directory package-vc-repository-store t)) @@ -265,21 +335,21 @@ The output is written out into PKG-FILE." ;; FIXME: We aren't sure this directory ;; will be unique, but we can try other ;; names to avoid an unnecessary error. - (file-name-base repo))))) + (file-name-base url))))) ;; Clone the repository into `repo-dir' if necessary (unless (file-exists-p repo-dir) (make-directory (file-name-directory repo-dir) t) - (unless (setf (car (alist-get :upstream attr)) - (vc-clone backend repo repo-dir)) - (error "Failed to clone %s from %s" name repo))) + (unless (vc-clone (or (alist-get :vc-backend extras) + package-vc-default-backend) + url repo-dir) + (error "Failed to clone %s from %s" name url))) (unless (eq pkg-dir repo-dir) ;; Link from the right position in `repo-dir' to the package ;; directory in the ELPA store. - (make-symbolic-link (file-name-concat repo-dir dir) pkg-dir)) - (when-let ((default-directory repo-dir) - (rev (or (alist-get :rev attr) branch))) + (make-symbolic-link (file-name-concat repo-dir lisp-dir) pkg-dir)) + (when-let* ((default-directory repo-dir) (rev (or rev branch))) (vc-retrieve-tag pkg-dir rev))) (package-vc-unpack-1 pkg-desc pkg-dir))) @@ -288,17 +358,14 @@ The output is written out into PKG-FILE." "Generate a list of packages with VC data." (seq-filter (lambda (pkg) - (let ((extras (package-desc-extras (cadr pkg)))) - (or (alist-get :vc extras) - ;; If we have no explicit VC data, we can try a kind of - ;; heuristic and use the URL header, that might already be - ;; pointing towards a repository, and use that as a backup - (and-let* ((url (alist-get :url extras)) - (backend (alist-get url package-vc-heusitic-alist - nil nil #'string-match-p))) - (setf (alist-get :vc (package-desc-extras (cadr pkg))) - (list backend url)) - t)))) + (or (pacakge-vc-desc->spec (cadr pkg)) + ;; If we have no explicit VC data, we can try a kind of + ;; heuristic and use the URL header, that might already be + ;; pointing towards a repository, and use that as a backup + (and-let* ((extras (package-desc-extras (cadr pkg))) + (url (alist-get :url extras)) + (backend (alist-get url package-vc-heusitic-alist + nil nil #'string-match-p)))))) package-archive-contents)) (defun package-vc-update (pkg-desc) @@ -315,7 +382,6 @@ The output is written out into PKG-FILE." (package-vc-unpack-1 pkg-desc default-directory))) (package-vc-unpack-1 pkg-desc default-directory)))) - ;;;###autoload (defun package-vc-install (name-or-url &optional name rev) "Fetch the source of NAME-OR-URL. @@ -337,27 +403,26 @@ be requested using REV." (name (file-name-base input))) (list input (intern (string-remove-prefix "emacs-" name)))))) (package--archives-initialize) - (package-vc-unpack - (cond - ((and (stringp name-or-url) - (url-type (url-generic-parse-url name-or-url))) - (package-desc-create - :name (or name (intern (file-name-base name-or-url))) - :kind 'vc - :extras `((:upstream . ,(list nil name-or-url nil nil)) - (:rev . ,rev)))) - ((when-let* ((desc (cadr (assoc name-or-url package-archive-contents - #'string=))) - (upstream (or (alist-get :vc (package-desc-extras desc)) - (user-error "Package has no VC data")))) + (cond + ((and-let* ((stringp name-or-url) + (backend (alist-get name-or-url + package-vc-heusitic-alist + nil nil #'string-match-p))) + (package-vc-unpack (package-desc-create - :name (if (stringp name-or-url) - (intern name-or-url) - name-or-url) - :kind 'vc - :extras `((:upstream . ,upstream) - (:rev . ,rev))))) - ((user-error "Unknown package to fetch: %s" name-or-url))))) + :name (or name (intern (file-name-base name-or-url))) + :kind 'vc) + (list :vc-backend backend :url name-or-url) + rev))) + ((and-let* ((desc (assoc name-or-url package-archive-contents #'string=))) + (package-vc-unpack + (let ((copy (copy-package-desc (cadr desc)))) + (setf (package-desc-kind copy) 'vc) + copy) + (or (pacakge-vc-desc->spec (cadr desc)) + (user-error "Package has no VC data")) + rev))) + ((user-error "Unknown package to fetch: %s" name-or-url)))) ;;;###autoload (defalias 'package-checkout #'package-vc-install) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 245e41ee74a..425abfeea5c 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1650,13 +1650,19 @@ This is the value of `package-archive-priorities' last time by arbitrary functions to decide whether it is necessary to call it again.") +(defvar package-read-archive-hook (list #'package-read-archive-contents) + "List of functions to call to read the archive contents. +Each function must take an optional argument, a symbol indicating +what archive to read in. The symbol ought to be a key in +`package-archives'.") + (defun package-read-all-archive-contents () "Read cached archive file for all archives in `package-archives'. If successful, set or update `package-archive-contents'." (setq package-archive-contents nil) (setq package--old-archive-priorities package-archive-priorities) (dolist (archive package-archives) - (package-read-archive-contents (car archive)))) + (run-hook-with-args 'package-read-archive-hook (car archive)))) ;;;; Package Initialize @@ -1832,6 +1838,11 @@ asynchronously." (error (message "Failed to download `%s' archive." (car archive)))))) +(defvar package-refresh-contents-hook (list #'package--download-and-read-archives) + "List of functions to call to refresh the package archive. +Each function may take an optional argument indicating that the +operation ought to be executed asynchronously.") + ;;;###autoload (defun package-refresh-contents (&optional async) "Download descriptions of all configured ELPA packages. @@ -1850,7 +1861,7 @@ downloads in the background." (condition-case-unless-debug error (package-import-keyring default-keyring) (error (message "Cannot import default keyring: %S" (cdr error)))))) - (package--download-and-read-archives async)) + (run-hook-with-args 'package-refresh-contents-hook async)) ;;; Dependency Management -- cgit v1.2.3 From db2ed9f333879e5ac283fb48c8b06ed4022f0af9 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 26 Oct 2022 22:41:09 +0200 Subject: ; Fix several symbol name typos --- lisp/abbrev.el | 2 +- lisp/cedet/ede/locate.el | 2 +- lisp/cedet/semantic/wisent.el | 2 +- lisp/ecomplete.el | 2 +- lisp/emacs-lisp/backtrace.el | 2 +- lisp/emacs-lisp/byte-opt.el | 2 +- lisp/emacs-lisp/comp-cstr.el | 2 +- lisp/emacs-lisp/package.el | 3 +-- lisp/erc/erc-capab.el | 2 +- lisp/erc/erc-networks.el | 2 +- lisp/follow.el | 2 +- lisp/gnus/gnus-start.el | 2 +- lisp/gnus/smime.el | 2 +- lisp/icomplete.el | 2 +- lisp/image/image-dired-external.el | 2 +- lisp/net/rcirc.el | 2 +- lisp/net/sieve-manage.el | 2 +- lisp/org/org-agenda.el | 2 +- lisp/org/ox-ascii.el | 2 +- lisp/progmodes/eglot.el | 4 ++-- lisp/progmodes/flymake.el | 5 +++-- lisp/progmodes/gdb-mi.el | 2 +- lisp/progmodes/verilog-mode.el | 4 ++-- lisp/subr.el | 4 ++-- lisp/transient.el | 2 +- test/src/comp-tests.el | 2 +- test/src/emacs-module-tests.el | 2 +- 27 files changed, 32 insertions(+), 32 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/abbrev.el b/lisp/abbrev.el index a4f0196a789..2ca8e25dac7 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -1221,7 +1221,7 @@ SORTFUN is passed to `sort' to change the default ordering." (defface abbrev-table-name '((t :inherit font-lock-function-name-face)) - "Face used for displaying the abbrev table name in `edit-abbrev-mode'." + "Face used for displaying the abbrev table name in `edit-abbrevs-mode'." :version "29.1") (defvar edit-abbrevs-mode-font-lock-keywords diff --git a/lisp/cedet/ede/locate.el b/lisp/cedet/ede/locate.el index b9b1194ccce..dc465a79f2b 100644 --- a/lisp/cedet/ede/locate.el +++ b/lisp/cedet/ede/locate.el @@ -172,7 +172,7 @@ You cannot create projects for the baseclass." (defclass ede-locate-locate (ede-locate-base) () "EDE Locator using the locate command. -Configure the Emacs `locate-program' variable to also +Configure the Emacs `locate-command' variable to also configure the use of EDE locate.") (cl-defmethod ede-locate-ok-in-project ((_loc (subclass ede-locate-locate)) diff --git a/lisp/cedet/semantic/wisent.el b/lisp/cedet/semantic/wisent.el index 55eeef453ea..b13dc994568 100644 --- a/lisp/cedet/semantic/wisent.el +++ b/lisp/cedet/semantic/wisent.el @@ -38,7 +38,7 @@ (defvar wisent-lex-lookahead nil "Extra lookahead token. -When non-nil it is directly returned by `wisent-lex-function'.") +When non-nil it is directly returned by `wisent-lexer-function'.") (defmacro wisent-lex-eoi () "Return an End-Of-Input lexical token. diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el index dfee0734817..b532ef95e7f 100644 --- a/lisp/ecomplete.el +++ b/lisp/ecomplete.el @@ -190,7 +190,7 @@ FORCE is non-nil, use TEXT exactly as is." If CHOOSE, allow the user to choose interactively between the matches. -Auto-select when `ecomplete-message-display-abbrev-auto-select' is +Auto-select when `ecomplete-auto-select' is non-nil and there is only a single completion option available." (let* ((matches (ecomplete-get-matches type word)) (match-list (and matches (split-string matches "\n"))) diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index 4ffe6f573c6..d461698c88e 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el @@ -753,7 +753,7 @@ property for use by navigation." (defun backtrace--line-length-or-nil () "Return `backtrace-line-length' if valid, nil else." - ;; mirror the logic in `cl-print-to-string-with-limits' + ;; mirror the logic in `cl-print-to-string-with-limit' (and (natnump backtrace-line-length) (not (zerop backtrace-line-length)) backtrace-line-length)) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 5ef2d7fe827..a7e1df3622d 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -178,7 +178,7 @@ Earlier variables shadow later ones with the same name.") ;; be displayed when the function's source file will be ;; compiled anyway, but more importantly we would otherwise ;; emit spurious warnings here because we don't have the full - ;; context, such as `declare-functions' placed earlier in the + ;; context, such as `declare-function's placed earlier in the ;; source file's code or `with-suppressed-warnings' that ;; surrounded the `defsubst'. (byte-compile-warnings nil)) diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 8cff06a383a..1338ae6e139 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -96,7 +96,7 @@ Integer values are handled in the `range' slot.") `comp-common-supertype'.") (subtype-p-mem (make-hash-table :test #'equal) :type hash-table :documentation "Serve memoization for -`comp-subtype-p-mem'.") +`comp-cstr-ctxt-subtype-p-mem'.") (union-1-mem-no-range (make-hash-table :test #'equal) :type hash-table :documentation "Serve memoization for `comp-cstr-union-1'.") diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index d619142d64c..f3077cbbdb8 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -835,8 +835,7 @@ byte-compilation of the new package to fail." If DEPS is non-nil, also activate its dependencies (unless they are already activated). If RELOAD is non-nil, also `load' any files inside the package which -correspond to previously loaded files (those returned by -`package--list-loaded-files')." +correspond to previously loaded files." (let* ((name (package-desc-name pkg-desc)) (pkg-dir (package-desc-dir pkg-desc))) (unless pkg-dir diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el index c590b45fd21..8759282a2ae 100644 --- a/lisp/erc/erc-capab.el +++ b/lisp/erc/erc-capab.el @@ -62,7 +62,7 @@ ;; You can customize the prefix and the face used to display it, ;; `erc-capab-identify-unidentified'. If the value of ;; `erc-capab-identify-prefix' is nil or you disable this module (see -;; `erc-capab-identify-disable'), no prefix will be inserted, but the +;; `erc-capab-identify-activated'), no prefix will be inserted, but the ;; flag sent by the server will still be stripped. ;;; Code: diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index 2c8f8fb72bb..d8fb8798198 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -1256,7 +1256,7 @@ Signal an error when the network cannot be determined." ;; but aren't being proxied through to a real network. The ;; service may send a 422 but no NETWORK param (or *any* 005s). (let ((m (concat "Failed to determine network. Please set entry for " - erc-server-announced-name " in `erc-network-alist'."))) + erc-server-announced-name " in `erc-networks-alist'."))) (erc-display-error-notice parsed m) (erc-error "Failed to determine network"))) ; beep (setq erc-network name)) diff --git a/lisp/follow.el b/lisp/follow.el index adf1c1b762d..c26949985e7 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -1301,7 +1301,7 @@ non-first windows in Follow mode." "The buffer current at the last call to `follow-adjust-window' or nil. `follow-mode' is not necessarily enabled in this buffer.") -;; This function is added to `pre-display-function' and is thus called +;; This function is added to `pre-redisplay-function' and is thus called ;; before each redisplay operation. It supersedes (2018-09) the ;; former use of the post command hook, and now does the right thing ;; when a program calls `redisplay' or `sit-for'. diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 8d9e50059fd..4963fd083f7 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -1810,7 +1810,7 @@ where unread is an integer count of calculated unread messages (or nil), and info is a regular gnus info entry. The info element is shared with the same element of -`gnus-newrc-alist', so as to conserve space." +`gnus-newsrc-alist', so as to conserve space." (let ((alist gnus-newsrc-alist) (ohashtb gnus-newsrc-hashtb) info method gname rest methods) diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el index 7bb116d0c54..409befc2426 100644 --- a/lisp/gnus/smime.el +++ b/lisp/gnus/smime.el @@ -152,7 +152,7 @@ certificate." (defcustom smime-CA-file (car (gnutls-trustfiles)) "File containing certificates for CAs you trust. The file should contain certificates in PEM format. By default, -this is initialized from the `gnutls-trusfiles' variable." +this is initialized from the `gnutls-trustfiles' variable." :version "29.1" :type '(choice (const :tag "none" nil) file)) diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 19afdaa278e..0a63e0a1dd5 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -139,7 +139,7 @@ See `icomplete-delay-completions-threshold'." (defvar icomplete-in-buffer nil "If non-nil, also use Icomplete when completing in non-mini buffers. -This affects commands like `complete-in-region', but not commands +This affects commands like `completion-in-region', but not commands that use their own completions setup.") (defcustom icomplete-minibuffer-setup-hook nil diff --git a/lisp/image/image-dired-external.el b/lisp/image/image-dired-external.el index 026a84560da..b1f8a6c2285 100644 --- a/lisp/image/image-dired-external.el +++ b/lisp/image/image-dired-external.el @@ -216,7 +216,7 @@ Each item has the form (ORIGINAL-FILE TARGET-FILE).") "Maximum number of concurrent jobs permitted for generating images. Increase at own risk. If you want to experiment with this, consider setting `image-dired-debug' to a non-nil value to see -the time spent on generating thumbnails. Run `image-clear-cache' +the time spent on generating thumbnails. Run `clear-image-cache' and remove the cached thumbnail files between each trial run.") (defun image-dired-pngnq-thumb (spec) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index eadaf00c4b8..b7eeab1735f 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1049,7 +1049,7 @@ Each element has the form (TYPE HANDLE), where TYPE is a string and HANDLE is either the symbol `immediate' or `deferred'. Messages in an immediate batch are handled just like regular messages, while deferred messages are stored in -`rcirc-batch-messages'.") +`rcirc-batched-messages'.") (defvar-local rcirc-batch-attributes nil "Alist mapping batch IDs to parameters.") diff --git a/lisp/net/sieve-manage.el b/lisp/net/sieve-manage.el index 381e1fcd4f8..b2caa62e51f 100644 --- a/lisp/net/sieve-manage.el +++ b/lisp/net/sieve-manage.el @@ -385,7 +385,7 @@ Return the buffer associated with the connection." (defun sieve-manage-open (server &optional port stream auth buffer) "Open a network connection to a managesieve SERVER (string). Optional argument PORT is port number (integer) on remote server. -Optional argument STREAM is any of `sieve-manage-streams' (a symbol). +Optional argument STREAM is any of `sieve-manage-stream' (a symbol). Optional argument AUTH indicates authenticator to use, see `sieve-manage-authenticators' for available authenticators. If nil, chooses the best stream the server is capable of. diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 35f19cf03b4..e43950f13a3 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -5306,7 +5306,7 @@ of what a project is and how to check if it stuck, customize the variable "Hook run when the fancy diary buffer is cleaned up.") (defun org-agenda-cleanup-fancy-diary () - "Remove unwanted stuff in buffer created by `fancy-diary-display'. + "Remove unwanted stuff in buffer created by `diary-fancy-display'. This gets rid of the date, the underline under the date, and the dummy entry installed by Org mode to ensure non-empty diary for each date. It also removes lines that contain only whitespace." diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el index 76a1a71fabe..1452f36c11e 100644 --- a/lisp/org/ox-ascii.el +++ b/lisp/org/ox-ascii.el @@ -456,7 +456,7 @@ Optional argument JUSTIFY can specify any type of justification among `left', `center', `right' or `full'. A nil value is equivalent to `left'. For a justification that doesn't also fill string, see `org-ascii--justify-lines' and -`org-ascii--justify-block'. +`org-ascii--justify-element'. Return nil if S isn't a string." (when (stringp s) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 1b983e94d79..c5870618372 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -618,7 +618,7 @@ Honour `eglot-strict-mode'." (cl-defmacro eglot--dcase (obj &rest clauses) "Like `pcase', but for the LSP object OBJ. CLAUSES is a list (DESTRUCTURE FORMS...) where DESTRUCTURE is -treated as in `eglot-dbind'." +treated as in `eglot--dbind'." (declare (indent 1) (debug (sexp &rest (sexp &rest form)))) (let ((obj-once (make-symbol "obj-once"))) `(let ((,obj-once ,obj)) @@ -2464,7 +2464,7 @@ may be called multiple times (respecting the protocol of (defun eglot-xref-backend () "Eglot xref backend." 'eglot) (defvar eglot--temp-location-buffers (make-hash-table :test #'equal) - "Helper variable for `eglot--handling-xrefs'.") + "Helper variable for `eglot--collecting-xrefs'.") (defvar eglot-xref-lessp-function #'ignore "Compare two `xref-item' objects for sorting.") diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 5bbbfa822fd..294cf47087c 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1360,8 +1360,9 @@ default) no filter is applied." flymake-mode-line-warning-counter flymake-mode-line-note-counter "]") "Mode-line construct for formatting Flymake diagnostic counters. -This is a suitable place for placing the `flymake-error-counter', -`flymake-warning-counter' and `flymake-note-counter' constructs. +This is a suitable place for placing the `flymake-mode-line-error-counter', +`flymake-mode-line-warning-counter' and `flymake-mode-line-note-counter' +constructs. Separating each of these with space is not necessary." :type '(repeat (choice string symbol))) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 0de3d213a4d..dff677e785f 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -4359,7 +4359,7 @@ member." "Mapping of local variable names to a string with their value.") (defun gdb-locals-values-handler-custom () - "Store the values of local variables in `gdb-locals-value-map'." + "Store the values of local variables in `gdb-locals-values-table'." (let ((locals-list (bindat-get-field (gdb-mi--partial-output) 'variables))) (dolist (local locals-list) (let ((name (bindat-get-field local 'name)) diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index d6b8edaa365..310a9be4f6e 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -9630,7 +9630,7 @@ Returns REGEXP and list of ( (signal_name connection_name)... )." (defun verilog-read-auto-template (module) "Look for an auto_template for the instantiation of the given MODULE. -If found returns `verilog-read-auto-template-inside' structure." +If found returns `verilog-read-auto-template-middle' structure." (save-excursion ;; Find beginning (let ((pt (point))) @@ -10024,7 +10024,7 @@ Used for __FLAGS__ in `verilog-expand-command'." (defvar verilog-dir-cache-preserving nil "If true, the directory cache is enabled, and file system changes are ignored. -See `verilog-dir-exists-p' and `verilog-dir-files'.") +See `verilog-dir-file-exists-p' and `verilog-dir-files'.") ;; If adding new cached variable, add also to verilog-preserve-dir-cache (defvar verilog-dir-cache-list nil diff --git a/lisp/subr.el b/lisp/subr.el index e49c22158f9..7dfe0ac66c0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1296,7 +1296,7 @@ KEY is a string or vector representing a sequence of keystrokes." (defun local-key-binding (keys &optional accept-default) "Return the binding for command KEYS in current local keymap only. -This is a legacy function; see `keymap-local-binding' for the +This is a legacy function; see `keymap-local-lookup' for the recommended function to use instead. KEYS is a string or vector, a sequence of keystrokes. @@ -1310,7 +1310,7 @@ about this." (defun global-key-binding (keys &optional accept-default) "Return the binding for command KEYS in current global keymap only. -This is a legacy function; see `keymap-global-binding' for the +This is a legacy function; see `keymap-global-lookup' for the recommended function to use instead. KEYS is a string or vector, a sequence of keystrokes. diff --git a/lisp/transient.el b/lisp/transient.el index a4158589706..f7920e414f1 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -3501,7 +3501,7 @@ Optional support for popup buttons is also implemented here." (cl-defmethod transient-format-description ((obj transient-child)) "The `description' slot may be a function, in which case that is -called inside the correct buffer (see `transient-insert-group') +called inside the correct buffer (see `transient--insert-group') and its value is returned to the caller." (and-let* ((desc (oref obj description))) (if (functionp desc) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 1edbd1777c6..734b4a0d221 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -823,7 +823,7 @@ Return a list of results." (should (= (comp-tests-tco-f 1 0 10) 55)))) (defun comp-tests-fw-prop-checker-1 (_) - "Check that inside `comp-tests-fw-prop-f' `concat' and `length' are folded." + "Check that inside `comp-tests-fw-prop-1-f' `concat' and `length' are folded." (should (cl-notany #'identity diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 1099fd04678..a9a45d54632 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -263,7 +263,7 @@ must evaluate to a regular expression string." (ert-deftest module--test-assertions--load-non-live-object-with-global-copy () "Check that -module-assertions verify that non-live objects aren't accessed. -This differs from `module--test-assertions-load-non-live-object' +This differs from `module--test-assertions--load-non-live-object' in that it stows away a global reference. The module assertions should nevertheless detect the invalid load." :tags (if (getenv "EMACS_EMBA_CI") '(:unstable)) -- cgit v1.2.3 From 17b017d55c49b7218a52bea3b6ddcd1705024bbe Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Mon, 31 Oct 2022 10:51:40 +0100 Subject: ; 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. --- lisp/emacs-lisp/package.el | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 977a16a7e19..ae3a1b7b830 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -726,10 +726,6 @@ return it." (read (current-buffer))) (error "Can't find define-package in %s" pkg-file)))) (setf (package-desc-dir pkg-desc) pkg-dir) - (when (package-vc-p pkg-desc) - (require 'package-vc) - (push (cons :commit (package-vc-commit pkg-desc)) - (package-desc-extras pkg-desc))) (if (file-exists-p signed-file) (setf (package-desc-signed pkg-desc) t)) pkg-desc))))) -- cgit v1.2.3 From b5dfd1dfe1147aa3bcceb8a2bc40f358aa1f29a4 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 2 Nov 2022 11:56:42 +0100 Subject: Track file name in 'package--downloads-in-progress' * lisp/emacs-lisp/package.el (package--download-one-archive): Move 'cl-pushnew' call from 'package--download-one-archive' and cons file name onto the archive. (package--download-one-archive): Cons the file name onto the archive. (package--download-and-read-archives): Remove 'cl-pushnew' call. --- lisp/emacs-lisp/package.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ae3a1b7b830..4593ae7d1b7 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1783,9 +1783,14 @@ Once it's empty, run `package--post-download-archives-hook'." ARCHIVE should be a cons cell of the form (NAME . LOCATION), similar to an entry in `package-alist'. Save the cached copy to \"archives/NAME/FILE\" in `package-user-dir'." + ;; The downloaded archive contents will be read as part of + ;; `package--update-downloads-in-progress'. + (dolist (archive package-archives) + (cl-pushnew (cons archive file) package--downloads-in-progress + :test #'equal)) (package--with-response-buffer (cdr archive) :file file :async async - :error-form (package--update-downloads-in-progress archive) + :error-form (package--update-downloads-in-progress (cons archive file)) (let* ((location (cdr archive)) (name (car archive)) (content (buffer-string)) @@ -1798,10 +1803,10 @@ similar to an entry in `package-alist'. Save the cached copy to ;; If we don't care about the signature, save the file and ;; we're done. (progn - (cl-assert (not enable-multibyte-characters)) - (let ((coding-system-for-write 'binary)) - (write-region content nil local-file nil 'silent)) - (package--update-downloads-in-progress archive)) + (cl-assert (not enable-multibyte-characters)) + (let ((coding-system-for-write 'binary)) + (write-region content nil local-file nil 'silent)) + (package--update-downloads-in-progress (cons archive file))) ;; If we care, check it (perhaps async) and *then* write the file. (package--check-signature location file content async @@ -1822,11 +1827,6 @@ Populate `package-archive-contents' with the result. If optional argument ASYNC is non-nil, perform the downloads asynchronously." - ;; The downloaded archive contents will be read as part of - ;; `package--update-downloads-in-progress'. - (dolist (archive package-archives) - (cl-pushnew archive package--downloads-in-progress - :test #'equal)) (dolist (archive package-archives) (condition-case-unless-debug nil (package--download-one-archive archive "archive-contents" async) -- cgit v1.2.3 From 57708df032d1c24cedaab68e705ea818dacdcd3f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 2 Nov 2022 13:58:14 +0100 Subject: ; Handle case that was forgotten in the last commit --- lisp/emacs-lisp/package.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4593ae7d1b7..27324f2b9b4 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1819,7 +1819,7 @@ similar to an entry in `package-alist'. Save the cached copy to (when good-sigs (write-region (mapconcat #'epg-signature-to-string good-sigs "\n") nil (concat local-file ".signed") nil 'silent))) - (lambda () (package--update-downloads-in-progress archive)))))))) + (lambda () (package--update-downloads-in-progress (cons archive file))))))))) (defun package--download-and-read-archives (&optional async) "Download descriptions of all `package-archives' and read them. -- cgit v1.2.3 From e46f6804892ad67a5fbfd096da568d86f0a4a2f8 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Sun, 6 Nov 2022 15:59:58 +0100 Subject: ; * lisp/emacs-lisp/package.el (package-load-all-descriptors): Use \` --- lisp/emacs-lisp/package.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 27324f2b9b4..a7bcdd214cb 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -741,7 +741,7 @@ description file containing a call to `define-package', which updates `package-alist'." (dolist (dir (cons package-user-dir package-directory-list)) (when (file-directory-p dir) - (dolist (pkg-dir (directory-files dir t "^[^.]" t)) + (dolist (pkg-dir (directory-files dir t "\\`[^.]" t)) (when (file-directory-p pkg-dir) (package-load-descriptor pkg-dir)))))) -- cgit v1.2.3 From d67b66f8abb72369d77bd800301eb74b8b9ad321 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 8 Nov 2022 23:45:35 +0100 Subject: Respect :lisp-dir in package specs by loading a sub-directory * lisp/emacs-lisp/package-vc.el (package-vc-repository-store): Remove obsolete variable. (package-vc--unpack-1): Respect :lisp-dir. (package-vc--unpack): Add :lisp-dir to the package description if necessary. * lisp/emacs-lisp/package.el (package--delete-directory): Check if a directory is a symbolic link. --- lisp/emacs-lisp/package-vc.el | 52 +++++++++++++++++++++---------------------- lisp/emacs-lisp/package.el | 30 +++++++++++-------------- 2 files changed, 38 insertions(+), 44 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index b1da2c010f2..548e7880110 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -49,7 +49,6 @@ (require 'lisp-mnt) (require 'vc) (require 'seq) -(require 'xdg) (defgroup package-vc nil "Manage packages from VC checkouts." @@ -100,12 +99,6 @@ vc-handled-backends))) :version "29.1") -(defcustom package-vc-repository-store - (expand-file-name "emacs/vc-packages" (xdg-data-home)) - "Directory used by to store repositories." - :type 'directory - :version "29.1") - (defcustom package-vc-default-backend 'Git "Default VC backend used when cloning a package repository. If no repository type was specified or could be guessed by @@ -390,7 +383,7 @@ documentation and marking the package as installed." ;; dependency list wasn't know beforehand, and they might have ;; to be installed explicitly. (let (deps) - (dolist (file (directory-files pkg-dir t "\\.el\\'" t)) + (dolist (file (directory-files (package-lisp-dir pkg-desc) t "\\.el\\'" t)) (with-temp-buffer (insert-file-contents file) (when-let* ((require-lines (lm-header-multiline "package-requires"))) @@ -406,10 +399,26 @@ documentation and marking the package as installed." (package-compute-transaction nil (delete-dups deps)))) (let ((default-directory (file-name-as-directory pkg-dir)) - (name (package-desc-name pkg-desc)) (pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir))) ;; Generate autoloads - (package-generate-autoloads name pkg-dir) + (let* ((name (package-desc-name pkg-desc)) + (auto-name (format "%s-autoloads.el" name)) + (extras (package-desc-extras pkg-desc)) + (lisp-dir (alist-get :lisp-dir extras))) + (package-generate-autoloads + name (file-name-concat pkg-dir lisp-dir)) + (when lisp-dir + (write-region + (with-temp-buffer + (insert ";; Autoload indirection for package-vc\n\n") + (prin1 `(load (expand-file-name + ,(file-name-concat lisp-dir auto-name) + (or (and load-file-name + (file-name-directory load-file-name)) + (car load-path)))) + (current-buffer)) + (buffer-string)) + nil (expand-file-name auto-name pkg-dir)))) ;; Generate package file (package-vc--generate-description-file pkg-desc pkg-file) @@ -496,28 +505,17 @@ checkout. This overrides the `:branch' attribute in PKG-SPEC." (pcase-let* (((map :url :lisp-dir) pkg-spec) (name (package-desc-name pkg-desc)) (dirname (package-desc-full-name pkg-desc)) - (pkg-dir (expand-file-name dirname package-user-dir)) - (real-dir (if (null lisp-dir) - pkg-dir - (unless (file-exists-p package-vc-repository-store) - (make-directory package-vc-repository-store t)) - (file-name-concat - package-vc-repository-store - ;; FIXME: We aren't sure this directory - ;; will be unique, but we can try other - ;; names to avoid an unnecessary error. - (file-name-base url))))) + (pkg-dir (expand-file-name dirname package-user-dir))) (setf (package-desc-dir pkg-desc) pkg-dir) (when (file-exists-p pkg-dir) (if (yes-or-no-p "Overwrite previous checkout?") - (package--delete-directory pkg-dir pkg-desc) + (package--delete-directory pkg-dir) (error "There already exists a checkout for %s" name))) - (package-vc--clone pkg-desc pkg-spec real-dir rev) - (unless (eq pkg-dir real-dir) - ;; Link from the right position in `repo-dir' to the package - ;; directory in the ELPA store. - (make-symbolic-link (file-name-concat real-dir lisp-dir) pkg-dir)) + (package-vc--clone pkg-desc pkg-spec pkg-dir rev) + (when lisp-dir + (push (cons :lisp-dir lisp-dir) + (package-desc-extras pkg-desc))) (package-vc--unpack-1 pkg-desc pkg-dir))) (defun package-vc--read-package-name (prompt &optional allow-url installed) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a7bcdd214cb..8e6e7b7dcf8 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1090,10 +1090,15 @@ untar into a directory named DIR; otherwise, signal an error." (backup-inhibited t) (version-control 'never)) (loaddefs-generate - pkg-dir output-file - nil - "(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path))))") + pkg-dir output-file nil + (prin1-to-string + '(add-to-list + 'load-path + ;; Add the directory that will contain the autoload file to + ;; the load path. We don't hard-code `pkg-dir', to avoid + ;; issues if the package directory is moved around. + (or (and load-file-name (file-name-directory load-file-name)) + (car load-path))))) (let ((buf (find-buffer-visiting output-file))) (when buf (kill-buffer buf))) auto-name)) @@ -2419,7 +2424,7 @@ installed), maybe you need to \\[package-refresh-contents]") (declare-function comp-el-to-eln-filename "comp.c") (defvar package-vc-repository-store) -(defun package--delete-directory (dir pkg-desc) +(defun package--delete-directory (dir) "Delete PKG-DESC directory DIR recursively. Clean-up the corresponding .eln files if Emacs is native compiled." @@ -2427,17 +2432,8 @@ compiled." (cl-loop for file in (directory-files-recursively dir "\\.el\\'") do (comp-clean-up-stale-eln (comp-el-to-eln-filename file)))) - (if (and (package-vc-p pkg-desc) - (require 'package-vc) ;load `package-vc-repository-store' - (file-in-directory-p dir package-vc-repository-store)) - (progn - (delete-directory - (expand-file-name - (car (file-name-split - (file-relative-name dir package-vc-repository-store))) - package-vc-repository-store) - t) - (delete-file (directory-file-name dir))) + (if (file-symlink-p (directory-file-name dir)) + (delete-file (directory-file-name dir)) (delete-directory dir t))) @@ -2493,7 +2489,7 @@ If NOSAVE is non-nil, the package is not removed from (package-desc-name pkg-used-elsewhere-by))) (t (add-hook 'post-command-hook #'package-menu--post-refresh) - (package--delete-directory dir pkg-desc) + (package--delete-directory dir) ;; Remove NAME-VERSION.signed and NAME-readme.txt files. ;; ;; NAME-readme.txt files are no longer created, but they -- cgit v1.2.3 From ccd7ab84c5a8685c66ee1b62cb486c00edd2d992 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 11 Nov 2022 18:32:13 +0100 Subject: Fix edebug spec for 'package--with-response-buffer' * lisp/emacs-lisp/package.el (package--with-response-buffer): Add a spec that makes the macro debuggable. --- lisp/emacs-lisp/package.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8e6e7b7dcf8..23e0bb15d0a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1363,10 +1363,7 @@ is non-nil, don't propagate connection errors (does not apply to errors signaled by ERROR-FORM or by BODY). \(fn URL &key ASYNC FILE ERROR-FORM NOERROR &rest BODY)" - (declare (indent defun) - ;; FIXME: This should be something like - ;; `form def-body &rest form', but that doesn't work. - (debug (form &rest sexp))) + (declare (indent defun) (debug (sexp body))) (while (keywordp (car body)) (setq body (cdr (cdr body)))) `(package--with-response-buffer-1 ,url (lambda () ,@body) -- cgit v1.2.3 From 2ed115fc3ca98efb83206afa608f94edc48782d6 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 11 Nov 2022 18:34:14 +0100 Subject: Fix indefinite loading of asynchronous downloads * lisp/emacs-lisp/package.el (package--download-one-archive): Only add the archive that is actually being downloaded to 'package--downloads-in-progress'. --- lisp/emacs-lisp/package.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 23e0bb15d0a..f9786febf4e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1787,7 +1787,7 @@ similar to an entry in `package-alist'. Save the cached copy to \"archives/NAME/FILE\" in `package-user-dir'." ;; The downloaded archive contents will be read as part of ;; `package--update-downloads-in-progress'. - (dolist (archive package-archives) + (when async (cl-pushnew (cons archive file) package--downloads-in-progress :test #'equal)) (package--with-response-buffer (cdr archive) :file file -- cgit v1.2.3 From f7ee6609ae3b9cbafd48c89bad160b4e17f5b386 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 18 Nov 2022 13:06:55 +0100 Subject: ; Fix typos (prefer US spelling) --- ChangeLog.3 | 32 ++++++++++++++++---------------- doc/lispref/errors.texi | 2 +- doc/lispref/functions.texi | 2 +- doc/lispref/minibuf.texi | 2 +- doc/misc/modus-themes.org | 2 +- doc/misc/ses.texi | 4 ++-- doc/misc/tramp.texi | 2 +- etc/NEWS.28 | 2 +- lisp/calc/calc-graph.el | 2 +- lisp/emacs-lisp/ert.el | 2 +- lisp/emacs-lisp/package.el | 4 ++-- lisp/gnus/gnus-search.el | 2 +- lisp/leim/quail/indian.el | 2 +- lisp/mail/ietf-drums-date.el | 4 ++-- lisp/progmodes/cc-engine.el | 2 +- lisp/so-long.el | 4 ++-- lisp/subr.el | 2 +- lisp/vc/diff-mode.el | 2 +- lisp/x-dnd.el | 4 ++-- src/eval.c | 4 ++-- src/frame.c | 2 +- src/haikuselect.c | 2 +- test/lisp/emacs-lisp/syntax-tests.el | 2 +- test/lisp/net/dbus-tests.el | 4 ++-- 24 files changed, 46 insertions(+), 46 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/ChangeLog.3 b/ChangeLog.3 index b76431fbbdd..a78f53f377b 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -5557,7 +5557,7 @@ Fix ert errors when there's a test that binds `debug-on-error' * lisp/emacs-lisp/ert.el (ert--run-test-internal): Don't infloop - on errors when signalling errors (bug#51131). + on errors when signaling errors (bug#51131). 2021-10-10 Paul Eggert @@ -41213,7 +41213,7 @@ 2021-02-02 Lars Ingebrigtsen - Fix up invalid_syntax error signalling + Fix up invalid_syntax error signaling * src/lread.c (invalid_syntax_lisp): Instead of putting the line/column in a string, signal an error containing the numbers as @@ -63478,7 +63478,7 @@ user-error when there's a wrong password (bug#43704). (epa--wrong-password-p): New function. (epa-file-insert-file-contents): Use it, and stash the error away - for later signalling. + for later signaling. * lisp/emacs-lisp/subr-x.el (if-let): Autoload. @@ -73089,7 +73089,7 @@ * lisp/textmodes/tex-mode.el (tex-font-lock-keywords-2): End the expression before the terminating $ in constructions like $\it identifiername$ - (bug#28277). This avoids italicising the final $ character. + (bug#28277). This avoids italicizing the final $ character. This fixes the final $ of the final test case here: @@ -73421,7 +73421,7 @@ 2020-08-08 Lars Ingebrigtsen - Modernise a code example in os.texi + Modernize a code example in os.texi * doc/lispref/os.texi (Session Management): Use with-current-buffer in the example instead of save+switch (bug#40341). @@ -75687,7 +75687,7 @@ * lisp/net/eww.el (eww-list-bookmarks): Don't show buffer if there are no bookmarks. (Bug#41385) - (eww-bookmark-prepare): Move signalling an error if there are no + (eww-bookmark-prepare): Move signaling an error if there are no bookmarks from here... (eww-read-bookmarks): ...to here. Add new argument `error-out' to control this. @@ -101483,7 +101483,7 @@ (Create_Pixmap_From_Bitmap_Data): (xpm_load): Use new function. * src/xterm.c (x_composite_image): Use PictOpOver when there is a mask - so the transparency is honoured. + so the transparency is honored. (x_draw_image_foreground_1): Use x_composite_image. 2019-11-29 Stefan Monnier @@ -113664,7 +113664,7 @@ Make the NSM not pop up an X dialogue on non-mouse actions * lisp/emacs-lisp/rmc.el (read-multiple-choice): Don't pop up X - dialogues on (url-retrieve "https://expired.badssl.com/" #'ignore) + dialogs on (url-retrieve "https://expired.badssl.com/" #'ignore) and the like. 2019-09-04 Lars Ingebrigtsen @@ -115157,7 +115157,7 @@ 2019-08-21 Lars Ingebrigtsen - Make hide-ifdef-mode-prefix-key customisable + Make hide-ifdef-mode-prefix-key customizable * lisp/progmodes/hideif.el (hide-ifdef-mode-prefix-key): Make into a defcustom since it seems like this is something that should be @@ -130710,7 +130710,7 @@ Fix diff-mode face problem when used in terminals (Bug#35695) In a terminal supporting 256 colors, both diff-added and diff-removed - was mapped to the same greyish color. + was mapped to the same grayish color. * lisp/vc/diff-mode.el: Modify the colors of diff-removed, diff-added, diff-refine-removed, and diff-refine-added when @@ -158744,7 +158744,7 @@ 2018-04-17 Basil L. Contovounesios - Modernise face specs and set version tags in eww/shr + Modernize face specs and set version tags in eww/shr * lisp/net/shr.el (shr-strike-through, shr-link, shr-selected-link): Set :version tag (bug#31200). @@ -159218,10 +159218,10 @@ 2018-04-14 Lars Ingebrigtsen - Modernise a Gnus function a bit + Modernize a Gnus function a bit * lisp/gnus/gnus-start.el (gnus-update-active-hashtb-from-killed): - Modernise code a bit. + Modernize code a bit. 2018-04-14 Lars Ingebrigtsen @@ -166738,7 +166738,7 @@ 5a7d009 * lisp/vc/smerge-mode.el (smerge-refine): Replace obsolete al... e019c35 FOR_EACH_FRAME no longer assumes frame-list d64b88d * src/font.c (Ffont_info): Doc fix. (Bug#29682) - 92b2604 Modernise message.el face spec syntax + 92b2604 Modernize message.el face spec syntax b1efbe6 Update message.el obsolete face aliases 2494c14 ; * lisp/comint.el (comint-terminfo-terminal): Add a :version... 12ad276 Improve documentation of TERM environment variable @@ -167034,7 +167034,7 @@ 5a7d0095a4 * lisp/vc/smerge-mode.el (smerge-refine): Replace obsolete... e019c35df6 FOR_EACH_FRAME no longer assumes frame-list d64b88da2f * src/font.c (Ffont_info): Doc fix. (Bug#29682) - 92b2604a7f Modernise message.el face spec syntax + 92b2604a7f Modernize message.el face spec syntax b1efbe6564 Update message.el obsolete face aliases 2494c14e76 ; * lisp/comint.el (comint-terminfo-terminal): Add a :vers... 12ad276d15 Improve documentation of TERM environment variable @@ -181827,7 +181827,7 @@ 2017-12-15 Basil L. Contovounesios - Modernise message.el face spec syntax + Modernize message.el face spec syntax * lisp/gnus/message.el (message-header-to, message-header-cc) (message-header-subject, message-header-newsgroups) diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index 44a62dcebca..cb05290abd1 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -242,7 +242,7 @@ The message is @samp{Cannot determine image type}. @xref{Images}. @item inhibited-interaction The message is @samp{User interaction while inhibited}. This error is -signalled when @code{inhibit-interaction} is non-@code{nil} and a user +signaled when @code{inhibit-interaction} is non-@code{nil} and a user interaction function (like @code{read-from-minibuffer}) is called. @end table diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 7ffde7d43d1..9d5a2661916 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -734,7 +734,7 @@ a list of symbols representing the function alias chain, else @result{} (b c) @end example -If there's a loop in the definitions, an error will be signalled. If +If there's a loop in the definitions, an error will be signaled. If @var{noerror} is non-@code{nil}, the non-looping parts of the chain is returned instead. @end defun diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 089ae41f32e..332a453619c 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2745,7 +2745,7 @@ Here's a typical use case: If @code{my-client-handling-function} ends up calling something that asks the user for something (via @code{y-or-n-p} or @code{read-from-minibuffer} or the like), an -@code{inhibited-interaction} error is signalled instead. The server +@code{inhibited-interaction} error is signaled instead. The server code then catches that error and reports it to the client. @node Minibuffer Misc diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org index 56ba5fd3485..db92dfb4817 100644 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@ -3649,7 +3649,7 @@ specification of that variable looks like this: With the exception of ~org-verbatim~ and ~org-code~ faces, everything else uses the corresponding type of emphasis: a bold typographic weight, or -italicised, underlined, and struck through text. +italicized, underlined, and struck through text. The best way for users to add some extra attributes, such as a foreground color, is to define their own faces and assign them to the diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi index 6d0415cdbbb..e3ef11ebc02 100644 --- a/doc/misc/ses.texi +++ b/doc/misc/ses.texi @@ -750,13 +750,13 @@ when you pass a cell name to the @command{ses-jump} command (@kbd{j}), it changes the entered cell name to that where to jump. The default setting @code{upcase} allows you to enter the cell name in low case. Another use of @code{ses-jump-cell-name-function} could be some -internationalisation to convert non latin characters into latin +internationalization to convert non latin characters into latin equivalents to name the cell. Instead of a cell name, the function may return cell coordinates in the form of a cons, for instance @code{(0 . 0)} for cell @code{A1}, @code{(1 . 0)} for cell @code{A2}, etc. @vindex ses-jump-prefix-function -@code{ses-jump-prefix-function} is a customisable variable by default +@code{ses-jump-prefix-function} is a customizable variable by default set to the @code{ses-jump-prefix} function. This function is called when you give a prefix argument to the @command{ses-jump} command (@kbd{j}). It returns a cell name or cell coordinates corresponding to diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 99a268367b8..19f82b2447b 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -4225,7 +4225,7 @@ non-@code{nil}, or invoke that command with a negative argument like @value{tramp}'s implementation of @code{make-process} and @code{start-file-process} requires a serious overhead for initialization, every process invocation. This is needed for handling -interactive dialogues when connecting the remote host (like providing +interactive dialogs when connecting the remote host (like providing a password), and initial environment setup. Sometimes, this is not needed. Instead of starting a remote shell and diff --git a/etc/NEWS.28 b/etc/NEWS.28 index 8eab05a7634..9982296aaab 100644 --- a/etc/NEWS.28 +++ b/etc/NEWS.28 @@ -2771,7 +2771,7 @@ If non-nil, it is a regexp that should match a valid cover image. *** 'shell-script-mode' now supports 'outline-minor-mode'. The outline headings have lines that start with "###". -*** fileloop will now skip missing files instead of signalling an error. +*** fileloop will now skip missing files instead of signaling an error. *** 'tabulated-list-mode' can now restore original display order. Many commands (like 'C-x C-b') are derived from 'tabulated-list-mode', diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index a95967bef4e..5735126bf50 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el @@ -1414,7 +1414,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (defun calc-gnuplot-command (&rest args) "Send ARGS to Gnuplot. -Returns nil if Gnuplot signalled an error." +Returns nil if Gnuplot signaled an error." (calc-graph-init) (let ((cmd (concat (mapconcat 'identity args " ") "\n"))) (or (calc-graph-w32-p) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 047b0069bb9..c25ade22d6f 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -208,7 +208,7 @@ is run. If a macro (possibly with side effects) is to be tested, it has to be wrapped in `(eval (quote ...))'. If NAME is already defined as a test and Emacs is running -in batch mode, an error is signalled. +in batch mode, an error is signaled. \(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \ [:tags \\='(TAG...)] BODY...)" diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index f9786febf4e..2f19573e3cd 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4536,8 +4536,8 @@ DESC must be a `package-desc' object." "Return an email address for the maintainers of PKG-DESC. The email address may contain commas, if there are multiple maintainers. If no maintainers are found, an error will be -signalled. If the optional argument NO-ERROR is non-nil no error -will be signalled in that case." +signaled. If the optional argument NO-ERROR is non-nil no error +will be signaled in that case." (unless pkg-desc (error "Invalid package description")) (let* ((extras (package-desc-extras pkg-desc)) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index b8f7e7a08f0..7941496be61 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -1943,7 +1943,7 @@ Assume \"size\" key is equal to \"larger\"." (thread (alist-get 'thread query))) (with-slots (switches config-directory) engine `("find" ; command must come first - "--nocolor" ; mu will always give coloured output otherwise + "--nocolor" ; mu will always give colored output otherwise ,(format "--muhome=%s" config-directory) ,@switches ,(if thread "-r" "") diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el index deef00b4c29..8fe81a22173 100644 --- a/lisp/leim/quail/indian.el +++ b/lisp/leim/quail/indian.el @@ -373,7 +373,7 @@ Full key sequences are listed below:") ;; Define the input method straight away. (quail-define-package "tamil-phonetic" "Tamil" "ழ" t - "Customisable Tamil phonetic input method. + "Customizable Tamil phonetic input method. To change the translation rules of the input method, customize `tamil-translation-rules'. diff --git a/lisp/mail/ietf-drums-date.el b/lisp/mail/ietf-drums-date.el index ddef7f11b66..034854dce5a 100644 --- a/lisp/mail/ietf-drums-date.el +++ b/lisp/mail/ietf-drums-date.el @@ -126,7 +126,7 @@ treat them as whitespace (per RFC822)." (defun ietf-drums-parse-date-string (time-string &optional error no-822) "Parse an RFC5322 or RFC822 date, passed as TIME-STRING. The optional ERROR parameter causes syntax errors to be flagged -by signalling an instance of the date-parse-error condition. The +by signaling an instance of the date-parse-error condition. The optional NO-822 parameter disables the more lax RFC822 syntax, which is permitted by default. @@ -162,7 +162,7 @@ DST is returned as -1)." (time (list nil nil nil nil nil nil nil -1 nil))) (cl-labels ((set-matched-slot (slot index token) ;; Assign a slot value from match data if index is - ;; non-nil, else from token, signalling an error if + ;; non-nil, else from token, signaling an error if ;; enabled and it's out of range. (let ((value (if index (cl-parse-integer (match-string index token)) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 8813ec4686b..7e6dd431756 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -12626,7 +12626,7 @@ comment at the start of cc-engine.el for more info." (defun c-laomib-fix-elt (lwm elt paren-state) ;; Correct a c-laomib-cache entry ELT with respect to buffer changes, either - ;; doing nothing, signalling it is to be deleted, or replacing its start + ;; doing nothing, signaling it is to be deleted, or replacing its start ;; point with one lower in the buffer than LWM. PAREN-STATE is the paren ;; state at LWM. Return the corrected entry, or nil (if it needs deleting). ;; Note that corrections are made by `setcar'ing the original structure, diff --git a/lisp/so-long.el b/lisp/so-long.el index 75201fefcad..661f5ee57a9 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -839,7 +839,7 @@ was established." ) ;; It's not clear to me whether all of these would be problematic, but they ;; seemed like reasonable targets. Some are certainly excessive in smaller - ;; buffers of minified code, but we should be aiming to maximise performance + ;; buffers of minified code, but we should be aiming to maximize performance ;; by default, so that Emacs is as responsive as we can manage in even very ;; large buffers of minified code. "List of buffer-local minor modes to explicitly disable. @@ -880,7 +880,7 @@ If `so-long-revert' is subsequently invoked, then the variables are restored to their original states. The combination of `line-move-visual' (enabled) and `truncate-lines' (disabled) -is important for maximising responsiveness when moving vertically within an +is important for maximizing responsiveness when moving vertically within an extremely long line, as otherwise the full length of the line may need to be scanned to find the next position. diff --git a/lisp/subr.el b/lisp/subr.el index adaa0a91355..a42b61d9b61 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6911,7 +6911,7 @@ string will be displayed only if BODY takes longer than TIMEOUT seconds. If FUNC is a function alias, return the function alias chain. If the function alias chain contains loops, an error will be -signalled. If NOERROR, the non-loop parts of the chain is returned." +signaled. If NOERROR, the non-loop parts of the chain is returned." (declare (side-effect-free t)) (let ((chain nil) (orig-func func)) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index a9591c9d82e..357ce001b3c 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -306,7 +306,7 @@ well." ;; terminal supporting 24 bit colors) doesn't render well in terminal ;; supporting only 256 colors. Concretely, both #ffeeee ;; (diff-removed) and #eeffee (diff-added) are mapped to the same -;; greyish color. "min-colors 257" ensures that those colors are not +;; grayish color. "min-colors 257" ensures that those colors are not ;; used terminals supporting only 256 colors. However, any number ;; between 257 and 2^24 (16777216) would do. diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index 058ab99f5cb..b3465e757a9 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el @@ -818,7 +818,7 @@ has been pressed." (let ((inhibit-message t)) (funcall function amt)) ;; Do not error at buffer limits. Show a message instead. - ;; This is especially important here because signalling an + ;; This is especially important here because signaling an ;; error will mess up the drag-and-drop operation. (beginning-of-buffer (message (error-message-string '(beginning-of-buffer)))) @@ -1468,7 +1468,7 @@ instead of returning \"E\".") (dnd-get-local-file-name local-file-uri)))) (if (not local-name) '(STRING . "F") - ;; We want errors to be signalled immediately during ERT + ;; We want errors to be signaled immediately during ERT ;; testing, instead of being silently handled. (bug#56712) (if x-dnd-xds-testing (prog1 '(STRING . "S") diff --git a/src/eval.c b/src/eval.c index 78e606267f6..7327d681f9a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1329,7 +1329,7 @@ Then the value of the last BODY form is returned from the `condition-case' expression. The special handler (:success BODY...) is invoked if BODYFORM terminated -without signalling an error. BODY is then evaluated with VAR bound to +without signaling an error. BODY is then evaluated with VAR bound to the value returned by BODYFORM. See also the function `signal' for more info. @@ -1809,7 +1809,7 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) unbind_to (count, Qnil); } - /* If an error is signalled during a Lisp hook in redisplay, write a + /* If an error is signaled during a Lisp hook in redisplay, write a backtrace into the buffer *Redisplay-trace*. */ if (!debugger_called && !NILP (error_symbol) && backtrace_on_redisplay_error diff --git a/src/frame.c b/src/frame.c index bfdd03e5013..f63a19e7dcf 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5953,7 +5953,7 @@ DEFUN ("reconsider-frame-fonts", Freconsider_frame_fonts, Sreconsider_frame_fonts, 1, 1, 0, doc: /* Recreate FRAME's default font using updated font parameters. Signal an error if FRAME is not a window system frame. This should be -called after a `config-changed' event is received, signalling that the +called after a `config-changed' event is received, signaling that the parameters (such as pixel density) used by the system to open fonts have changed. */) (Lisp_Object frame) diff --git a/src/haikuselect.c b/src/haikuselect.c index bd004f4900a..e8d3b5f0f7f 100644 --- a/src/haikuselect.c +++ b/src/haikuselect.c @@ -1260,7 +1260,7 @@ syms_of_haikuselect (void) { DEFVAR_BOOL ("haiku-signal-invalid-refs", haiku_signal_invalid_refs, doc: /* If nil, silently ignore invalid file names in system messages. -Otherwise, an error will be signalled if adding a file reference to a +Otherwise, an error will be signaled if adding a file reference to a system message failed. */); haiku_signal_invalid_refs = true; diff --git a/test/lisp/emacs-lisp/syntax-tests.el b/test/lisp/emacs-lisp/syntax-tests.el index f266db5c702..d8fc5c4fa82 100644 --- a/test/lisp/emacs-lisp/syntax-tests.el +++ b/test/lisp/emacs-lisp/syntax-tests.el @@ -56,7 +56,7 @@ "\\(?2:[abc]+\\)foo\\(\\2\\)" 2) "\\(?4:[abc]+\\)foo\\(\\4\\)")) ;; Emacs supports only the back-references \1,...,\9, so when a - ;; shift would result in \10 or more, an error must be signalled. + ;; shift would result in \10 or more, an error must be signaled. (should-error (syntax-propertize--shift-groups-and-backrefs "\\(a\\)\\3" 7))) diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index 76318429181..558799286f5 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -1093,7 +1093,7 @@ is in progress." (dbus-unregister-service :session dbus--test-service))) (ert-deftest dbus-test06-register-property-emits-signal () - "Check property registration for an own service, including signalling." + "Check property registration for an own service, including signaling." (skip-unless dbus--test-enabled-session-bus) (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service)) @@ -1136,7 +1136,7 @@ is in progress." dbus--test-interface property) "foo")) - ;; Set property. The new value shall be signalled. + ;; Set property. The new value shall be signaled. (setq dbus--test-signal-received nil) (should (equal -- cgit v1.2.3 From 00aebdc182015614e215885e72a06f6df03e57d2 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sat, 19 Nov 2022 12:19:37 +0100 Subject: * lisp/emacs-lisp/package.el (package-maintainers): Improve error handling --- lisp/emacs-lisp/package.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/package.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2f19573e3cd..c1545a28701 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -4532,19 +4532,28 @@ DESC must be a `package-desc' object." (funcall browse-url-secondary-browser-function url) (browse-url url)))) +(declare-function ietf-drums-parse-address "ietf-drums" + (string &optional decode)) + (defun package-maintainers (pkg-desc &optional no-error) "Return an email address for the maintainers of PKG-DESC. The email address may contain commas, if there are multiple maintainers. If no maintainers are found, an error will be signaled. If the optional argument NO-ERROR is non-nil no error will be signaled in that case." - (unless pkg-desc - (error "Invalid package description")) - (let* ((extras (package-desc-extras pkg-desc)) + (unless (package-desc-p pkg-desc) + (error "Invalid package description: %S" pkg-desc)) + (let* ((name (package-desc-name pkg-desc)) + (extras (package-desc-extras pkg-desc)) (maint (alist-get :maintainer extras))) (cond ((and (null maint) (null no-error)) - (user-error "Package has no explicit maintainer")) + (user-error "Package `%s' has no explicit maintainer" name)) + ((and (not (progn + (require 'ietf-drums) + (ietf-drums-parse-address maint))) + (null no-error)) + (user-error "Package `%s' has no maintainer address" name)) ((not (null maint)) (with-temp-buffer (package--print-email-button maint) -- cgit v1.2.3