diff options
| author | Stefan Monnier | 2013-06-15 11:36:11 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-06-15 11:36:11 -0400 |
| commit | 66bd25ab33bd0b8ddf6d2ced9c5910721f0b9cfb (patch) | |
| tree | c38c696001eba80c383bf1c2e7526922a81af0b8 | |
| parent | d862673b610c728ce1b4402c0c88b73c2fbd2f42 (diff) | |
| download | emacs-66bd25ab33bd0b8ddf6d2ced9c5910721f0b9cfb.tar.gz emacs-66bd25ab33bd0b8ddf6d2ced9c5910721f0b9cfb.zip | |
* lisp/emacs-lisp/package.el: Don't activate packages older than builtin.
(package-obsolete-list): Rename from package-obsolete-alist, and make
it into a simple list of package-desc.
(package-strip-version): Remove.
(package-built-in-p): Use package--builtin-versions.
(package-mark-obsolete): Simplify.
(package-process-define-package): Mark it obsolete if older than the
builtin version.
(package-handle-response): Use line-end-position.
(package-read-archive-contents, package--download-one-archive):
Simplify.
(package--add-to-archive-contents): Skip if older than the builtin or
installed version.
(package-menu-describe-package): Fix last change.
(package-list-unversioned): New var.
(package-menu--generate): Use it.
* lisp/Makefile.in (autoloads): Set autoload-builtin-package-versions.
* lisp/startup.el (package--builtin-versions): New var.
(package-subdirectory-regexp): Remove.
(package--description-file): Hard code its value instead.
* lisp/emacs-lisp/autoload.el: Manage package--builtin-versions.
(autoload--insert-text, autoload--insert-cookie-text): New functions.
(autoload-builtin-package-versions): New variable.
(autoload-generate-file-autoloads): Use them.
Remove the list of autoloaded functions/macros from the
(autoload...) comments.
| -rw-r--r-- | lisp/ChangeLog | 32 | ||||
| -rw-r--r-- | lisp/Makefile.in | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/autoload.el | 134 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-lib.el | 7 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 131 | ||||
| -rw-r--r-- | lisp/finder.el | 3 | ||||
| -rw-r--r-- | lisp/startup.el | 17 |
7 files changed, 187 insertions, 142 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fadbabf808e..919772659ea 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,35 @@ | |||
| 1 | 2013-06-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * startup.el (package--builtin-versions): New var. | ||
| 4 | (package-subdirectory-regexp): Remove. | ||
| 5 | (package--description-file): Hard code its value instead. | ||
| 6 | |||
| 7 | * emacs-lisp/package.el: Don't activate packages older than builtin. | ||
| 8 | (package-obsolete-list): Rename from package-obsolete-alist, and make | ||
| 9 | it into a simple list of package-desc. | ||
| 10 | (package-strip-version): Remove. | ||
| 11 | (package-built-in-p): Use package--builtin-versions. | ||
| 12 | (package-mark-obsolete): Simplify. | ||
| 13 | (package-process-define-package): Mark it obsolete if older than the | ||
| 14 | builtin version. | ||
| 15 | (package-handle-response): Use line-end-position. | ||
| 16 | (package-read-archive-contents, package--download-one-archive): | ||
| 17 | Simplify. | ||
| 18 | (package--add-to-archive-contents): Skip if older than the builtin or | ||
| 19 | installed version. | ||
| 20 | (package-menu-describe-package): Fix last change. | ||
| 21 | (package-list-unversioned): New var. | ||
| 22 | (package-menu--generate): Use it. | ||
| 23 | |||
| 24 | * emacs-lisp/autoload.el: Manage package--builtin-versions. | ||
| 25 | (autoload--insert-text, autoload--insert-cookie-text): New functions. | ||
| 26 | (autoload-builtin-package-versions): New variable. | ||
| 27 | (autoload-generate-file-autoloads): Use them. | ||
| 28 | Remove the list of autoloaded functions/macros from the | ||
| 29 | (autoload...) comments. | ||
| 30 | |||
| 31 | * Makefile.in (autoloads): Set autoload-builtin-package-versions. | ||
| 32 | |||
| 1 | 2013-06-15 Eli Zaretskii <eliz@gnu.org> | 33 | 2013-06-15 Eli Zaretskii <eliz@gnu.org> |
| 2 | 34 | ||
| 3 | * simple.el (line-move-partial): Don't jump to the next screen | 35 | * simple.el (line-move-partial): Don't jump to the next screen |
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 61449b66c9b..c2bb015fabe 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -178,7 +178,10 @@ autoloads: $(LOADDEFS) doit | |||
| 178 | cd $(lisp) && chmod +w $(AUTOGEN_VCS) | 178 | cd $(lisp) && chmod +w $(AUTOGEN_VCS) |
| 179 | cd $(lisp); $(setwins_almost); \ | 179 | cd $(lisp); $(setwins_almost); \ |
| 180 | echo Directories: $$wins; \ | 180 | echo Directories: $$wins; \ |
| 181 | $(emacs) -l autoload --eval '(setq generated-autoload-file (unmsys--file-name "$(lisp)/loaddefs.el"))' -f batch-update-autoloads $$wins | 181 | $(emacs) -l autoload \ |
| 182 | --eval '(setq autoload-builtin-package-versions t)' \ | ||
| 183 | --eval '(setq generated-autoload-file (unmsys--file-name "$(lisp)/loaddefs.el"))' \ | ||
| 184 | -f batch-update-autoloads $$wins | ||
| 182 | 185 | ||
| 183 | # This is required by the bootstrap-emacs target in ../src/Makefile, so | 186 | # This is required by the bootstrap-emacs target in ../src/Makefile, so |
| 184 | # we know that if we have an emacs executable, we also have a subdirs.el. | 187 | # we know that if we have an emacs executable, we also have a subdirs.el. |
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index dbb4a239f02..22713c6589c 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | ;;; Code: | 31 | ;;; Code: |
| 32 | 32 | ||
| 33 | (require 'lisp-mode) ;for `doc-string-elt' properties. | 33 | (require 'lisp-mode) ;for `doc-string-elt' properties. |
| 34 | (require 'lisp-mnt) | ||
| 34 | (require 'help-fns) ;for help-add-fundoc-usage. | 35 | (require 'help-fns) ;for help-add-fundoc-usage. |
| 35 | (eval-when-compile (require 'cl-lib)) | 36 | (eval-when-compile (require 'cl-lib)) |
| 36 | 37 | ||
| @@ -435,6 +436,64 @@ Return non-nil in the case where no autoloads were added at point." | |||
| 435 | 436 | ||
| 436 | (defvar print-readably) | 437 | (defvar print-readably) |
| 437 | 438 | ||
| 439 | (defun autoload--insert-text (output-start otherbuf outbuf absfile | ||
| 440 | load-name printfun) | ||
| 441 | ;; If not done yet, figure out where to insert this text. | ||
| 442 | (unless (marker-buffer output-start) | ||
| 443 | (let ((outbuf | ||
| 444 | (or (if otherbuf | ||
| 445 | ;; A file-local setting of | ||
| 446 | ;; autoload-generated-file says we | ||
| 447 | ;; should ignore OUTBUF. | ||
| 448 | nil | ||
| 449 | outbuf) | ||
| 450 | (autoload-find-destination absfile load-name) | ||
| 451 | ;; The file has autoload cookies, but they're | ||
| 452 | ;; already up-to-date. If OUTFILE is nil, the | ||
| 453 | ;; entries are in the expected OUTBUF, | ||
| 454 | ;; otherwise they're elsewhere. | ||
| 455 | (throw 'done otherbuf)))) | ||
| 456 | (with-current-buffer outbuf | ||
| 457 | (move-marker output-start (point) outbuf)))) | ||
| 458 | (let ((standard-output (marker-buffer output-start))) | ||
| 459 | (funcall printfun))) | ||
| 460 | |||
| 461 | (defun autoload--insert-cookie-text (output-start otherbuf outbuf absfile | ||
| 462 | load-name file) | ||
| 463 | (autoload--insert-text | ||
| 464 | output-start otherbuf outbuf absfile load-name | ||
| 465 | (lambda () | ||
| 466 | (search-forward generate-autoload-cookie) | ||
| 467 | (skip-chars-forward " \t") | ||
| 468 | (if (eolp) | ||
| 469 | (condition-case-unless-debug err | ||
| 470 | ;; Read the next form and make an autoload. | ||
| 471 | (let* ((form (prog1 (read (current-buffer)) | ||
| 472 | (or (bolp) (forward-line 1)))) | ||
| 473 | (autoload (make-autoload form load-name))) | ||
| 474 | (if autoload | ||
| 475 | nil | ||
| 476 | (setq autoload form)) | ||
| 477 | (let ((autoload-print-form-outbuf | ||
| 478 | standard-output)) | ||
| 479 | (autoload-print-form autoload))) | ||
| 480 | (error | ||
| 481 | (message "Autoload cookie error in %s:%s %S" | ||
| 482 | file (count-lines (point-min) (point)) err))) | ||
| 483 | |||
| 484 | ;; Copy the rest of the line to the output. | ||
| 485 | (princ (buffer-substring | ||
| 486 | (progn | ||
| 487 | ;; Back up over whitespace, to preserve it. | ||
| 488 | (skip-chars-backward " \f\t") | ||
| 489 | (if (= (char-after (1+ (point))) ? ) | ||
| 490 | ;; Eat one space. | ||
| 491 | (forward-char 1)) | ||
| 492 | (point)) | ||
| 493 | (progn (forward-line 1) (point)))))))) | ||
| 494 | |||
| 495 | (defvar autoload-builtin-package-versions nil) | ||
| 496 | |||
| 438 | ;; When called from `generate-file-autoloads' we should ignore | 497 | ;; When called from `generate-file-autoloads' we should ignore |
| 439 | ;; `generated-autoload-file' altogether. When called from | 498 | ;; `generated-autoload-file' altogether. When called from |
| 440 | ;; `update-file-autoloads' we don't know `outbuf'. And when called from | 499 | ;; `update-file-autoloads' we don't know `outbuf'. And when called from |
| @@ -456,8 +515,7 @@ different from OUTFILE, then OUTBUF is ignored. | |||
| 456 | Return non-nil if and only if FILE adds no autoloads to OUTFILE | 515 | Return non-nil if and only if FILE adds no autoloads to OUTFILE |
| 457 | \(or OUTBUF if OUTFILE is nil)." | 516 | \(or OUTBUF if OUTFILE is nil)." |
| 458 | (catch 'done | 517 | (catch 'done |
| 459 | (let ((autoloads-done '()) | 518 | (let (load-name |
| 460 | load-name | ||
| 461 | (print-length nil) | 519 | (print-length nil) |
| 462 | (print-level nil) | 520 | (print-level nil) |
| 463 | (print-readably t) ; This does something in Lucid Emacs. | 521 | (print-readably t) ; This does something in Lucid Emacs. |
| @@ -466,7 +524,7 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE | |||
| 466 | (otherbuf nil) | 524 | (otherbuf nil) |
| 467 | (absfile (expand-file-name file)) | 525 | (absfile (expand-file-name file)) |
| 468 | ;; nil until we found a cookie. | 526 | ;; nil until we found a cookie. |
| 469 | output-start ostart) | 527 | output-start) |
| 470 | (with-current-buffer (or visited | 528 | (with-current-buffer (or visited |
| 471 | ;; It is faster to avoid visiting the file. | 529 | ;; It is faster to avoid visiting the file. |
| 472 | (autoload-find-file file)) | 530 | (autoload-find-file file)) |
| @@ -487,58 +545,31 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE | |||
| 487 | (save-excursion | 545 | (save-excursion |
| 488 | (save-restriction | 546 | (save-restriction |
| 489 | (widen) | 547 | (widen) |
| 548 | (when autoload-builtin-package-versions | ||
| 549 | (let ((version (lm-header "version")) | ||
| 550 | package) | ||
| 551 | (and version | ||
| 552 | (setq version (ignore-errors (version-to-list version))) | ||
| 553 | (setq package (or (lm-header "package") | ||
| 554 | (file-name-sans-extension | ||
| 555 | (file-name-nondirectory file)))) | ||
| 556 | (setq output-start (make-marker)) | ||
| 557 | (autoload--insert-text | ||
| 558 | output-start otherbuf outbuf absfile load-name | ||
| 559 | (lambda () | ||
| 560 | (princ `(push (purecopy | ||
| 561 | ',(cons (intern package) version)) | ||
| 562 | package--builtin-versions)) | ||
| 563 | (newline)))))) | ||
| 564 | |||
| 490 | (goto-char (point-min)) | 565 | (goto-char (point-min)) |
| 491 | (while (not (eobp)) | 566 | (while (not (eobp)) |
| 492 | (skip-chars-forward " \t\n\f") | 567 | (skip-chars-forward " \t\n\f") |
| 493 | (cond | 568 | (cond |
| 494 | ((looking-at (regexp-quote generate-autoload-cookie)) | 569 | ((looking-at (regexp-quote generate-autoload-cookie)) |
| 495 | ;; If not done yet, figure out where to insert this text. | 570 | (unless output-start (setq output-start (make-marker))) |
| 496 | (unless output-start | 571 | (autoload--insert-cookie-text |
| 497 | (let ((outbuf | 572 | output-start otherbuf outbuf absfile load-name file)) |
| 498 | (or (if otherbuf | ||
| 499 | ;; A file-local setting of | ||
| 500 | ;; autoload-generated-file says we | ||
| 501 | ;; should ignore OUTBUF. | ||
| 502 | nil | ||
| 503 | outbuf) | ||
| 504 | (autoload-find-destination absfile load-name) | ||
| 505 | ;; The file has autoload cookies, but they're | ||
| 506 | ;; already up-to-date. If OUTFILE is nil, the | ||
| 507 | ;; entries are in the expected OUTBUF, | ||
| 508 | ;; otherwise they're elsewhere. | ||
| 509 | (throw 'done otherbuf)))) | ||
| 510 | (with-current-buffer outbuf | ||
| 511 | (setq output-start (point-marker) | ||
| 512 | ostart (point))))) | ||
| 513 | (search-forward generate-autoload-cookie) | ||
| 514 | (skip-chars-forward " \t") | ||
| 515 | (if (eolp) | ||
| 516 | (condition-case-unless-debug err | ||
| 517 | ;; Read the next form and make an autoload. | ||
| 518 | (let* ((form (prog1 (read (current-buffer)) | ||
| 519 | (or (bolp) (forward-line 1)))) | ||
| 520 | (autoload (make-autoload form load-name))) | ||
| 521 | (if autoload | ||
| 522 | (push (nth 1 form) autoloads-done) | ||
| 523 | (setq autoload form)) | ||
| 524 | (let ((autoload-print-form-outbuf | ||
| 525 | (marker-buffer output-start))) | ||
| 526 | (autoload-print-form autoload))) | ||
| 527 | (error | ||
| 528 | (message "Autoload cookie error in %s:%s %S" | ||
| 529 | file (count-lines (point-min) (point)) err))) | ||
| 530 | |||
| 531 | ;; Copy the rest of the line to the output. | ||
| 532 | (princ (buffer-substring | ||
| 533 | (progn | ||
| 534 | ;; Back up over whitespace, to preserve it. | ||
| 535 | (skip-chars-backward " \f\t") | ||
| 536 | (if (= (char-after (1+ (point))) ? ) | ||
| 537 | ;; Eat one space. | ||
| 538 | (forward-char 1)) | ||
| 539 | (point)) | ||
| 540 | (progn (forward-line 1) (point))) | ||
| 541 | (marker-buffer output-start)))) | ||
| 542 | ((looking-at ";") | 573 | ((looking-at ";") |
| 543 | ;; Don't read the comment. | 574 | ;; Don't read the comment. |
| 544 | (forward-line 1)) | 575 | (forward-line 1)) |
| @@ -553,12 +584,11 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE | |||
| 553 | (save-excursion | 584 | (save-excursion |
| 554 | ;; Insert the section-header line which lists the file name | 585 | ;; Insert the section-header line which lists the file name |
| 555 | ;; and which functions are in it, etc. | 586 | ;; and which functions are in it, etc. |
| 556 | (cl-assert (= ostart output-start)) | ||
| 557 | (goto-char output-start) | 587 | (goto-char output-start) |
| 558 | (let ((relfile (file-relative-name absfile))) | 588 | (let ((relfile (file-relative-name absfile))) |
| 559 | (autoload-insert-section-header | 589 | (autoload-insert-section-header |
| 560 | (marker-buffer output-start) | 590 | (marker-buffer output-start) |
| 561 | autoloads-done load-name relfile | 591 | () load-name relfile |
| 562 | (if secondary-autoloads-file-buf | 592 | (if secondary-autoloads-file-buf |
| 563 | ;; MD5 checksums are much better because they do not | 593 | ;; MD5 checksums are much better because they do not |
| 564 | ;; change unless the file changes (so they'll be | 594 | ;; change unless the file changes (so they'll be |
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 52f123c83ec..2a776b79705 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el | |||
| @@ -36,13 +36,6 @@ | |||
| 36 | ;; package which should always be present. | 36 | ;; package which should always be present. |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | ;;; Future notes: | ||
| 40 | |||
| 41 | ;; Once Emacs 19 becomes standard, many things in this package which are | ||
| 42 | ;; messy for reasons of compatibility can be greatly simplified. For now, | ||
| 43 | ;; I prefer to maintain one unified version. | ||
| 44 | |||
| 45 | |||
| 46 | ;;; Change Log: | 39 | ;;; Change Log: |
| 47 | 40 | ||
| 48 | ;; Version 2.02 (30 Jul 93): | 41 | ;; Version 2.02 (30 Jul 93): |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6d34c229733..2db422a4d12 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -140,7 +140,6 @@ | |||
| 140 | ;; installing it | 140 | ;; installing it |
| 141 | ;; - Interface with desktop.el so that restarting after an install | 141 | ;; - Interface with desktop.el so that restarting after an install |
| 142 | ;; works properly | 142 | ;; works properly |
| 143 | ;; - Implement M-x package-upgrade, to upgrade any/all existing packages | ||
| 144 | ;; - Use hierarchical layout. PKG/etc PKG/lisp PKG/info | 143 | ;; - Use hierarchical layout. PKG/etc PKG/lisp PKG/info |
| 145 | ;; ... except maybe lisp? | 144 | ;; ... except maybe lisp? |
| 146 | ;; - It may be nice to have a macro that expands to the package's | 145 | ;; - It may be nice to have a macro that expands to the package's |
| @@ -159,14 +158,7 @@ | |||
| 159 | ;; - Allow optional package dependencies | 158 | ;; - Allow optional package dependencies |
| 160 | ;; then if we require 'bbdb', bbdb-specific lisp in lisp/bbdb | 159 | ;; then if we require 'bbdb', bbdb-specific lisp in lisp/bbdb |
| 161 | ;; and just don't compile to add to load path ...? | 160 | ;; and just don't compile to add to load path ...? |
| 162 | ;; - Have a list of archive URLs? [ maybe there's no point ] | ||
| 163 | ;; - David Kastrup pointed out on the xemacs list that for GPL it | ||
| 164 | ;; is friendlier to ship the source tree. We could "support" that | ||
| 165 | ;; by just having a "src" subdir in the package. This isn't ideal | ||
| 166 | ;; but it probably is not worth trying to support random source | ||
| 167 | ;; tree layouts, build schemes, etc. | ||
| 168 | ;; - Our treatment of the info path is somewhat bogus | 161 | ;; - Our treatment of the info path is somewhat bogus |
| 169 | ;; - perhaps have an "unstable" tree in ELPA as well as a stable one | ||
| 170 | 162 | ||
| 171 | ;;; Code: | 163 | ;;; Code: |
| 172 | 164 | ||
| @@ -201,7 +193,7 @@ versions of all packages not specified by other elements. | |||
| 201 | For an element (NAME VERSION), NAME is a package name (a symbol). | 193 | For an element (NAME VERSION), NAME is a package name (a symbol). |
| 202 | VERSION should be t, a string, or nil. | 194 | VERSION should be t, a string, or nil. |
| 203 | If VERSION is t, all versions are loaded, though obsolete ones | 195 | If VERSION is t, all versions are loaded, though obsolete ones |
| 204 | will be put in `package-obsolete-alist' and not activated. | 196 | will be put in `package-obsolete-list' and not activated. |
| 205 | If VERSION is a string, only that version is ever loaded. | 197 | If VERSION is a string, only that version is ever loaded. |
| 206 | Any other version, even if newer, is silently ignored. | 198 | Any other version, even if newer, is silently ignored. |
| 207 | Hence, the package is \"held\" at that version. | 199 | Hence, the package is \"held\" at that version. |
| @@ -265,7 +257,7 @@ Lower version numbers than this will probably be understood as well.") | |||
| 265 | (defvar package-archive-contents nil | 257 | (defvar package-archive-contents nil |
| 266 | "Cache of the contents of the Emacs Lisp Package Archive. | 258 | "Cache of the contents of the Emacs Lisp Package Archive. |
| 267 | This is an alist mapping package names (symbols) to | 259 | This is an alist mapping package names (symbols) to |
| 268 | `package--desc' structures.") | 260 | `package-desc' structures.") |
| 269 | (put 'package-archive-contents 'risky-local-variable t) | 261 | (put 'package-archive-contents 'risky-local-variable t) |
| 270 | 262 | ||
| 271 | (defcustom package-user-dir (locate-user-emacs-file "elpa") | 263 | (defcustom package-user-dir (locate-user-emacs-file "elpa") |
| @@ -361,8 +353,6 @@ package came. | |||
| 361 | reqs | 353 | reqs |
| 362 | summary) | 354 | summary) |
| 363 | 355 | ||
| 364 | ;; The value is precomputed in finder-inf.el, but don't load that | ||
| 365 | ;; until it's needed (i.e. when `package-initialize' is called). | ||
| 366 | (defvar package--builtins nil | 356 | (defvar package--builtins nil |
| 367 | "Alist of built-in packages. | 357 | "Alist of built-in packages. |
| 368 | The actual value is initialized by loading the library | 358 | The actual value is initialized by loading the library |
| @@ -384,17 +374,14 @@ loaded and/or activated, customize `package-load-list'.") | |||
| 384 | (put 'package-alist 'risky-local-variable t) | 374 | (put 'package-alist 'risky-local-variable t) |
| 385 | 375 | ||
| 386 | (defvar package-activated-list nil | 376 | (defvar package-activated-list nil |
| 377 | ;; FIXME: This should implicitly include all builtin packages. | ||
| 387 | "List of the names of currently activated packages.") | 378 | "List of the names of currently activated packages.") |
| 388 | (put 'package-activated-list 'risky-local-variable t) | 379 | (put 'package-activated-list 'risky-local-variable t) |
| 389 | 380 | ||
| 390 | (defvar package-obsolete-alist nil | 381 | (defvar package-obsolete-list nil |
| 391 | "Representation of obsolete packages. | 382 | "List of obsolete packages. |
| 392 | Like `package-alist', but maps package name to a second alist. | 383 | Each element of the list is a `package-desc'.") |
| 393 | The inner alist is keyed by version. | 384 | (put 'package-obsolete-list 'risky-local-variable t) |
| 394 | |||
| 395 | Each element of the list is (NAME . VERSION-ALIST), where each | ||
| 396 | entry in VERSION-ALIST is (VERSION-LIST . PACKAGE-DESC).") | ||
| 397 | (put 'package-obsolete-alist 'risky-local-variable t) | ||
| 398 | 385 | ||
| 399 | (defun package-version-join (vlist) | 386 | (defun package-version-join (vlist) |
| 400 | "Return the version string corresponding to the list VLIST. | 387 | "Return the version string corresponding to the list VLIST. |
| @@ -425,12 +412,6 @@ This is, approximately, the inverse of `version-to-list'. | |||
| 425 | (pop str-list)) | 412 | (pop str-list)) |
| 426 | (apply 'concat (nreverse str-list))))) | 413 | (apply 'concat (nreverse str-list))))) |
| 427 | 414 | ||
| 428 | (defun package-strip-version (dirname) | ||
| 429 | "Strip the version from a combined package name and version. | ||
| 430 | E.g., if given \"quux-23.0\", will return \"quux\"" | ||
| 431 | (if (string-match (concat "\\`" package-subdirectory-regexp "\\'") dirname) | ||
| 432 | (match-string 1 dirname))) | ||
| 433 | |||
| 434 | (defun package-load-descriptor (pkg-dir) | 415 | (defun package-load-descriptor (pkg-dir) |
| 435 | "Load the description file in directory PKG-DIR." | 416 | "Load the description file in directory PKG-DIR." |
| 436 | (let ((pkg-file (expand-file-name (package--description-file pkg-dir) | 417 | (let ((pkg-file (expand-file-name (package--description-file pkg-dir) |
| @@ -452,7 +433,7 @@ controls which package subdirectories may be loaded. | |||
| 452 | 433 | ||
| 453 | In each valid package subdirectory, this function loads the | 434 | In each valid package subdirectory, this function loads the |
| 454 | description file containing a call to `define-package', which | 435 | description file containing a call to `define-package', which |
| 455 | updates `package-alist' and `package-obsolete-alist'." | 436 | updates `package-alist' and `package-obsolete-list'." |
| 456 | (dolist (dir (cons package-user-dir package-directory-list)) | 437 | (dolist (dir (cons package-user-dir package-directory-list)) |
| 457 | (when (file-directory-p dir) | 438 | (when (file-directory-p dir) |
| 458 | (dolist (subdir (directory-files dir)) | 439 | (dolist (subdir (directory-files dir)) |
| @@ -498,12 +479,13 @@ Return the max version (as a string) if the package is held at a lower version." | |||
| 498 | "Return true if PACKAGE is built-in to Emacs. | 479 | "Return true if PACKAGE is built-in to Emacs. |
| 499 | Optional arg MIN-VERSION, if non-nil, should be a version list | 480 | Optional arg MIN-VERSION, if non-nil, should be a version list |
| 500 | specifying the minimum acceptable version." | 481 | specifying the minimum acceptable version." |
| 501 | (require 'finder-inf nil t) ; For `package--builtins'. | 482 | (let ((bi (assq package package--builtin-versions))) |
| 502 | (if (eq package 'emacs) | 483 | (cond |
| 503 | (version-list-<= min-version (version-to-list emacs-version)) | 484 | (bi (version-list-<= min-version (cdr bi))) |
| 504 | (let ((elt (assq package package--builtins))) | 485 | (min-version nil) |
| 505 | (and elt (version-list-<= min-version | 486 | (t |
| 506 | (package--bi-desc-version (cdr elt))))))) | 487 | (require 'finder-inf nil t) ; For `package--builtins'. |
| 488 | (assq package package--builtins))))) | ||
| 507 | 489 | ||
| 508 | (defun package--from-builtin (bi-desc) | 490 | (defun package--from-builtin (bi-desc) |
| 509 | (package-desc-create :name (pop bi-desc) | 491 | (package-desc-create :name (pop bi-desc) |
| @@ -550,17 +532,7 @@ Required package `%s-%s' is unavailable" | |||
| 550 | 532 | ||
| 551 | (defun package-mark-obsolete (package pkg-vec) | 533 | (defun package-mark-obsolete (package pkg-vec) |
| 552 | "Put package on the obsolete list, if not already there." | 534 | "Put package on the obsolete list, if not already there." |
| 553 | (let ((elt (assq package package-obsolete-alist))) | 535 | (push pkg-vec package-obsolete-list)) |
| 554 | (if elt | ||
| 555 | ;; If this obsolete version does not exist in the list, update | ||
| 556 | ;; it the list. | ||
| 557 | (unless (assoc (package-desc-version pkg-vec) (cdr elt)) | ||
| 558 | (setcdr elt (cons (cons (package-desc-version pkg-vec) pkg-vec) | ||
| 559 | (cdr elt)))) | ||
| 560 | ;; Make a new association. | ||
| 561 | (push (cons package (list (cons (package-desc-version pkg-vec) | ||
| 562 | pkg-vec))) | ||
| 563 | package-obsolete-alist)))) | ||
| 564 | 536 | ||
| 565 | (defun define-package (name-string version-string | 537 | (defun define-package (name-string version-string |
| 566 | &optional docstring requirements | 538 | &optional docstring requirements |
| @@ -585,6 +557,10 @@ EXTRA-PROPERTIES is currently unused." | |||
| 585 | (version (package-desc-version new-pkg-desc)) | 557 | (version (package-desc-version new-pkg-desc)) |
| 586 | (old-pkg (assq name package-alist))) | 558 | (old-pkg (assq name package-alist))) |
| 587 | (cond | 559 | (cond |
| 560 | ;; If it's not newer than a builtin version, mark it obsolete. | ||
| 561 | ((let ((bi (assq name package--builtin-versions))) | ||
| 562 | (and bi (version-list-<= version (cdr bi)))) | ||
| 563 | (package-mark-obsolete name new-pkg-desc)) | ||
| 588 | ;; If there's no old package, just add this to `package-alist'. | 564 | ;; If there's no old package, just add this to `package-alist'. |
| 589 | ((null old-pkg) | 565 | ((null old-pkg) |
| 590 | (push (cons name new-pkg-desc) package-alist)) | 566 | (push (cons name new-pkg-desc) package-alist)) |
| @@ -762,9 +738,7 @@ It will move point to somewhere in the headers." | |||
| 762 | (let ((response (url-http-parse-response))) | 738 | (let ((response (url-http-parse-response))) |
| 763 | (when (or (< response 200) (>= response 300)) | 739 | (when (or (< response 200) (>= response 300)) |
| 764 | (error "Error during download request:%s" | 740 | (error "Error during download request:%s" |
| 765 | (buffer-substring-no-properties (point) (progn | 741 | (buffer-substring-no-properties (point) (line-end-position)))))) |
| 766 | (end-of-line) | ||
| 767 | (point))))))) | ||
| 768 | 742 | ||
| 769 | (defun package-download-single (name version desc requires) | 743 | (defun package-download-single (name version desc requires) |
| 770 | "Download and install a single-file package." | 744 | "Download and install a single-file package." |
| @@ -813,6 +787,7 @@ not included in this list." | |||
| 813 | ;; A package is required, but not installed. It might also be | 787 | ;; A package is required, but not installed. It might also be |
| 814 | ;; blocked via `package-load-list'. | 788 | ;; blocked via `package-load-list'. |
| 815 | (let ((pkg-desc (cdr (assq next-pkg package-archive-contents))) | 789 | (let ((pkg-desc (cdr (assq next-pkg package-archive-contents))) |
| 790 | ;; FIXME: package-disabled-p needs to use a <= test! | ||
| 816 | (disabled (package-disabled-p next-pkg next-version))) | 791 | (disabled (package-disabled-p next-pkg next-version))) |
| 817 | (when disabled | 792 | (when disabled |
| 818 | (if (stringp disabled) | 793 | (if (stringp disabled) |
| @@ -882,10 +857,9 @@ If successful, set the variable `package-archive-contents'. | |||
| 882 | If the archive version is too new, signal an error." | 857 | If the archive version is too new, signal an error." |
| 883 | ;; Version 1 of 'archive-contents' is identical to our internal | 858 | ;; Version 1 of 'archive-contents' is identical to our internal |
| 884 | ;; representation. | 859 | ;; representation. |
| 885 | (let* ((dir (concat "archives/" archive)) | 860 | (let* ((contents-file (format "archives/%s/archive-contents" archive)) |
| 886 | (contents-file (concat dir "/archive-contents")) | 861 | (contents (package--read-archive-file contents-file))) |
| 887 | contents) | 862 | (when contents |
| 888 | (when (setq contents (package--read-archive-file contents-file)) | ||
| 889 | (dolist (package contents) | 863 | (dolist (package contents) |
| 890 | (package--add-to-archive-contents package archive))))) | 864 | (package--add-to-archive-contents package archive))))) |
| 891 | 865 | ||
| @@ -903,10 +877,11 @@ If the archive version is too new, signal an error." | |||
| 903 | PACKAGE should have the form (NAME . PACKAGE--AC-DESC). | 877 | PACKAGE should have the form (NAME . PACKAGE--AC-DESC). |
| 904 | Also, add the originating archive to the `package-desc' structure." | 878 | Also, add the originating archive to the `package-desc' structure." |
| 905 | (let* ((name (car package)) | 879 | (let* ((name (car package)) |
| 880 | (version (package--ac-desc-version (cdr package))) | ||
| 906 | (pkg-desc | 881 | (pkg-desc |
| 907 | (package-desc-create | 882 | (package-desc-create |
| 908 | :name name | 883 | :name name |
| 909 | :version (package--ac-desc-version (cdr package)) | 884 | :version version |
| 910 | :reqs (package--ac-desc-reqs (cdr package)) | 885 | :reqs (package--ac-desc-reqs (cdr package)) |
| 911 | :summary (package--ac-desc-summary (cdr package)) | 886 | :summary (package--ac-desc-summary (cdr package)) |
| 912 | :kind (package--ac-desc-kind (cdr package)) | 887 | :kind (package--ac-desc-kind (cdr package)) |
| @@ -914,19 +889,25 @@ Also, add the originating archive to the `package-desc' structure." | |||
| 914 | (entry (cons name pkg-desc)) | 889 | (entry (cons name pkg-desc)) |
| 915 | (existing-package (assq name package-archive-contents)) | 890 | (existing-package (assq name package-archive-contents)) |
| 916 | (pinned-to-archive (assoc name package-pinned-packages))) | 891 | (pinned-to-archive (assoc name package-pinned-packages))) |
| 917 | (cond ((and pinned-to-archive | 892 | (cond |
| 918 | ;; If pinned to another archive, skip entirely. | 893 | ;; Skip entirely if pinned to another archive or if no more recent |
| 919 | (not (equal (cdr pinned-to-archive) archive))) | 894 | ;; than what we already have installed. |
| 920 | nil) | 895 | ((or (and pinned-to-archive |
| 921 | ((not existing-package) | 896 | (not (equal (cdr pinned-to-archive) archive))) |
| 922 | (push entry package-archive-contents)) | 897 | (let ((bi (assq name package--builtin-versions))) |
| 923 | ((version-list-< (package-desc-version (cdr existing-package)) | 898 | (and bi (version-list-<= version (cdr bi)))) |
| 924 | (package-desc-version pkg-desc)) | 899 | (let ((ins (cdr (assq name package-alist)))) |
| 925 | ;; Replace the entry with this one. | 900 | (and ins (version-list-<= version (package-desc-version ins))))) |
| 926 | (setq package-archive-contents | 901 | nil) |
| 927 | (cons entry | 902 | ((not existing-package) |
| 928 | (delq existing-package | 903 | (push entry package-archive-contents)) |
| 929 | package-archive-contents))))))) | 904 | ((version-list-< (package-desc-version (cdr existing-package)) |
| 905 | version) | ||
| 906 | ;; Replace the entry with this one. | ||
| 907 | (setq package-archive-contents | ||
| 908 | (cons entry | ||
| 909 | (delq existing-package | ||
| 910 | package-archive-contents))))))) | ||
| 930 | 911 | ||
| 931 | (defun package-download-transaction (package-list) | 912 | (defun package-download-transaction (package-list) |
| 932 | "Download and install all the packages in PACKAGE-LIST. | 913 | "Download and install all the packages in PACKAGE-LIST. |
| @@ -1123,8 +1104,8 @@ The file can either be a tar file or an Emacs Lisp file." | |||
| 1123 | ARCHIVE should be a cons cell of the form (NAME . LOCATION), | 1104 | ARCHIVE should be a cons cell of the form (NAME . LOCATION), |
| 1124 | similar to an entry in `package-alist'. Save the cached copy to | 1105 | similar to an entry in `package-alist'. Save the cached copy to |
| 1125 | \"archives/NAME/archive-contents\" in `package-user-dir'." | 1106 | \"archives/NAME/archive-contents\" in `package-user-dir'." |
| 1126 | (let* ((dir (expand-file-name "archives" package-user-dir)) | 1107 | (let* ((dir (expand-file-name (format "archives/%s" (car archive)) |
| 1127 | (dir (expand-file-name (car archive) dir))) | 1108 | package-user-dir))) |
| 1128 | (package--with-work-buffer (cdr archive) file | 1109 | (package--with-work-buffer (cdr archive) file |
| 1129 | ;; Read the retrieved buffer to make sure it is valid (e.g. it | 1110 | ;; Read the retrieved buffer to make sure it is valid (e.g. it |
| 1130 | ;; may fetch a URL redirect page). | 1111 | ;; may fetch a URL redirect page). |
| @@ -1156,7 +1137,7 @@ The variable `package-load-list' controls which packages to load. | |||
| 1156 | If optional arg NO-ACTIVATE is non-nil, don't activate packages." | 1137 | If optional arg NO-ACTIVATE is non-nil, don't activate packages." |
| 1157 | (interactive) | 1138 | (interactive) |
| 1158 | (setq package-alist nil | 1139 | (setq package-alist nil |
| 1159 | package-obsolete-alist nil) | 1140 | package-obsolete-list nil) |
| 1160 | (package-load-all-descriptors) | 1141 | (package-load-all-descriptors) |
| 1161 | (package-read-all-archive-contents) | 1142 | (package-read-all-archive-contents) |
| 1162 | (unless no-activate | 1143 | (unless no-activate |
| @@ -1421,6 +1402,9 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." | |||
| 1421 | ;; FIXME: Should we move status into pkg-desc? | 1402 | ;; FIXME: Should we move status into pkg-desc? |
| 1422 | (push (cons ,pkg-desc ,status) ,listname))) | 1403 | (push (cons ,pkg-desc ,status) ,listname))) |
| 1423 | 1404 | ||
| 1405 | (defvar package-list-unversioned nil | ||
| 1406 | "If non-nil include packages that don't have a version in `list-package'.") | ||
| 1407 | |||
| 1424 | (defun package-menu--generate (remember-pos packages) | 1408 | (defun package-menu--generate (remember-pos packages) |
| 1425 | "Populate the Package Menu. | 1409 | "Populate the Package Menu. |
| 1426 | If REMEMBER-POS is non-nil, keep point on the same entry. | 1410 | If REMEMBER-POS is non-nil, keep point on the same entry. |
| @@ -1441,6 +1425,8 @@ or a list of package names (symbols) to display." | |||
| 1441 | (dolist (elt package--builtins) | 1425 | (dolist (elt package--builtins) |
| 1442 | (setq name (car elt)) | 1426 | (setq name (car elt)) |
| 1443 | (when (and (not (eq name 'emacs)) ; Hide the `emacs' package. | 1427 | (when (and (not (eq name 'emacs)) ; Hide the `emacs' package. |
| 1428 | (or package-list-unversioned | ||
| 1429 | (package--bi-desc-version (cdr elt))) | ||
| 1444 | (or (eq packages t) (memq name packages))) | 1430 | (or (eq packages t) (memq name packages))) |
| 1445 | (package--push (package--from-builtin elt) "built-in" info-list))) | 1431 | (package--push (package--from-builtin elt) "built-in" info-list))) |
| 1446 | 1432 | ||
| @@ -1457,10 +1443,9 @@ or a list of package names (symbols) to display." | |||
| 1457 | info-list)))) | 1443 | info-list)))) |
| 1458 | 1444 | ||
| 1459 | ;; Obsolete packages: | 1445 | ;; Obsolete packages: |
| 1460 | (dolist (elt package-obsolete-alist) | 1446 | (dolist (elt package-obsolete-list) |
| 1461 | (dolist (inner-elt (cdr elt)) | 1447 | (when (or (eq packages t) (memq (package-desc-full-name elt) packages)) |
| 1462 | (when (or (eq packages t) (memq (car elt) packages)) | 1448 | (package--push elt "obsolete" info-list))) |
| 1463 | (package--push (cdr inner-elt) "obsolete" info-list)))) | ||
| 1464 | 1449 | ||
| 1465 | ;; Print the result. | 1450 | ;; Print the result. |
| 1466 | (setq tabulated-list-entries (mapcar 'package-menu--print-info info-list)) | 1451 | (setq tabulated-list-entries (mapcar 'package-menu--print-info info-list)) |
| @@ -1508,7 +1493,7 @@ This fetches the contents of each archive specified in | |||
| 1508 | If optional arg BUTTON is non-nil, describe its associated package." | 1493 | If optional arg BUTTON is non-nil, describe its associated package." |
| 1509 | (interactive) | 1494 | (interactive) |
| 1510 | (let ((pkg-desc (if button (button-get button 'package-desc) | 1495 | (let ((pkg-desc (if button (button-get button 'package-desc) |
| 1511 | (car (tabulated-list-get-id))))) | 1496 | (tabulated-list-get-id)))) |
| 1512 | (if pkg-desc | 1497 | (if pkg-desc |
| 1513 | ;; FIXME: We could actually describe this particular pkg-desc. | 1498 | ;; FIXME: We could actually describe this particular pkg-desc. |
| 1514 | (describe-package (package-desc-name pkg-desc))))) | 1499 | (describe-package (package-desc-name pkg-desc))))) |
diff --git a/lisp/finder.el b/lisp/finder.el index f6593c554eb..e07c6a241ab 100644 --- a/lisp/finder.el +++ b/lisp/finder.el | |||
| @@ -232,6 +232,9 @@ from; the default is `load-path'." | |||
| 232 | (insert (autoload-rubric generated-finder-keywords-file | 232 | (insert (autoload-rubric generated-finder-keywords-file |
| 233 | "keyword-to-package mapping" t)) | 233 | "keyword-to-package mapping" t)) |
| 234 | (search-backward "") | 234 | (search-backward "") |
| 235 | ;; FIXME: Now that we have package--builtin-versions, package--builtins is | ||
| 236 | ;; only needed to get the list of unversioned packages and to get the | ||
| 237 | ;; summary description of each package. | ||
| 235 | (insert "(setq package--builtins '(\n") | 238 | (insert "(setq package--builtins '(\n") |
| 236 | (dolist (package package--builtins) | 239 | (dolist (package package--builtins) |
| 237 | (insert " ") | 240 | (insert " ") |
diff --git a/lisp/startup.el b/lisp/startup.el index bd1e0db03e6..52dd6b074ba 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -413,19 +413,18 @@ Warning Warning!!! Pure space overflow !!!Warning Warning | |||
| 413 | :type 'directory | 413 | :type 'directory |
| 414 | :initialize 'custom-initialize-delay) | 414 | :initialize 'custom-initialize-delay) |
| 415 | 415 | ||
| 416 | (defconst package-subdirectory-regexp | 416 | (defvar package--builtin-versions |
| 417 | "\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\)[0-9]+\\)*\\)" | 417 | ;; Mostly populated by loaddefs.el via autoload-builtin-package-versions. |
| 418 | "Regular expression matching the name of a package subdirectory. | 418 | (purecopy `((emacs . ,(version-to-list emacs-version)))) |
| 419 | The first subexpression is the package name. | 419 | "Alist giving the version of each versioned builtin package. |
| 420 | The second subexpression is the version string. | 420 | I.e. each element of the list is of the form (NAME . VERSION) where |
| 421 | 421 | NAME is the package name as a symbol, and VERSION is its version | |
| 422 | The regexp should not contain a starting \"\\`\" or a trailing | 422 | as a list.") |
| 423 | \"\\'\"; those are added automatically by callers.") | ||
| 424 | 423 | ||
| 425 | (defun package--description-file (dir) | 424 | (defun package--description-file (dir) |
| 426 | (concat (let ((subdir (file-name-nondirectory | 425 | (concat (let ((subdir (file-name-nondirectory |
| 427 | (directory-file-name dir)))) | 426 | (directory-file-name dir)))) |
| 428 | (if (string-match package-subdirectory-regexp subdir) | 427 | (if (string-match "\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\)[0-9]+\\)*\\)" subdir) |
| 429 | (match-string 1 subdir) subdir)) | 428 | (match-string 1 subdir) subdir)) |
| 430 | "-pkg.el")) | 429 | "-pkg.el")) |
| 431 | 430 | ||