1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-05 23:21:22 -08:00

Add option to register packages as projects

* lisp/emacs-lisp/package-vc.el (package-vc-register-as-project): Add
new option.
(project-remember-projects-under): Declare function for usage in
'package-vc--clone'.
(package-vc--clone): Respect 'package-vc-register-as-project'.
* etc/NEWS: Document the feature.
This commit is contained in:
Philip Kaludercic 2023-03-14 11:50:31 +01:00 committed by Philip Kaludercic
parent 082870c0d7
commit fca7e120d2
2 changed files with 20 additions and 0 deletions

View file

@ -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

View file

@ -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)))