diff options
| author | Chong Yidong | 2011-04-21 22:35:48 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-04-21 22:35:48 -0400 |
| commit | 7ede3b6577ae99a3e7ac45baa7cace439bf5070c (patch) | |
| tree | ea01ad109d448de61e945cc5cfc8cee88a64191b | |
| parent | 5e68f8614fa019ae831a6d48de01322202880274 (diff) | |
| download | emacs-7ede3b6577ae99a3e7ac45baa7cace439bf5070c.tar.gz emacs-7ede3b6577ae99a3e7ac45baa7cace439bf5070c.zip | |
Doc fixes for package.el.
* emacs-lisp/package.el (package--builtins, package-alist)
(package-load-descriptor, package-built-in-p, package-activate)
(define-package, package-installed-p)
(package-compute-transaction, package-buffer-info)
(package--push): Doc fix. Distinguish more clearly between
version strings and version lists.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 60 |
2 files changed, 43 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e359a0f7cc5..118e34b96d3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2011-04-22 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * emacs-lisp/package.el (package--builtins, package-alist) | ||
| 4 | (package-load-descriptor, package-built-in-p, package-activate) | ||
| 5 | (define-package, package-installed-p) | ||
| 6 | (package-compute-transaction, package-buffer-info) | ||
| 7 | (package--push): Doc fix. Distinguish more clearly between | ||
| 8 | version strings and version lists. | ||
| 9 | |||
| 1 | 2011-04-21 Juanma Barranquero <lekktu@gmail.com> | 10 | 2011-04-21 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 11 | ||
| 3 | Lexical-binding cleanup. | 12 | Lexical-binding cleanup. |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4ce71b29d70..bdb40dd9dff 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -290,9 +290,11 @@ function `package-built-in-p'. | |||
| 290 | 290 | ||
| 291 | Each element has the form (PKG . DESC), where PKG is a package | 291 | Each element has the form (PKG . DESC), where PKG is a package |
| 292 | name (a symbol) and DESC is a vector that describes the package. | 292 | name (a symbol) and DESC is a vector that describes the package. |
| 293 | The vector DESC has the form [VERSION REQS DOCSTRING]. | 293 | The vector DESC has the form [VERSION-LIST REQS DOCSTRING]. |
| 294 | VERSION is a version list. | 294 | VERSION-LIST is a version list. |
| 295 | REQS is a list of packages (symbols) required by the package. | 295 | REQS is a list of packages required by the package, each |
| 296 | requirement having the form (NAME VL), where NAME is a string | ||
| 297 | and VL is a version list. | ||
| 296 | DOCSTRING is a brief description of the package.") | 298 | DOCSTRING is a brief description of the package.") |
| 297 | (put 'package--builtins 'risky-local-variable t) | 299 | (put 'package--builtins 'risky-local-variable t) |
| 298 | 300 | ||
| @@ -301,9 +303,11 @@ The vector DESC has the form [VERSION REQS DOCSTRING]. | |||
| 301 | Each element has the form (PKG . DESC), where PKG is a package | 303 | Each element has the form (PKG . DESC), where PKG is a package |
| 302 | name (a symbol) and DESC is a vector that describes the package. | 304 | name (a symbol) and DESC is a vector that describes the package. |
| 303 | 305 | ||
| 304 | The vector DESC has the form [VERSION REQS DOCSTRING]. | 306 | The vector DESC has the form [VERSION-LIST REQS DOCSTRING]. |
| 305 | VERSION is a version list. | 307 | VERSION-LIST is a version list. |
| 306 | REQS is a list of packages (symbols) required by the package. | 308 | REQS is a list of packages required by the package, each |
| 309 | requirement having the form (NAME VL) where NAME is a string | ||
| 310 | and VL is a version list. | ||
| 307 | DOCSTRING is a brief description of the package. | 311 | DOCSTRING is a brief description of the package. |
| 308 | 312 | ||
| 309 | This variable is set automatically by `package-load-descriptor', | 313 | This variable is set automatically by `package-load-descriptor', |
| @@ -358,8 +362,8 @@ E.g., if given \"quux-23.0\", will return \"quux\"" | |||
| 358 | 362 | ||
| 359 | (defun package-load-descriptor (dir package) | 363 | (defun package-load-descriptor (dir package) |
| 360 | "Load the description file in directory DIR for package PACKAGE. | 364 | "Load the description file in directory DIR for package PACKAGE. |
| 361 | Here, PACKAGE is a string of the form NAME-VER, where NAME is the | 365 | Here, PACKAGE is a string of the form NAME-VERSION, where NAME is |
| 362 | package name and VER is its version." | 366 | the package name and VERSION is its version." |
| 363 | (let* ((pkg-dir (expand-file-name package dir)) | 367 | (let* ((pkg-dir (expand-file-name package dir)) |
| 364 | (pkg-file (expand-file-name | 368 | (pkg-file (expand-file-name |
| 365 | (concat (package-strip-version package) "-pkg") | 369 | (concat (package-strip-version package) "-pkg") |
| @@ -452,18 +456,21 @@ NAME and VERSION are both strings." | |||
| 452 | ;; Don't return nil. | 456 | ;; Don't return nil. |
| 453 | t)) | 457 | t)) |
| 454 | 458 | ||
| 455 | (defun package-built-in-p (package &optional version) | 459 | (defun package-built-in-p (package &optional min-version) |
| 456 | "Return true if PACKAGE, of VERSION or newer, is built-in to Emacs." | 460 | "Return true if PACKAGE is built-in to Emacs. |
| 461 | Optional arg MIN-VERSION, if non-nil, should be a version list | ||
| 462 | specifying the minimum acceptable version." | ||
| 457 | (require 'finder-inf nil t) ; For `package--builtins'. | 463 | (require 'finder-inf nil t) ; For `package--builtins'. |
| 458 | (let ((elt (assq package package--builtins))) | 464 | (let ((elt (assq package package--builtins))) |
| 459 | (and elt (version-list-<= version (package-desc-vers (cdr elt)))))) | 465 | (and elt (min-version-<= min-version (package-desc-vers (cdr elt)))))) |
| 460 | 466 | ||
| 461 | ;; This function goes ahead and activates a newer version of a package | 467 | ;; This function goes ahead and activates a newer version of a package |
| 462 | ;; if an older one was already activated. This is not ideal; we'd at | 468 | ;; if an older one was already activated. This is not ideal; we'd at |
| 463 | ;; least need to check to see if the package has actually been loaded, | 469 | ;; least need to check to see if the package has actually been loaded, |
| 464 | ;; and not merely activated. | 470 | ;; and not merely activated. |
| 465 | (defun package-activate (package version) | 471 | (defun package-activate (package min-version) |
| 466 | "Activate package PACKAGE, of version VERSION or newer. | 472 | "Activate package PACKAGE, of version MIN-VERSION or newer. |
| 473 | MIN-VERSION should be a version list. | ||
| 467 | If PACKAGE has any dependencies, recursively activate them. | 474 | If PACKAGE has any dependencies, recursively activate them. |
| 468 | Return nil if the package could not be activated." | 475 | Return nil if the package could not be activated." |
| 469 | (let ((pkg-vec (cdr (assq package package-alist))) | 476 | (let ((pkg-vec (cdr (assq package package-alist))) |
| @@ -471,11 +478,11 @@ Return nil if the package could not be activated." | |||
| 471 | ;; Check if PACKAGE is available in `package-alist'. | 478 | ;; Check if PACKAGE is available in `package-alist'. |
| 472 | (when pkg-vec | 479 | (when pkg-vec |
| 473 | (setq available-version (package-desc-vers pkg-vec) | 480 | (setq available-version (package-desc-vers pkg-vec) |
| 474 | found (version-list-<= version available-version))) | 481 | found (version-list-<= min-version available-version))) |
| 475 | (cond | 482 | (cond |
| 476 | ;; If no such package is found, maybe it's built-in. | 483 | ;; If no such package is found, maybe it's built-in. |
| 477 | ((null found) | 484 | ((null found) |
| 478 | (package-built-in-p package version)) | 485 | (package-built-in-p package min-version)) |
| 479 | ;; If the package is already activated, just return t. | 486 | ;; If the package is already activated, just return t. |
| 480 | ((memq package package-activated-list) | 487 | ((memq package package-activated-list) |
| 481 | t) | 488 | t) |
| @@ -512,11 +519,11 @@ Required package `%s-%s' is unavailable" | |||
| 512 | &rest extra-properties) | 519 | &rest extra-properties) |
| 513 | "Define a new package. | 520 | "Define a new package. |
| 514 | NAME-STRING is the name of the package, as a string. | 521 | NAME-STRING is the name of the package, as a string. |
| 515 | VERSION-STRING is the version of the package, as a list of | 522 | VERSION-STRING is the version of the package, as a string. |
| 516 | integers of the form produced by `version-to-list'. | ||
| 517 | DOCSTRING is a short description of the package, a string. | 523 | DOCSTRING is a short description of the package, a string. |
| 518 | REQUIREMENTS is a list of dependencies on other packages. | 524 | REQUIREMENTS is a list of dependencies on other packages. |
| 519 | Each requirement is of the form (OTHER-PACKAGE \"VERSION\"). | 525 | Each requirement is of the form (OTHER-PACKAGE OTHER-VERSION), |
| 526 | where OTHER-VERSION is a string. | ||
| 520 | 527 | ||
| 521 | EXTRA-PROPERTIES is currently unused." | 528 | EXTRA-PROPERTIES is currently unused." |
| 522 | (let* ((name (intern name-string)) | 529 | (let* ((name (intern name-string)) |
| @@ -703,8 +710,8 @@ It will move point to somewhere in the headers." | |||
| 703 | (package-unpack name version)))) | 710 | (package-unpack name version)))) |
| 704 | 711 | ||
| 705 | (defun package-installed-p (package &optional min-version) | 712 | (defun package-installed-p (package &optional min-version) |
| 706 | "Return true if PACKAGE, of VERSION or newer, is installed. | 713 | "Return true if PACKAGE, of MIN-VERSION or newer, is installed. |
| 707 | Built-in packages also qualify." | 714 | MIN-VERSION should be a version list." |
| 708 | (let ((pkg-desc (assq package package-alist))) | 715 | (let ((pkg-desc (assq package package-alist))) |
| 709 | (if pkg-desc | 716 | (if pkg-desc |
| 710 | (version-list-<= min-version | 717 | (version-list-<= min-version |
| @@ -717,9 +724,9 @@ Built-in packages also qualify." | |||
| 717 | PACKAGE-LIST should be a list of package names (symbols). | 724 | PACKAGE-LIST should be a list of package names (symbols). |
| 718 | 725 | ||
| 719 | REQUIREMENTS should be a list of additional requirements; each | 726 | REQUIREMENTS should be a list of additional requirements; each |
| 720 | element in this list should have the form (PACKAGE VERSION), | 727 | element in this list should have the form (PACKAGE VERSION-LIST), |
| 721 | where PACKAGE is a package name and VERSION is the required | 728 | where PACKAGE is a package name and VERSION-LIST is the required |
| 722 | version of that package (as a list). | 729 | version of that package. |
| 723 | 730 | ||
| 724 | This function recursively computes the requirements of the | 731 | This function recursively computes the requirements of the |
| 725 | packages in REQUIREMENTS, and returns a list of all the packages | 732 | packages in REQUIREMENTS, and returns a list of all the packages |
| @@ -890,7 +897,8 @@ The vector has the form | |||
| 890 | [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY] | 897 | [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY] |
| 891 | 898 | ||
| 892 | FILENAME is the file name, a string, sans the \".el\" extension. | 899 | FILENAME is the file name, a string, sans the \".el\" extension. |
| 893 | REQUIRES is a requires list, or nil. | 900 | REQUIRES is a list of requirements, each requirement having the |
| 901 | form (NAME VER); NAME is a string and VER is a version list. | ||
| 894 | DESCRIPTION is the package description, a string. | 902 | DESCRIPTION is the package description, a string. |
| 895 | VERSION is the version, a string. | 903 | VERSION is the version, a string. |
| 896 | COMMENTARY is the commentary section, a string, or nil if none. | 904 | COMMENTARY is the commentary section, a string, or nil if none. |
| @@ -1329,8 +1337,8 @@ Letters do not insert themselves; instead, they are commands. | |||
| 1329 | "Convenience macro for `package-menu--generate'. | 1337 | "Convenience macro for `package-menu--generate'. |
| 1330 | If the alist stored in the symbol LISTNAME lacks an entry for a | 1338 | If the alist stored in the symbol LISTNAME lacks an entry for a |
| 1331 | package PACKAGE with descriptor DESC, add one. The alist is | 1339 | package PACKAGE with descriptor DESC, add one. The alist is |
| 1332 | keyed with cons cells (PACKAGE . VERSION), where PACKAGE is a | 1340 | keyed with cons cells (PACKAGE . VERSION-LIST), where PACKAGE is |
| 1333 | symbol and VERSION is a version list." | 1341 | a symbol and VERSION-LIST is a version list." |
| 1334 | `(let* ((version (package-desc-vers ,desc)) | 1342 | `(let* ((version (package-desc-vers ,desc)) |
| 1335 | (key (cons ,package version))) | 1343 | (key (cons ,package version))) |
| 1336 | (unless (assoc key ,listname) | 1344 | (unless (assoc key ,listname) |