diff options
| author | Philip Kaludercic | 2022-11-03 19:38:34 +0100 |
|---|---|---|
| committer | Philip Kaludercic | 2022-11-03 19:38:34 +0100 |
| commit | f5fb7069f35ea5eb1815668a0b95b9b1730d74bf (patch) | |
| tree | 27d64e580eeb190beb499566ca9d53d0cae7ae55 | |
| parent | 0e75099da83a9019bd35a37ecfad67fc4e0849e2 (diff) | |
| download | emacs-f5fb7069f35ea5eb1815668a0b95b9b1730d74bf.tar.gz emacs-f5fb7069f35ea5eb1815668a0b95b9b1730d74bf.zip | |
; Explicitly mark internal functions as such
| -rw-r--r-- | lisp/emacs-lisp/package-vc.el | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index faebd6ad6c9..ae92006c99b 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | :group 'package | 45 | :group 'package |
| 46 | :version "29.1") | 46 | :version "29.1") |
| 47 | 47 | ||
| 48 | (defconst package-vc-elpa-packages-version 1 | 48 | (defconst package-vc--elpa-packages-version 1 |
| 49 | "Version number of the package specification format understood by package-vc.") | 49 | "Version number of the package specification format understood by package-vc.") |
| 50 | 50 | ||
| 51 | (defcustom package-vc-heuristic-alist | 51 | (defcustom package-vc-heuristic-alist |
| @@ -89,7 +89,7 @@ | |||
| 89 | 89 | ||
| 90 | (defcustom package-vc-repository-store | 90 | (defcustom package-vc-repository-store |
| 91 | (expand-file-name "emacs/vc-packages" (xdg-data-home)) | 91 | (expand-file-name "emacs/vc-packages" (xdg-data-home)) |
| 92 | "Directory used by `package-vc-unpack' to store repositories." | 92 | "Directory used by `package-vc--unpack' to store repositories." |
| 93 | :type 'directory | 93 | :type 'directory |
| 94 | :version "29.1") | 94 | :version "29.1") |
| 95 | 95 | ||
| @@ -117,7 +117,7 @@ packages. Finally SYM is set to VAL." | |||
| 117 | (package-vc-install name nil spec)) | 117 | (package-vc-install name nil spec)) |
| 118 | ((listp spec) | 118 | ((listp spec) |
| 119 | (package-vc--archives-initialize) | 119 | (package-vc--archives-initialize) |
| 120 | (package-vc-unpack pkg-desc spec)))))) | 120 | (package-vc--unpack pkg-desc spec)))))) |
| 121 | (custom-set-default sym val)) | 121 | (custom-set-default sym val)) |
| 122 | 122 | ||
| 123 | ;;;###autoload | 123 | ;;;###autoload |
| @@ -148,7 +148,7 @@ it is meant to be specified manually." | |||
| 148 | :set #'package-vc--select-packages | 148 | :set #'package-vc--select-packages |
| 149 | :version "29.1") | 149 | :version "29.1") |
| 150 | 150 | ||
| 151 | (defvar package-vc-archive-spec-alist nil | 151 | (defvar package-vc--archive-spec-alist nil |
| 152 | "List of package specifications for each archive. | 152 | "List of package specifications for each archive. |
| 153 | The list maps package names as string to plist. Valid keys | 153 | The list maps package names as string to plist. Valid keys |
| 154 | include | 154 | include |
| @@ -182,7 +182,7 @@ onto the archive default or `package-vc-default-backend'. | |||
| 182 | 182 | ||
| 183 | All other values are ignored.") | 183 | All other values are ignored.") |
| 184 | 184 | ||
| 185 | (defvar package-vc-archive-data-alist nil | 185 | (defvar package-vc--archive-data-alist nil |
| 186 | "List of package specification archive metadata. | 186 | "List of package specification archive metadata. |
| 187 | Each element of the list has the form (ARCHIVE . PLIST), where | 187 | Each element of the list has the form (ARCHIVE . PLIST), where |
| 188 | PLIST keys are one of: | 188 | PLIST keys are one of: |
| @@ -190,7 +190,7 @@ PLIST keys are one of: | |||
| 190 | `:version' (integer) | 190 | `:version' (integer) |
| 191 | 191 | ||
| 192 | Indicating the version of the file formatting, to be compared | 192 | Indicating the version of the file formatting, to be compared |
| 193 | with `package-vc-elpa-packages-version'. | 193 | with `package-vc--elpa-packages-version'. |
| 194 | 194 | ||
| 195 | `:vc-backend' (symbol) | 195 | `:vc-backend' (symbol) |
| 196 | 196 | ||
| @@ -201,7 +201,7 @@ ought to be a member of `vc-handled-backends'. If missing, | |||
| 201 | 201 | ||
| 202 | All other values are ignored.") | 202 | All other values are ignored.") |
| 203 | 203 | ||
| 204 | (defun package-vc-desc->spec (pkg-desc &optional name) | 204 | (defun package-vc--desc->spec (pkg-desc &optional name) |
| 205 | "Retrieve the package specification for PKG-DESC. | 205 | "Retrieve the package specification for PKG-DESC. |
| 206 | The optional argument NAME can be used to override the default | 206 | The optional argument NAME can be used to override the default |
| 207 | name for PKG-DESC." | 207 | name for PKG-DESC." |
| @@ -209,19 +209,19 @@ name for PKG-DESC." | |||
| 209 | (or name (package-desc-name pkg-desc)) | 209 | (or name (package-desc-name pkg-desc)) |
| 210 | (if (package-desc-archive pkg-desc) | 210 | (if (package-desc-archive pkg-desc) |
| 211 | (alist-get (intern (package-desc-archive pkg-desc)) | 211 | (alist-get (intern (package-desc-archive pkg-desc)) |
| 212 | package-vc-archive-spec-alist) | 212 | package-vc--archive-spec-alist) |
| 213 | (mapcan #'append (mapcar #'cdr package-vc-archive-spec-alist))) | 213 | (mapcan #'append (mapcar #'cdr package-vc--archive-spec-alist))) |
| 214 | nil nil #'string=)) | 214 | nil nil #'string=)) |
| 215 | 215 | ||
| 216 | (define-inline package-vc-query-spec (pkg-desc prop) | 216 | (define-inline package-vc--query-spec (pkg-desc prop) |
| 217 | "Query the property PROP for the package specification for PKG-DESC. | 217 | "Query the property PROP for the package specification for PKG-DESC. |
| 218 | If no package specification can be determined, the function will | 218 | If no package specification can be determined, the function will |
| 219 | return nil." | 219 | return nil." |
| 220 | (inline-letevals (pkg-desc prop) | 220 | (inline-letevals (pkg-desc prop) |
| 221 | (inline-quote (plist-get (package-vc-desc->spec ,pkg-desc) ,prop)))) | 221 | (inline-quote (plist-get (package-vc--desc->spec ,pkg-desc) ,prop)))) |
| 222 | 222 | ||
| 223 | (defun package-vc--read-archive-data (archive) | 223 | (defun package-vc--read-archive-data (archive) |
| 224 | "Update `package-vc-archive-spec-alist' with the contents of ARCHIVE. | 224 | "Update `package-vc--archive-spec-alist' with the contents of ARCHIVE. |
| 225 | This function is meant to be used as a hook for | 225 | This function is meant to be used as a hook for |
| 226 | `package--read-archive-hook'." | 226 | `package--read-archive-hook'." |
| 227 | (let ((contents-file (expand-file-name | 227 | (let ((contents-file (expand-file-name |
| @@ -237,11 +237,11 @@ This function is meant to be used as a hook for | |||
| 237 | ;; :version 1 | 237 | ;; :version 1 |
| 238 | ;; :default-vc Git) | 238 | ;; :default-vc Git) |
| 239 | (let ((spec (read (current-buffer)))) | 239 | (let ((spec (read (current-buffer)))) |
| 240 | (when (eq package-vc-elpa-packages-version | 240 | (when (eq package-vc--elpa-packages-version |
| 241 | (plist-get (cdr spec) :version)) | 241 | (plist-get (cdr spec) :version)) |
| 242 | (setf (alist-get (intern archive) package-vc-archive-spec-alist) | 242 | (setf (alist-get (intern archive) package-vc--archive-spec-alist) |
| 243 | (car spec))) | 243 | (car spec))) |
| 244 | (setf (alist-get (intern archive) package-vc-archive-data-alist) | 244 | (setf (alist-get (intern archive) package-vc--archive-data-alist) |
| 245 | (cdr spec)) | 245 | (cdr spec)) |
| 246 | (when-let ((default-vc (plist-get (cdr spec) :default-vc)) | 246 | (when-let ((default-vc (plist-get (cdr spec) :default-vc)) |
| 247 | ((not (memq default-vc vc-handled-backends)))) | 247 | ((not (memq default-vc vc-handled-backends)))) |
| @@ -250,7 +250,7 @@ This function is meant to be used as a hook for | |||
| 250 | 250 | ||
| 251 | (defun package-vc--download-and-read-archives (&optional async) | 251 | (defun package-vc--download-and-read-archives (&optional async) |
| 252 | "Download specifications of all `package-archives' and read them. | 252 | "Download specifications of all `package-archives' and read them. |
| 253 | Populate `package-vc-archive-spec-alist' with the result. | 253 | Populate `package-vc--archive-spec-alist' with the result. |
| 254 | 254 | ||
| 255 | If optional argument ASYNC is non-nil, perform the downloads | 255 | If optional argument ASYNC is non-nil, perform the downloads |
| 256 | asynchronously." | 256 | asynchronously." |
| @@ -273,10 +273,10 @@ asynchronously." | |||
| 273 | when (vc-working-revision file) return it | 273 | when (vc-working-revision file) return it |
| 274 | finally return "unknown")) | 274 | finally return "unknown")) |
| 275 | 275 | ||
| 276 | (defun package-vc-version (pkg) | 276 | (defun package-vc--version (pkg) |
| 277 | "Extract the commit of a development package PKG." | 277 | "Extract the commit of a development package PKG." |
| 278 | (cl-assert (package-vc-p pkg)) | 278 | (cl-assert (package-vc-p pkg)) |
| 279 | (if-let ((main-file (package-vc-main-file pkg))) | 279 | (if-let ((main-file (package-vc--main-file pkg))) |
| 280 | (with-temp-buffer | 280 | (with-temp-buffer |
| 281 | (insert-file-contents main-file) | 281 | (insert-file-contents main-file) |
| 282 | (package-strip-rcs-id | 282 | (package-strip-rcs-id |
| @@ -284,10 +284,10 @@ asynchronously." | |||
| 284 | (lm-header "version")))) | 284 | (lm-header "version")))) |
| 285 | "0")) | 285 | "0")) |
| 286 | 286 | ||
| 287 | (defun package-vc-main-file (pkg-desc) | 287 | (defun package-vc--main-file (pkg-desc) |
| 288 | "Return the main file for PKG-DESC." | 288 | "Return the main file for PKG-DESC." |
| 289 | (cl-assert (package-vc-p pkg-desc)) | 289 | (cl-assert (package-vc-p pkg-desc)) |
| 290 | (let ((pkg-spec (package-vc-desc->spec pkg-desc))) | 290 | (let ((pkg-spec (package-vc--desc->spec pkg-desc))) |
| 291 | (or (plist-get pkg-spec :main-file) | 291 | (or (plist-get pkg-spec :main-file) |
| 292 | (expand-file-name | 292 | (expand-file-name |
| 293 | (format "%s.el" (package-desc-name pkg-desc)) | 293 | (format "%s.el" (package-desc-name pkg-desc)) |
| @@ -298,14 +298,14 @@ asynchronously." | |||
| 298 | package-user-dir)) | 298 | package-user-dir)) |
| 299 | (plist-get pkg-spec :lisp-dir)))))) | 299 | (plist-get pkg-spec :lisp-dir)))))) |
| 300 | 300 | ||
| 301 | (defun package-vc-generate-description-file (pkg-desc pkg-file) | 301 | (defun package-vc--generate-description-file (pkg-desc pkg-file) |
| 302 | "Generate a package description file for PKG-DESC. | 302 | "Generate a package description file for PKG-DESC. |
| 303 | The output is written out into PKG-FILE." | 303 | The output is written out into PKG-FILE." |
| 304 | (let ((name (package-desc-name pkg-desc))) | 304 | (let ((name (package-desc-name pkg-desc))) |
| 305 | ;; Infer the subject if missing. | 305 | ;; Infer the subject if missing. |
| 306 | (unless (package-desc-summary pkg-desc) | 306 | (unless (package-desc-summary pkg-desc) |
| 307 | (setf (package-desc-summary pkg-desc) | 307 | (setf (package-desc-summary pkg-desc) |
| 308 | (let ((main-file (package-vc-main-file pkg-desc))) | 308 | (let ((main-file (package-vc--main-file pkg-desc))) |
| 309 | (or (package-desc-summary pkg-desc) | 309 | (or (package-desc-summary pkg-desc) |
| 310 | (and-let* ((pkg (cadr (assq name package-archive-contents)))) | 310 | (and-let* ((pkg (cadr (assq name package-archive-contents)))) |
| 311 | (package-desc-summary pkg)) | 311 | (package-desc-summary pkg)) |
| @@ -326,7 +326,7 @@ The output is written out into PKG-FILE." | |||
| 326 | (nconc | 326 | (nconc |
| 327 | (list 'define-package | 327 | (list 'define-package |
| 328 | (symbol-name name) | 328 | (symbol-name name) |
| 329 | (cons 'vc (package-vc-version pkg-desc)) | 329 | (cons 'vc (package-vc--version pkg-desc)) |
| 330 | (package-desc-summary pkg-desc) | 330 | (package-desc-summary pkg-desc) |
| 331 | (let ((requires (package-desc-reqs pkg-desc))) | 331 | (let ((requires (package-desc-reqs pkg-desc))) |
| 332 | (list 'quote | 332 | (list 'quote |
| @@ -343,7 +343,7 @@ The output is written out into PKG-FILE." | |||
| 343 | 343 | ||
| 344 | (declare-function org-export-to-file "ox" (backend file)) | 344 | (declare-function org-export-to-file "ox" (backend file)) |
| 345 | 345 | ||
| 346 | (defun package-vc-build-documentation (pkg-desc file) | 346 | (defun package-vc--build-documentation (pkg-desc file) |
| 347 | "Build documentation FILE for PKG-DESC." | 347 | "Build documentation FILE for PKG-DESC." |
| 348 | (let ((pkg-dir (package-desc-dir pkg-desc))) | 348 | (let ((pkg-dir (package-desc-dir pkg-desc))) |
| 349 | (when (string-match-p "\\.org\\'" file) | 349 | (when (string-match-p "\\.org\\'" file) |
| @@ -356,7 +356,7 @@ The output is written out into PKG-FILE." | |||
| 356 | (call-process "install-info" nil nil nil | 356 | (call-process "install-info" nil nil nil |
| 357 | file pkg-dir))) | 357 | file pkg-dir))) |
| 358 | 358 | ||
| 359 | (defun package-vc-unpack-1 (pkg-desc pkg-dir) | 359 | (defun package-vc--unpack-1 (pkg-desc pkg-dir) |
| 360 | "Install PKG-DESC that is already located in PKG-DIR." | 360 | "Install PKG-DESC that is already located in PKG-DIR." |
| 361 | ;; In case the package was installed directly from source, the | 361 | ;; In case the package was installed directly from source, the |
| 362 | ;; dependency list wasn't know beforehand, and they might have | 362 | ;; dependency list wasn't know beforehand, and they might have |
| @@ -384,13 +384,13 @@ The output is written out into PKG-FILE." | |||
| 384 | (package-generate-autoloads name pkg-dir) | 384 | (package-generate-autoloads name pkg-dir) |
| 385 | 385 | ||
| 386 | ;; Generate package file | 386 | ;; Generate package file |
| 387 | (package-vc-generate-description-file pkg-desc pkg-file) | 387 | (package-vc--generate-description-file pkg-desc pkg-file) |
| 388 | 388 | ||
| 389 | ;; Detect a manual | 389 | ;; Detect a manual |
| 390 | (when-let ((pkg-spec (package-vc-desc->spec pkg-desc)) | 390 | (when-let ((pkg-spec (package-vc--desc->spec pkg-desc)) |
| 391 | ((executable-find "install-info"))) | 391 | ((executable-find "install-info"))) |
| 392 | (dolist (doc-file (ensure-list (plist-get pkg-spec :doc))) | 392 | (dolist (doc-file (ensure-list (plist-get pkg-spec :doc))) |
| 393 | (package-vc-build-documentation pkg-desc doc-file)))) | 393 | (package-vc--build-documentation pkg-desc doc-file)))) |
| 394 | 394 | ||
| 395 | ;; Update package-alist. | 395 | ;; Update package-alist. |
| 396 | (let ((new-desc (package-load-descriptor pkg-dir))) | 396 | (let ((new-desc (package-load-descriptor pkg-dir))) |
| @@ -414,7 +414,7 @@ The output is written out into PKG-FILE." | |||
| 414 | package-selected-packages)) | 414 | package-selected-packages)) |
| 415 | 415 | ||
| 416 | ;; Confirm that the installation was successful | 416 | ;; Confirm that the installation was successful |
| 417 | (let ((main-file (package-vc-main-file pkg-desc))) | 417 | (let ((main-file (package-vc--main-file pkg-desc))) |
| 418 | (message "Source package `%s' installed (Version %s, Revision %S)." | 418 | (message "Source package `%s' installed (Version %s, Revision %S)." |
| 419 | (package-desc-name pkg-desc) | 419 | (package-desc-name pkg-desc) |
| 420 | (lm-with-file main-file | 420 | (lm-with-file main-file |
| @@ -424,14 +424,14 @@ The output is written out into PKG-FILE." | |||
| 424 | (vc-working-revision main-file))) | 424 | (vc-working-revision main-file))) |
| 425 | t) | 425 | t) |
| 426 | 426 | ||
| 427 | (defun package-vc-guess-backend (url) | 427 | (defun package-vc--guess-backend (url) |
| 428 | "Guess the VC backend for URL. | 428 | "Guess the VC backend for URL. |
| 429 | This function will internally query `package-vc-heuristic-alist' | 429 | This function will internally query `package-vc-heuristic-alist' |
| 430 | and return nil if no reasonable guess can be made." | 430 | and return nil if no reasonable guess can be made." |
| 431 | (and url (alist-get url package-vc-heuristic-alist | 431 | (and url (alist-get url package-vc-heuristic-alist |
| 432 | nil nil #'string-match-p))) | 432 | nil nil #'string-match-p))) |
| 433 | 433 | ||
| 434 | (defun package-vc-clone (pkg-desc pkg-spec dir rev) | 434 | (defun package-vc--clone (pkg-desc pkg-spec dir rev) |
| 435 | "Clone the source of a package into a directory DIR. | 435 | "Clone the source of a package into a directory DIR. |
| 436 | The package is described by a package descriptions PKG-DESC and a | 436 | The package is described by a package descriptions PKG-DESC and a |
| 437 | package specification PKG-SPEC." | 437 | package specification PKG-SPEC." |
| @@ -442,10 +442,10 @@ package specification PKG-SPEC." | |||
| 442 | (unless (file-exists-p dir) | 442 | (unless (file-exists-p dir) |
| 443 | (make-directory (file-name-directory dir) t) | 443 | (make-directory (file-name-directory dir) t) |
| 444 | (let ((backend (or (plist-get pkg-spec :vc-backend) | 444 | (let ((backend (or (plist-get pkg-spec :vc-backend) |
| 445 | (package-vc-query-spec pkg-desc :vc-backend) | 445 | (package-vc--query-spec pkg-desc :vc-backend) |
| 446 | (package-vc-guess-backend url) | 446 | (package-vc--guess-backend url) |
| 447 | (plist-get (alist-get (package-desc-archive pkg-desc) | 447 | (plist-get (alist-get (package-desc-archive pkg-desc) |
| 448 | package-vc-archive-data-alist | 448 | package-vc--archive-data-alist |
| 449 | nil nil #'string=) | 449 | nil nil #'string=) |
| 450 | :vc-backend) | 450 | :vc-backend) |
| 451 | package-vc-default-backend))) | 451 | package-vc-default-backend))) |
| @@ -455,15 +455,15 @@ package specification PKG-SPEC." | |||
| 455 | 455 | ||
| 456 | ;; Check out the latest release if requested | 456 | ;; Check out the latest release if requested |
| 457 | (when (eq rev :last-release) | 457 | (when (eq rev :last-release) |
| 458 | (if-let ((release-rev (package-vc-release-rev pkg-desc))) | 458 | (if-let ((release-rev (package-vc--release-rev pkg-desc))) |
| 459 | (vc-retrieve-tag dir release-rev) | 459 | (vc-retrieve-tag dir release-rev) |
| 460 | (message "No release revision was found, continuing..."))))) | 460 | (message "No release revision was found, continuing..."))))) |
| 461 | 461 | ||
| 462 | (defun package-vc-unpack (pkg-desc pkg-spec &optional rev) | 462 | (defun package-vc--unpack (pkg-desc pkg-spec &optional rev) |
| 463 | "Install the package described by PKG-DESC. | 463 | "Install the package described by PKG-DESC. |
| 464 | PKG-SPEC is a package specification is a property list describing | 464 | PKG-SPEC is a package specification is a property list describing |
| 465 | how to fetch and build the package PKG-DESC. See | 465 | how to fetch and build the package PKG-DESC. See |
| 466 | `package-vc-archive-spec-alist' for details. The optional argument | 466 | `package-vc--archive-spec-alist' for details. The optional argument |
| 467 | REV specifies a specific revision to checkout. This overrides | 467 | REV specifies a specific revision to checkout. This overrides |
| 468 | the `:brach' attribute in PKG-SPEC." | 468 | the `:brach' attribute in PKG-SPEC." |
| 469 | (pcase-let* (((map :url :lisp-dir) pkg-spec) | 469 | (pcase-let* (((map :url :lisp-dir) pkg-spec) |
| @@ -485,30 +485,30 @@ the `:brach' attribute in PKG-SPEC." | |||
| 485 | (if (yes-or-no-p "Overwrite previous checkout?") | 485 | (if (yes-or-no-p "Overwrite previous checkout?") |
| 486 | (package--delete-directory pkg-dir pkg-desc) | 486 | (package--delete-directory pkg-dir pkg-desc) |
| 487 | (error "There already exists a checkout for %s" name))) | 487 | (error "There already exists a checkout for %s" name))) |
| 488 | (package-vc-clone pkg-desc pkg-spec real-dir rev) | 488 | (package-vc--clone pkg-desc pkg-spec real-dir rev) |
| 489 | (unless (eq pkg-dir real-dir) | 489 | (unless (eq pkg-dir real-dir) |
| 490 | ;; Link from the right position in `repo-dir' to the package | 490 | ;; Link from the right position in `repo-dir' to the package |
| 491 | ;; directory in the ELPA store. | 491 | ;; directory in the ELPA store. |
| 492 | (make-symbolic-link (file-name-concat real-dir lisp-dir) pkg-dir)) | 492 | (make-symbolic-link (file-name-concat real-dir lisp-dir) pkg-dir)) |
| 493 | 493 | ||
| 494 | (package-vc-unpack-1 pkg-desc pkg-dir))) | 494 | (package-vc--unpack-1 pkg-desc pkg-dir))) |
| 495 | 495 | ||
| 496 | (defun package-vc-sourced-packages-list () | 496 | (defun package-vc--sourced-packages-list () |
| 497 | "Generate a list of packages with VC data." | 497 | "Generate a list of packages with VC data." |
| 498 | (seq-filter | 498 | (seq-filter |
| 499 | (lambda (pkg) | 499 | (lambda (pkg) |
| 500 | (or (package-vc-desc->spec (cadr pkg)) | 500 | (or (package-vc--desc->spec (cadr pkg)) |
| 501 | ;; If we have no explicit VC data, we can try a kind of | 501 | ;; If we have no explicit VC data, we can try a kind of |
| 502 | ;; heuristic and use the URL header, that might already be | 502 | ;; heuristic and use the URL header, that might already be |
| 503 | ;; pointing towards a repository, and use that as a backup | 503 | ;; pointing towards a repository, and use that as a backup |
| 504 | (and-let* ((extras (package-desc-extras (cadr pkg))) | 504 | (and-let* ((extras (package-desc-extras (cadr pkg))) |
| 505 | (url (alist-get :url extras)) | 505 | (url (alist-get :url extras)) |
| 506 | ((package-vc-guess-backend url)))))) | 506 | ((package-vc--guess-backend url)))))) |
| 507 | package-archive-contents)) | 507 | package-archive-contents)) |
| 508 | 508 | ||
| 509 | (defun package-vc-update (pkg-desc) | 509 | (defun package-vc-update (pkg-desc) |
| 510 | "Attempt to update the packager PKG-DESC." | 510 | "Attempt to update the packager PKG-DESC." |
| 511 | ;; HACK: To run `package-vc-unpack-1' after checking out the new | 511 | ;; HACK: To run `package-vc--unpack-1' after checking out the new |
| 512 | ;; revision, we insert a hook into `vc-post-command-functions', and | 512 | ;; revision, we insert a hook into `vc-post-command-functions', and |
| 513 | ;; remove it right after it ran. To avoid running the hook multiple | 513 | ;; remove it right after it ran. To avoid running the hook multiple |
| 514 | ;; times or even for the wrong repository (as `vc-pull' is often | 514 | ;; times or even for the wrong repository (as `vc-pull' is often |
| @@ -517,7 +517,7 @@ the `:brach' attribute in PKG-SPEC." | |||
| 517 | ;; side effect, and store them in the lexical scope. When the hook | 517 | ;; side effect, and store them in the lexical scope. When the hook |
| 518 | ;; is run, we check if the arguments are the same (`eq') as the ones | 518 | ;; is run, we check if the arguments are the same (`eq') as the ones |
| 519 | ;; previously extracted, and only in that case will be call | 519 | ;; previously extracted, and only in that case will be call |
| 520 | ;; `package-vc-unpack-1'. Ugh... | 520 | ;; `package-vc--unpack-1'. Ugh... |
| 521 | ;; | 521 | ;; |
| 522 | ;; If there is a better way to do this, it should be done. | 522 | ;; If there is a better way to do this, it should be done. |
| 523 | (letrec ((pkg-dir (package-desc-dir pkg-desc)) | 523 | (letrec ((pkg-dir (package-desc-dir pkg-desc)) |
| @@ -535,7 +535,7 @@ the `:brach' attribute in PKG-SPEC." | |||
| 535 | (memq (nth 1 args) (list file-or-list empty)) | 535 | (memq (nth 1 args) (list file-or-list empty)) |
| 536 | (memq (nth 2 args) (list flags empty))) | 536 | (memq (nth 2 args) (list flags empty))) |
| 537 | (with-demoted-errors "Failed to activate: %S" | 537 | (with-demoted-errors "Failed to activate: %S" |
| 538 | (package-vc-unpack-1 pkg-desc pkg-dir)) | 538 | (package-vc--unpack-1 pkg-desc pkg-dir)) |
| 539 | (remove-hook 'vc-post-command-functions post-upgrade))))) | 539 | (remove-hook 'vc-post-command-functions post-upgrade))))) |
| 540 | (add-hook 'vc-post-command-functions post-upgrade) | 540 | (add-hook 'vc-post-command-functions post-upgrade) |
| 541 | (with-demoted-errors "Failed to fetch: %S" | 541 | (with-demoted-errors "Failed to fetch: %S" |
| @@ -544,13 +544,13 @@ the `:brach' attribute in PKG-SPEC." | |||
| 544 | (defun package-vc--archives-initialize () | 544 | (defun package-vc--archives-initialize () |
| 545 | "Initialise package.el and fetch package specifications." | 545 | "Initialise package.el and fetch package specifications." |
| 546 | (package--archives-initialize) | 546 | (package--archives-initialize) |
| 547 | (unless package-vc-archive-data-alist | 547 | (unless package-vc--archive-data-alist |
| 548 | (package-vc--download-and-read-archives))) | 548 | (package-vc--download-and-read-archives))) |
| 549 | 549 | ||
| 550 | (defun package-vc-release-rev (pkg-desc) | 550 | (defun package-vc--release-rev (pkg-desc) |
| 551 | "Find the latest revision that bumps the \"Version\" tag for PKG-DESC. | 551 | "Find the latest revision that bumps the \"Version\" tag for PKG-DESC. |
| 552 | If no such revision can be found, return nil." | 552 | If no such revision can be found, return nil." |
| 553 | (with-current-buffer (find-file-noselect (package-vc-main-file pkg-desc)) | 553 | (with-current-buffer (find-file-noselect (package-vc--main-file pkg-desc)) |
| 554 | (vc-buffer-sync) | 554 | (vc-buffer-sync) |
| 555 | (save-excursion | 555 | (save-excursion |
| 556 | (goto-char (point-min)) | 556 | (goto-char (point-min)) |
| @@ -583,13 +583,13 @@ archive is used. This can also be reproduced by passing the | |||
| 583 | special value `:last-release' as REV. If a NAME-OR-URL is a URL, | 583 | special value `:last-release' as REV. If a NAME-OR-URL is a URL, |
| 584 | that is to say a string, the VC backend used to clone the | 584 | that is to say a string, the VC backend used to clone the |
| 585 | repository can be set by BACKEND. If missing, | 585 | repository can be set by BACKEND. If missing, |
| 586 | `package-vc-guess-backend' will be used." | 586 | `package-vc--guess-backend' will be used." |
| 587 | (interactive | 587 | (interactive |
| 588 | (progn | 588 | (progn |
| 589 | ;; Initialize the package system to get the list of package | 589 | ;; Initialize the package system to get the list of package |
| 590 | ;; symbols for completion. | 590 | ;; symbols for completion. |
| 591 | (package-vc--archives-initialize) | 591 | (package-vc--archives-initialize) |
| 592 | (let* ((packages (package-vc-sourced-packages-list)) | 592 | (let* ((packages (package-vc--sourced-packages-list)) |
| 593 | (input (completing-read | 593 | (input (completing-read |
| 594 | "Fetch package source (name or URL): " packages)) | 594 | "Fetch package source (name or URL): " packages)) |
| 595 | (name (file-name-base input))) | 595 | (name (file-name-base input))) |
| @@ -598,22 +598,22 @@ repository can be set by BACKEND. If missing, | |||
| 598 | (package-vc--archives-initialize) | 598 | (package-vc--archives-initialize) |
| 599 | (cond | 599 | (cond |
| 600 | ((and-let* (((stringp name-or-url)) | 600 | ((and-let* (((stringp name-or-url)) |
| 601 | (backend (or backend (package-vc-guess-backend name-or-url)))) | 601 | (backend (or backend (package-vc--guess-backend name-or-url)))) |
| 602 | (package-vc-unpack | 602 | (package-vc--unpack |
| 603 | (package-desc-create | 603 | (package-desc-create |
| 604 | :name (or name (intern (file-name-base name-or-url))) | 604 | :name (or name (intern (file-name-base name-or-url))) |
| 605 | :kind 'vc) | 605 | :kind 'vc) |
| 606 | (list :vc-backend backend :url name-or-url) | 606 | (list :vc-backend backend :url name-or-url) |
| 607 | rev))) | 607 | rev))) |
| 608 | ((and-let* ((desc (assoc name-or-url package-archive-contents #'string=))) | 608 | ((and-let* ((desc (assoc name-or-url package-archive-contents #'string=))) |
| 609 | (package-vc-unpack | 609 | (package-vc--unpack |
| 610 | (let ((copy (copy-package-desc (cadr desc)))) | 610 | (let ((copy (copy-package-desc (cadr desc)))) |
| 611 | (setf (package-desc-kind copy) 'vc) | 611 | (setf (package-desc-kind copy) 'vc) |
| 612 | copy) | 612 | copy) |
| 613 | (or (package-vc-desc->spec (cadr desc)) | 613 | (or (package-vc--desc->spec (cadr desc)) |
| 614 | (and-let* ((extras (package-desc-extras (cadr desc))) | 614 | (and-let* ((extras (package-desc-extras (cadr desc))) |
| 615 | (url (alist-get :url extras)) | 615 | (url (alist-get :url extras)) |
| 616 | (backend (package-vc-guess-backend url))) | 616 | (backend (package-vc--guess-backend url))) |
| 617 | (list :vc-backend backend :url url)) | 617 | (list :vc-backend backend :url url)) |
| 618 | (user-error "Package has no VC data")) | 618 | (user-error "Package has no VC data")) |
| 619 | rev))) | 619 | rev))) |
| @@ -631,7 +631,7 @@ special value `:last-release' as REV." | |||
| 631 | ;; Initialize the package system to get the list of package | 631 | ;; Initialize the package system to get the list of package |
| 632 | ;; symbols for completion. | 632 | ;; symbols for completion. |
| 633 | (package-vc--archives-initialize) | 633 | (package-vc--archives-initialize) |
| 634 | (let* ((packages (package-vc-sourced-packages-list)) | 634 | (let* ((packages (package-vc--sourced-packages-list)) |
| 635 | (input (completing-read | 635 | (input (completing-read |
| 636 | "Fetch package source (name or URL): " packages))) | 636 | "Fetch package source (name or URL): " packages))) |
| 637 | (list (cadr (assoc input package-archive-contents #'string=)) | 637 | (list (cadr (assoc input package-archive-contents #'string=)) |
| @@ -640,13 +640,13 @@ special value `:last-release' as REV." | |||
| 640 | (directory-empty-p dir)))) | 640 | (directory-empty-p dir)))) |
| 641 | (and current-prefix-arg :last-release))))) | 641 | (and current-prefix-arg :last-release))))) |
| 642 | (package-vc--archives-initialize) | 642 | (package-vc--archives-initialize) |
| 643 | (let ((pkg-spec (or (package-vc-desc->spec pkg-desc) | 643 | (let ((pkg-spec (or (package-vc--desc->spec pkg-desc) |
| 644 | (and-let* ((extras (package-desc-extras pkg-desc)) | 644 | (and-let* ((extras (package-desc-extras pkg-desc)) |
| 645 | (url (alist-get :url extras)) | 645 | (url (alist-get :url extras)) |
| 646 | (backend (package-vc-guess-backend url))) | 646 | (backend (package-vc--guess-backend url))) |
| 647 | (list :vc-backend backend :url url)) | 647 | (list :vc-backend backend :url url)) |
| 648 | (user-error "Package has no VC data")))) | 648 | (user-error "Package has no VC data")))) |
| 649 | (package-vc-clone pkg-desc pkg-spec directory rev) | 649 | (package-vc--clone pkg-desc pkg-spec directory rev) |
| 650 | (find-file directory))) | 650 | (find-file directory))) |
| 651 | 651 | ||
| 652 | (defun package-vc-link-directory (dir name) | 652 | (defun package-vc-link-directory (dir name) |
| @@ -665,17 +665,17 @@ from the base name of DIR." | |||
| 665 | (let* ((name (or name (file-name-base (directory-file-name dir)))) | 665 | (let* ((name (or name (file-name-base (directory-file-name dir)))) |
| 666 | (pkg-dir (expand-file-name name package-user-dir))) | 666 | (pkg-dir (expand-file-name name package-user-dir))) |
| 667 | (make-symbolic-link dir pkg-dir) | 667 | (make-symbolic-link dir pkg-dir) |
| 668 | (package-vc-unpack-1 (package-desc-create | 668 | (package-vc--unpack-1 (package-desc-create |
| 669 | :name (intern name) | 669 | :name (intern name) |
| 670 | :kind 'vc) | 670 | :kind 'vc) |
| 671 | pkg-dir))) | 671 | pkg-dir))) |
| 672 | 672 | ||
| 673 | (defun package-vc-refresh (pkg-desc) | 673 | (defun package-vc-refresh (pkg-desc) |
| 674 | "Refresh the installation for PKG-DESC." | 674 | "Refresh the installation for PKG-DESC." |
| 675 | (interactive (package-vc-read-pkg "Refresh package: ")) | 675 | (interactive (package-vc--read-pkg "Refresh package: ")) |
| 676 | (package-vc-unpack-1 pkg-desc (package-desc-dir pkg-desc))) | 676 | (package-vc--unpack-1 pkg-desc (package-desc-dir pkg-desc))) |
| 677 | 677 | ||
| 678 | (defun package-vc-read-pkg (prompt) | 678 | (defun package-vc--read-pkg (prompt) |
| 679 | "Query for a source package description with PROMPT." | 679 | "Query for a source package description with PROMPT." |
| 680 | (cadr (assoc (completing-read | 680 | (cadr (assoc (completing-read |
| 681 | prompt | 681 | prompt |
| @@ -691,7 +691,7 @@ from the base name of DIR." | |||
| 691 | SUBJECT and REVISIONS are used passed on to `vc-prepare-patch'. | 691 | SUBJECT and REVISIONS are used passed on to `vc-prepare-patch'. |
| 692 | PKG must be a package description." | 692 | PKG must be a package description." |
| 693 | (interactive | 693 | (interactive |
| 694 | (list (package-vc-read-pkg "Package to prepare a patch for: ") | 694 | (list (package-vc--read-pkg "Package to prepare a patch for: ") |
| 695 | (and (not vc-prepare-patches-separately) | 695 | (and (not vc-prepare-patches-separately) |
| 696 | (read-string "Subject: " "[PATCH] " nil nil t)) | 696 | (read-string "Subject: " "[PATCH] " nil nil t)) |
| 697 | (or (log-view-get-marked) | 697 | (or (log-view-get-marked) |