summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/emacs-lisp/package-vc.el12
2 files changed, 20 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 6c558553c58..9e45b1d80b2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -245,6 +245,14 @@ following to your init file:
(add-hook 'help-fns-describe-function-functions
#'shortdoc-help-fns-examples-function)
+** Package
+
+---
+*** New user option 'package-vc-register-as-project'.
+When non-nil, it will automatically register every package as a
+project, that you can quickly select using 'project-switch-project'
+('C-x p p').
+
* New Modes and Packages in Emacs 30.1
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 253b35f1f1a..ba3a75851ca 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -115,6 +115,11 @@ the `clone' function."
vc-handled-backends))
:version "29.1")
+(defcustom package-vc-register-as-project t
+ "Non-nil means that packages should be registered as projects."
+ :type 'boolean
+ :version "30.1")
+
(defvar package-vc-selected-packages) ; pacify byte-compiler
;;;###autoload
@@ -559,6 +564,8 @@ and return nil if it cannot reasonably guess."
(and url (alist-get url package-vc-heuristic-alist
nil nil #'string-match-p)))
+(declare-function project-remember-projects-under "project" (dir &optional recursive))
+
(defun package-vc--clone (pkg-desc pkg-spec dir rev)
"Clone the package PKG-DESC whose spec is PKG-SPEC into the directory DIR.
REV specifies a specific revision to checkout. This overrides the `:branch'
@@ -580,6 +587,11 @@ attribute in PKG-SPEC."
(or (and (not (eq rev :last-release)) rev) branch))
(error "Failed to clone %s from %s" name url))))
+ (when package-vc-register-as-project
+ (let ((default-directory dir))
+ (require 'project)
+ (project-remember-projects-under dir)))
+
;; Check out the latest release if requested
(when (eq rev :last-release)
(if-let ((release-rev (package-vc--release-rev pkg-desc)))