Mercurial > emacs
annotate lisp/emacs-lisp/package.el @ 110149:4ac2b883320e
Forgor to save ChangeLog for previous commit.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Thu, 02 Sep 2010 12:20:20 +0200 |
parents | 8be2f62f7851 |
children | b071d3abc3f4 |
rev | line source |
---|---|
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; package.el --- Simple package system for Emacs |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Tom Tromey <tromey@redhat.com> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Created: 10 Mar 2007 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Version: 0.9 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; Keywords: tools |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; any later version. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; Boston, MA 02110-1301, USA. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;;; Change Log: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; 2 Apr 2007 - now using ChangeLog file |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; 15 Mar 2007 - updated documentation |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; 14 Mar 2007 - Changed how obsolete packages are handled |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; 13 Mar 2007 - Wrote package-install-from-buffer |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; 12 Mar 2007 - Wrote package-menu mode |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;;; Commentary: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;; The idea behind package.el is to be able to download packages and |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;; install them. Packages are versioned and have versioned |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ;; dependencies. Furthermore, this supports built-in packages which |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 ;; may or may not be newer than user-specified packages. This makes |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 ;; it possible to upgrade Emacs and automatically disable packages |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 ;; which have moved from external to core. (Note though that we don't |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ;; currently register any of these, so this feature does not actually |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;; work.) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;; A package is described by its name and version. The distribution |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 ;; format is either a tar file or a single .el file. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 ;; A tar file should be named "NAME-VERSION.tar". The tar file must |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ;; unpack into a directory named after the package and version: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 ;; "NAME-VERSION". It must contain a file named "PACKAGE-pkg.el" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;; which consists of a call to define-package. It may also contain a |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; "dir" file and the info files it references. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
55 ;; A .el file is named "NAME-VERSION.el" in the remote archive, but is |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 ;; installed as simply "NAME.el" in a directory named "NAME-VERSION". |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
58 ;; The downloader downloads all dependent packages. By default, |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
59 ;; packages come from the official GNU sources, but others may be |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
60 ;; added by customizing the `package-archives' alist. Packages get |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
61 ;; byte-compiled at install time. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 ;; At activation time we will set up the load-path and the info path, |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 ;; and we will load the package's autoloads. If a package's |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 ;; dependencies are not available, we will not activate that package. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 ;; Conceptually a package has multiple state transitions: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 ;; |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 ;; * Download. Fetching the package from ELPA. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 ;; * Install. Untar the package, or write the .el file, into |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 ;; ~/.emacs.d/elpa/ directory. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 ;; * Byte compile. Currently this phase is done during install, |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 ;; but we may change this. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 ;; * Activate. Evaluate the autoloads for the package to make it |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 ;; available to the user. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 ;; * Load. Actually load the package and run some code from it. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 ;; Other external functions you may want to use: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 ;; |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 ;; M-x package-list-packages |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 ;; Enters a mode similar to buffer-menu which lets you manage |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 ;; packages. You can choose packages for install (mark with "i", |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 ;; then "x" to execute) or deletion (not implemented yet), and you |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 ;; can see what packages are available. This will automatically |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 ;; fetch the latest list of packages from ELPA. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 ;; |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 ;; M-x package-list-packages-no-fetch |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 ;; Like package-list-packages, but does not automatically fetch the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 ;; new list of packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 ;; |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 ;; M-x package-install-from-buffer |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 ;; Install a package consisting of a single .el file that appears |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 ;; in the current buffer. This only works for packages which |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 ;; define a Version header properly; package.el also supports the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ;; extension headers Package-Version (in case Version is an RCS id |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 ;; or similar), and Package-Requires (if the package requires other |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 ;; packages). |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 ;; |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 ;; M-x package-install-file |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 ;; Install a package from the indicated file. The package can be |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 ;; either a tar file or a .el file. A tar file must contain an |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 ;; appropriately-named "-pkg.el" file; a .el file must be properly |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 ;; formatted as with package-install-from-buffer. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ;;; Thanks: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 ;;; (sorted by sort-lines): |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 ;; Jim Blandy <jimb@red-bean.com> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 ;; Karl Fogel <kfogel@red-bean.com> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 ;; Kevin Ryde <user42@zip.com.au> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 ;; Lawrence Mitchell |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 ;; Michael Olson <mwolson@member.fsf.org> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 ;; Sebastian Tennant <sebyte@smolny.plus.com> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 ;; Stefan Monnier <monnier@iro.umontreal.ca> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 ;; Phil Hagelberg <phil@hagelb.org> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 ;;; ToDo: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 ;; - putting info dirs at the start of the info path means |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 ;; users see a weird ordering of categories. OTOH we want to |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 ;; override later entries. maybe emacs needs to enforce |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 ;; the standard layout? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 ;; - put bytecode in a separate directory tree |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 ;; - perhaps give users a way to recompile their bytecode |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 ;; or do it automatically when emacs changes |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 ;; - give users a way to know whether a package is installed ok |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 ;; - give users a way to view a package's documentation when it |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 ;; only appears in the .el |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 ;; - use/extend checkdoc so people can tell if their package will work |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 ;; - "installed" instead of a blank in the status column |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 ;; - tramp needs its files to be compiled in a certain order. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 ;; how to handle this? fix tramp? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ;; - on emacs 21 we don't kill the -autoloads.el buffer. what about 22? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 ;; - maybe we need separate .elc directories for various emacs versions |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 ;; and also emacs-vs-xemacs. That way conditional compilation can |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 ;; work. But would this break anything? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 ;; - should store the package's keywords in archive-contents, then |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 ;; let the users filter the package-menu by keyword. See |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ;; finder-by-keyword. (We could also let people view the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;; Commentary, but it isn't clear how useful this is.) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 ;; - William Xu suggests being able to open a package file without |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 ;; installing it |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 ;; - Interface with desktop.el so that restarting after an install |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 ;; works properly |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 ;; - Implement M-x package-upgrade, to upgrade any/all existing packages |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 ;; - Use hierarchical layout. PKG/etc PKG/lisp PKG/info |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 ;; ... except maybe lisp? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 ;; - It may be nice to have a macro that expands to the package's |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 ;; private data dir, aka ".../etc". Or, maybe data-directory |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 ;; needs to be a list (though this would be less nice) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 ;; a few packages want this, eg sokoban |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 ;; - package menu needs: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 ;; ability to know which packages are built-in & thus not deletable |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 ;; it can sometimes print odd results, like 0.3 available but 0.4 active |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 ;; why is that? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 ;; - Allow multiple versions on the server...? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 ;; [ why bother? ] |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 ;; - Don't install a package which will invalidate dependencies overall |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 ;; - Allow something like (or (>= emacs 21.0) (>= xemacs 21.5)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 ;; [ currently thinking, why bother.. KISS ] |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 ;; - Allow optional package dependencies |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 ;; then if we require 'bbdb', bbdb-specific lisp in lisp/bbdb |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 ;; and just don't compile to add to load path ...? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 ;; - Have a list of archive URLs? [ maybe there's no point ] |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 ;; - David Kastrup pointed out on the xemacs list that for GPL it |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 ;; is friendlier to ship the source tree. We could "support" that |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 ;; by just having a "src" subdir in the package. This isn't ideal |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 ;; but it probably is not worth trying to support random source |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 ;; tree layouts, build schemes, etc. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 ;; - Our treatment of the info path is somewhat bogus |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 ;; - perhaps have an "unstable" tree in ELPA as well as a stable one |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 ;;; Code: |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (defgroup package nil |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 "Manager for Emacs Lisp packages." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 :group 'applications |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 :version "24.1") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 ;;;###autoload |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (defcustom package-enable-at-startup t |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 "Whether to activate installed packages when Emacs starts. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 If non-nil, packages are activated after reading the init file |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 and before `after-init-hook'. Activation is not done if |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 `user-init-file' is nil (e.g. Emacs was started with \"-q\"). |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 Even if the value is nil, you can type \\[package-initialize] to |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 activate the package system at any time." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 :type 'boolean |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 :group 'package |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 :version "24.1") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (defcustom package-load-list '(all) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 "List of packages for `package-initialize' to load. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 Each element in this list should be a list (NAME VERSION), or the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 symbol `all'. The symbol `all' says to load the latest installed |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 versions of all packages not specified by other elements. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 For an element (NAME VERSION), NAME is a package name (a symbol). |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 VERSION should be t, a string, or nil. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 If VERSION is t, all versions are loaded, though obsolete ones |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 will be put in `package-obsolete-alist' and not activated. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 If VERSION is a string, only that version is ever loaded. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 Any other version, even if newer, is silently ignored. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 Hence, the package is \"held\" at that version. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 If VERSION is nil, the package is not loaded (it is \"disabled\")." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 :type '(repeat symbol) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
209 :risky t |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 :group 'package |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 :version "24.1") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (defvar Info-directory-list) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (declare-function info-initialize "info" ()) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (declare-function url-http-parse-response "url-http" ()) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (declare-function lm-header "lisp-mnt" (header)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (declare-function lm-commentary "lisp-mnt" (&optional file)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (declare-function dired-delete-file "dired" (file &optional recursive trash)) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
219 (defvar url-http-end-of-headers) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
221 (defcustom package-archives '(("gnu" . "http://elpa.gnu.org/packages/")) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
222 "An alist of archives from which to fetch. |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
223 The default value points to the GNU Emacs package repository. |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
224 Each element has the form (ID . URL), where ID is an identifier |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
225 string for an archive and URL is a http: URL (a string)." |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
226 :type '(alist :key-type (string :tag "Archive name") |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
227 :value-type (string :tag "Archive URL")) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
228 :risky t |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
229 :group 'package |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
230 :version "24.1") |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (defconst package-archive-version 1 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 "Version number of the package archive understood by this file. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 Lower version numbers than this will probably be understood as well.") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (defconst package-el-version "1.0" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 "Version of package.el.") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 ;; We don't prime the cache since it tends to get out of date. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (defvar package-archive-contents nil |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 "Cache of the contents of the Emacs Lisp Package Archive. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 This is an alist mapping package names (symbols) to package |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 descriptor vectors. These are like the vectors for `package-alist' |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
244 but have extra entries: one which is 'tar for tar packages and |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
245 'single for single-file packages, and one which is the name of |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
246 the archive from which it came.") |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
247 (put 'package-archive-contents 'risky-local-variable t) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (defcustom package-user-dir (locate-user-emacs-file "elpa") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 "Directory containing the user's Emacs Lisp packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 The directory name should be absolute. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 Apart from this directory, Emacs also looks for system-wide |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 packages in `package-directory-list'." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 :type 'directory |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
255 :risky t |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 :group 'package |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 :version "24.1") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (defcustom package-directory-list |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 ;; Defaults are subdirs named "elpa" in the site-lisp dirs. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (let (result) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (dolist (f load-path) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (if (equal (file-name-nondirectory f) "site-lisp") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (push (expand-file-name "elpa" f) result))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (nreverse result)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 "List of additional directories containing Emacs Lisp packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 Each directory name should be absolute. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 These directories contain packages intended for system-wide; in |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 contrast, `package-user-dir' contains packages for personal use." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 :type '(repeat directory) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
272 :risky t |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 :group 'package |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 :version "24.1") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
276 ;; The value is precomputed in finder-inf.el, but don't load that |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
277 ;; until it's needed (i.e. when `package-intialize' is called). |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
278 (defvar package--builtins nil |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
279 "Alist of built-in packages. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
280 Each element has the form (PKG . DESC), where PKG is a package |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
281 name (a symbol) and DESC is a vector that describes the package. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
283 The vector DESC has the form [VERSION REQS DOCSTRING]. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
284 VERSION is a version list. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
285 REQS is a list of packages (symbols) required by the package. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
286 DOCSTRING is a brief description of the package.") |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
287 (put 'package--builtins 'risky-local-variable t) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
289 (defvar package-alist nil |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 "Alist of all packages available for activation. |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
291 Each element has the form (PKG . DESC), where PKG is a package |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
292 name (a symbol) and DESC is a vector that describes the package. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
294 The vector DESC has the form [VERSION REQS DOCSTRING]. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
295 VERSION is a version list. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
296 REQS is a list of packages (symbols) required by the package. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
297 DOCSTRING is a brief description of the package. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
298 |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
299 This variable is set automatically by `package-load-descriptor', |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
300 called via `package-initialize'. To change which packages are |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
301 loaded and/or activated, customize `package-load-list'.") |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
302 (put 'package-archive-contents 'risky-local-variable t) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
304 (defvar package-activated-list nil |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 "List of the names of currently activated packages.") |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
306 (put 'package-activated-list 'risky-local-variable t) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (defvar package-obsolete-alist nil |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 "Representation of obsolete packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 Like `package-alist', but maps package name to a second alist. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 The inner alist is keyed by version.") |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
312 (put 'package-obsolete-alist 'risky-local-variable t) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (defconst package-subdirectory-regexp |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 "^\\([^.].*\\)-\\([0-9]+\\(?:[.][0-9]+\\)*\\)$" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 "Regular expression matching the name of a package subdirectory. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 The first subexpression is the package name. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 The second subexpression is the version string.") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (defun package-version-join (l) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 "Turn a list of version numbers into a version string." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 (mapconcat 'int-to-string l ".")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (defun package-strip-version (dirname) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 "Strip the version from a combined package name and version. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 E.g., if given \"quux-23.0\", will return \"quux\"" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (if (string-match package-subdirectory-regexp dirname) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (match-string 1 dirname))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (defun package-load-descriptor (dir package) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
331 "Load the description file in directory DIR for package PACKAGE." |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
332 (let* ((pkg-dir (expand-file-name package dir)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
333 (pkg-file (expand-file-name |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
334 (concat (package-strip-version package) "-pkg") |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
335 pkg-dir))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
336 (when (and (file-directory-p pkg-dir) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
337 (file-exists-p (concat pkg-file ".el"))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
338 (load pkg-file nil t)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 (defun package-load-all-descriptors () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 "Load descriptors for installed Emacs Lisp packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 This looks for package subdirectories in `package-user-dir' and |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 `package-directory-list'. The variable `package-load-list' |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 controls which package subdirectories may be loaded. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 In each valid package subdirectory, this function loads the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 description file containing a call to `define-package', which |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 updates `package-alist' and `package-obsolete-alist'." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (let ((all (memq 'all package-load-list)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 name version force) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (dolist (dir (cons package-user-dir package-directory-list)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (when (file-directory-p dir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 (dolist (subdir (directory-files dir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (when (and (file-directory-p (expand-file-name subdir dir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 (string-match package-subdirectory-regexp subdir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (setq name (intern (match-string 1 subdir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 version (match-string 2 subdir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 force (assq name package-load-list)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (when (cond |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 ((null force) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 all) ; not in package-load-list |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 ((null (setq force (cadr force))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 nil) ; disabled |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 ((eq force t) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 t) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 ((stringp force) ; held |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
367 (version-list-= (version-to-list version) |
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
368 (version-to-list force))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (t |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (error "Invalid element in `package-load-list'"))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 (package-load-descriptor dir subdir)))))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (defsubst package-desc-vers (desc) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 "Extract version from a package description vector." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (aref desc 0)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (defsubst package-desc-reqs (desc) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 "Extract requirements from a package description vector." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 (aref desc 1)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (defsubst package-desc-doc (desc) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 "Extract doc string from a package description vector." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (aref desc 2)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (defsubst package-desc-kind (desc) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 "Extract the kind of download from an archive package description vector." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (aref desc 3)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
389 (defun package--dir (name version-string) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
390 (let* ((subdir (concat name "-" version-string)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 (dir-list (cons package-user-dir package-directory-list)) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
392 pkg-dir) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 (while dir-list |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
394 (let ((subdir-full (expand-file-name subdir (car dir-list)))) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
395 (if (file-directory-p subdir-full) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
396 (setq pkg-dir subdir-full |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
397 dir-list nil) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (setq dir-list (cdr dir-list))))) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
399 pkg-dir)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
400 |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
401 (defun package-activate-1 (package pkg-vec) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
402 (let* ((name (symbol-name package)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
403 (version-str (package-version-join (package-desc-vers pkg-vec))) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
404 (pkg-dir (package--dir name version-str))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 (unless pkg-dir |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 (error "Internal error: could not find directory for %s-%s" |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
407 name version-str)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
408 ;; Add info node. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 (if (file-exists-p (expand-file-name "dir" pkg-dir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 (progn |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 ;; FIXME: not the friendliest, but simple. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 (require 'info) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 (info-initialize) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 (setq Info-directory-list (cons pkg-dir Info-directory-list)))) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
415 ;; Add to load path, add autoloads, and activate the package. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 (setq load-path (cons pkg-dir load-path)) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
417 (load (expand-file-name (concat name "-autoloads") pkg-dir) nil t) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 (setq package-activated-list (cons package package-activated-list)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 ;; Don't return nil. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 t)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (defun package--built-in (package version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 "Return true if the package is built-in to Emacs." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 (let ((elt (assq package package--builtins))) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
425 (and elt (version-list-= (package-desc-vers (cdr elt)) version)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 ;; FIXME: return a reason instead? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (defun package-activate (package version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 "Activate a package, and recursively activate its dependencies. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 Return nil if the package could not be activated." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 ;; Assume the user knows what he is doing -- go ahead and activate a |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 ;; newer version of a package if an older one has already been |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 ;; activated. This is not ideal; we'd at least need to check to see |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 ;; if the package has actually been loaded, and not merely |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 ;; activated. However, don't try to activate 'emacs', as that makes |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 ;; no sense. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 (unless (eq package 'emacs) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (let* ((pkg-desc (assq package package-alist)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (this-version (package-desc-vers (cdr pkg-desc))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (req-list (package-desc-reqs (cdr pkg-desc))) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
441 ;; If the package was never activated, do it now. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 (keep-going (or (not (memq package package-activated-list)) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
443 (version-list-< version this-version)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 (while (and req-list keep-going) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 (let* ((req (car req-list)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 (req-name (car req)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 (req-version (cadr req))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 (or (package-activate req-name req-version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 (setq keep-going nil))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 (setq req-list (cdr req-list))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (if keep-going |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 (package-activate-1 package (cdr pkg-desc)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 ;; We get here if a dependency failed to activate -- but we |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 ;; can also get here if the requested package was already |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 ;; activated. Return non-nil in the latter case. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 (and (memq package package-activated-list) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
457 (version-list-<= version this-version)))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 (defun package-mark-obsolete (package pkg-vec) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 "Put package on the obsolete list, if not already there." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 (let ((elt (assq package package-obsolete-alist))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (if elt |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 ;; If this obsolete version does not exist in the list, update |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 ;; it the list. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 (unless (assoc (package-desc-vers pkg-vec) (cdr elt)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (setcdr elt (cons (cons (package-desc-vers pkg-vec) pkg-vec) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 (cdr elt)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 ;; Make a new association. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (setq package-obsolete-alist |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 (cons (cons package (list (cons (package-desc-vers pkg-vec) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 pkg-vec))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 package-obsolete-alist))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 (defun define-package (name-str version-string |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
475 &optional docstring requirements |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
476 &rest extra-properties) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 "Define a new package. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 NAME is the name of the package, a string. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 VERSION-STRING is the version of the package, a dotted sequence |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 of integers. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 DOCSTRING is the optional description. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 REQUIREMENTS is a list of requirements on other packages. |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
483 Each requirement is of the form (OTHER-PACKAGE \"VERSION\"). |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
484 |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
485 EXTRA-PROPERTIES is currently unused." |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 (let* ((name (intern name-str)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 (pkg-desc (assq name package-alist)) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
488 (new-version (version-to-list version-string)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 (new-pkg-desc |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 (cons name |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 (vector new-version |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 (mapcar |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 (lambda (elt) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 (list (car elt) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
495 (version-to-list (car (cdr elt))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 requirements) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 docstring)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 ;; Only redefine a package if the redefinition is newer. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 (if (or (not pkg-desc) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
500 (version-list-< (package-desc-vers (cdr pkg-desc)) |
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
501 new-version)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 (progn |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (when pkg-desc |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 ;; Remove old package and declare it obsolete. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (setq package-alist (delq pkg-desc package-alist)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (package-mark-obsolete (car pkg-desc) (cdr pkg-desc))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 ;; Add package to the alist. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (setq package-alist (cons new-pkg-desc package-alist))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 ;; You can have two packages with the same version, for instance |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 ;; one in the system package directory and one in your private |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 ;; directory. We just let the first one win. |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
512 (unless (version-list-= new-version |
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
513 (package-desc-vers (cdr pkg-desc))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 ;; The package is born obsolete. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 (package-mark-obsolete (car new-pkg-desc) (cdr new-pkg-desc)))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 ;; From Emacs 22. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 (defun package-autoload-ensure-default-file (file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 "Make sure that the autoload file FILE exists and if not create it." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 (unless (file-exists-p file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 (write-region |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 (concat ";;; " (file-name-nondirectory file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 " --- automatically extracted autoloads\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 ";;\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 ";;; Code:\n\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 "\n;; Local Variables:\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 ";; version-control: never\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 ";; no-byte-compile: t\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 ";; no-update-autoloads: t\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 ";; End:\n" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 ";;; " (file-name-nondirectory file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 " ends here\n") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 nil file)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 (defun package-generate-autoloads (name pkg-dir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 (let* ((auto-name (concat name "-autoloads.el")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 (ignore-name (concat name "-pkg.el")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 (generated-autoload-file (expand-file-name auto-name pkg-dir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 (version-control 'never)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 (require 'autoload) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 (unless (fboundp 'autoload-ensure-default-file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 (package-autoload-ensure-default-file generated-autoload-file)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 (update-directory-autoloads pkg-dir))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 (defun package-untar-buffer () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 "Untar the current buffer. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 This uses `tar-untar-buffer' if it is available. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 Otherwise it uses an external `tar' program. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 `default-directory' should be set by the caller." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (require 'tar-mode) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 (if (fboundp 'tar-untar-buffer) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (progn |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 ;; tar-mode messes with narrowing, so we just let it have the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 ;; whole buffer to play with. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (delete-region (point-min) (point)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 (tar-mode) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 (tar-untar-buffer)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 ;; FIXME: check the result. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 (call-process-region (point) (point-max) "tar" nil '(nil nil) nil |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 "xf" "-"))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 (defun package-unpack (name version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 (let ((pkg-dir (expand-file-name (concat (symbol-name name) "-" version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 package-user-dir))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 ;; Be careful!! |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 (make-directory package-user-dir t) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 (if (file-directory-p pkg-dir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 (mapc (lambda (file) nil) ; 'delete-file -- FIXME: when we're |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 ; more confident |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 (directory-files pkg-dir t "^[^.]"))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 (let* ((default-directory (file-name-as-directory package-user-dir))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 (package-untar-buffer) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 (package-generate-autoloads (symbol-name name) pkg-dir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 (let ((load-path (cons pkg-dir load-path))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 (byte-recompile-directory pkg-dir 0 t))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
578 (defun package--write-file-no-coding (file-name excl) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
579 (let ((buffer-file-coding-system 'no-conversion)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
580 (write-region (point-min) (point-max) file-name nil nil nil excl))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
581 |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 (defun package-unpack-single (file-name version desc requires) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 "Install the contents of the current buffer as a package." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 ;; Special case "package". |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 (if (string= file-name "package") |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
586 (package--write-file-no-coding |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
587 (expand-file-name (concat file-name ".el") package-user-dir) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
588 nil) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (let* ((pkg-dir (expand-file-name (concat file-name "-" version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 package-user-dir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 (el-file (expand-file-name (concat file-name ".el") pkg-dir)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (pkg-file (expand-file-name (concat file-name "-pkg.el") pkg-dir))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 (make-directory pkg-dir t) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
594 (package--write-file-no-coding el-file 'excl) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 (let ((print-level nil) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 (print-length nil)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 (write-region |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 (concat |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 (prin1-to-string |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 (list 'define-package |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 file-name |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 version |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 desc |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (list 'quote |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 ;; Turn version lists into string form. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 (mapcar |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 (lambda (elt) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 (list (car elt) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 (package-version-join (car (cdr elt))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 requires)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 "\n") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 nil |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 pkg-file |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 nil nil nil 'excl)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 (package-generate-autoloads file-name pkg-dir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 (let ((load-path (cons pkg-dir load-path))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 (byte-recompile-directory pkg-dir 0 t))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 (defun package-handle-response () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 "Handle the response from the server. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 Parse the HTTP response and throw if an error occurred. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 The url package seems to require extra processing for this. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 This should be called in a `save-excursion', in the download buffer. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
624 It will move point to somewhere in the headers." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 ;; We assume HTTP here. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 (require 'url-http) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 (let ((response (url-http-parse-response))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 (when (or (< response 200) (>= response 300)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 (display-buffer (current-buffer)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 (error "Error during download request:%s" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 (buffer-substring-no-properties (point) (progn |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 (end-of-line) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 (point))))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 (defun package-download-single (name version desc requires) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 "Download and install a single-file package." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 (let ((buffer (url-retrieve-synchronously |
109580
3021343b766a
Update package-x to latest package.el changes.
Chong Yidong <cyd@stupidchicken.com>
parents:
109567
diff
changeset
|
638 (concat (package-archive-url name) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 (symbol-name name) "-" version ".el")))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 (with-current-buffer buffer |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 (package-handle-response) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 (re-search-forward "^$" nil 'move) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 (forward-char) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 (delete-region (point-min) (point)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 (package-unpack-single (symbol-name name) version desc requires) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 (kill-buffer buffer)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 (defun package-download-tar (name version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 "Download and install a tar package." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 (let ((tar-buffer (url-retrieve-synchronously |
109580
3021343b766a
Update package-x to latest package.el changes.
Chong Yidong <cyd@stupidchicken.com>
parents:
109567
diff
changeset
|
651 (concat (package-archive-url name) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 (symbol-name name) "-" version ".tar")))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 (with-current-buffer tar-buffer |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 (package-handle-response) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 (re-search-forward "^$" nil 'move) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 (forward-char) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 (package-unpack name version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (kill-buffer tar-buffer)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
660 (defun package-installed-p (package &optional min-version) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 (let ((pkg-desc (assq package package-alist))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 (and pkg-desc |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
663 (version-list-<= min-version |
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
664 (package-desc-vers (cdr pkg-desc)))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
666 (defun package-compute-transaction (package-list requirements) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
667 "Return a list of packages to be installed, including PACKAGE-LIST. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
668 PACKAGE-LIST should be a list of package names (symbols). |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
669 |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
670 REQUIREMENTS should be a list of additional requirements; each |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
671 element in this list should have the form (PACKAGE VERSION), |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
672 where PACKAGE is a package name and VERSION is the required |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
673 version of that package (as a list). |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
674 |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
675 This function recursively computes the requirements of the |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
676 packages in REQUIREMENTS, and returns a list of all the packages |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
677 that must be installed. Packages that are already installed are |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
678 not included in this list." |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 (dolist (elt requirements) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 (let* ((next-pkg (car elt)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 (next-version (cadr elt))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 (unless (package-installed-p next-pkg next-version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 ;; A package is required, but not installed. It might also be |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 ;; blocked via `package-load-list'. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 (let ((pkg-desc (assq next-pkg package-archive-contents)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 hold) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 (when (setq hold (assq next-pkg package-load-list)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 (setq hold (cadr hold)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 (cond ((eq hold nil) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 (error "Required package '%s' is disabled" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 (symbol-name next-pkg))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 ((null (stringp hold)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 (error "Invalid element in `package-load-list'")) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
694 ((version-list-< (version-to-list hold) next-version) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 (error "Package '%s' held at version %s, \ |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 but version %s required" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 (symbol-name next-pkg) hold |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 (package-version-join next-version))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 (unless pkg-desc |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 (error "Package '%s' is not available for installation" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 (symbol-name next-pkg))) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
702 (unless (version-list-<= next-version |
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
703 (package-desc-vers (cdr pkg-desc))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 (error |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 "Need package '%s' with version %s, but only %s is available" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 (symbol-name next-pkg) (package-version-join next-version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
707 (package-version-join (package-desc-vers (cdr pkg-desc))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 ;; Only add to the transaction if we don't already have it. |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
709 (unless (memq next-pkg package-list) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
710 (setq package-list (cons next-pkg package-list))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
711 (setq package-list |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
712 (package-compute-transaction package-list |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
713 (package-desc-reqs |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 (cdr pkg-desc)))))))) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
715 package-list) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 (defun package-read-from-string (str) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 "Read a Lisp expression from STR. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
719 Signal an error if the entire string was not used." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 (let* ((read-data (read-from-string str)) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
721 (more-left |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
722 (condition-case nil |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
723 ;; The call to `ignore' suppresses a compiler warning. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
724 (progn (ignore (read-from-string |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
725 (substring str (cdr read-data)))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
726 t) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
727 (end-of-file nil)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
728 (if more-left |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 (error "Can't read whole string") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
730 (car read-data)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
731 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 (defun package--read-archive-file (file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 "Re-read archive file FILE, if it exists. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
734 Will return the data from the file, or nil if the file does not exist. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 Will throw an error if the archive version is too new." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
736 (let ((filename (expand-file-name file package-user-dir))) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
737 (when (file-exists-p filename) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
738 (with-temp-buffer |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
739 (insert-file-contents-literally filename) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
740 (let ((contents (read (current-buffer)))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
741 (if (> (car contents) package-archive-version) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
742 (error "Package archive version %d is higher than %d" |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
743 (car contents) package-archive-version)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
744 (cdr contents)))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
746 (defun package-read-all-archive-contents () |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
747 "Re-read `archive-contents', if it exists. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
748 If successful, set `package-archive-contents'." |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
749 (dolist (archive package-archives) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
750 (package-read-archive-contents (car archive)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
752 (defun package-read-archive-contents (archive) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
753 "Re-read archive contents for ARCHIVE. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
754 If successful, set the variable `package-archive-contents'. |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
755 If the archive version is too new, signal an error." |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
756 ;; Version 1 of 'archive-contents' is identical to our internal |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
757 ;; representation. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
758 (let* ((dir (concat "archives/" archive)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
759 (contents-file (concat dir "/archive-contents")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
760 contents) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
761 (when (setq contents (package--read-archive-file contents-file)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
762 (dolist (package contents) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
763 (package--add-to-archive-contents package archive))))) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
764 |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
765 (defun package--add-to-archive-contents (package archive) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
766 "Add the PACKAGE from the given ARCHIVE if necessary. |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
767 Also, add the originating archive to the end of the package vector." |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
768 (let* ((name (car package)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
769 (version (aref (cdr package) 0)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
770 (entry (cons (car package) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
771 (vconcat (cdr package) (vector archive)))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
772 (existing-package (cdr (assq name package-archive-contents)))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
773 (when (or (not existing-package) |
109731
01af31a38d9e
Use version-list-* functions in package.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
109602
diff
changeset
|
774 (version-list-< (aref existing-package 0) version)) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
775 (add-to-list 'package-archive-contents entry)))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
776 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
777 (defun package-download-transaction (package-list) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
778 "Download and install all the packages in PACKAGE-LIST. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
779 PACKAGE-LIST should be a list of package names (symbols). |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
780 This function assumes that all package requirements in |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
781 PACKAGE-LIST are satisfied, i.e. that PACKAGE-LIST is computed |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
782 using `package-compute-transaction'." |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
783 (dolist (elt package-list) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 (let* ((desc (cdr (assq elt package-archive-contents))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
785 ;; As an exception, if package is "held" in |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 ;; `package-load-list', download the held version. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 (hold (cadr (assq elt package-load-list))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 (v-string (or (and (stringp hold) hold) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 (package-version-join (package-desc-vers desc)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
790 (kind (package-desc-kind desc))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
791 (cond |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
792 ((eq kind 'tar) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
793 (package-download-tar elt v-string)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
794 ((eq kind 'single) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
795 (package-download-single elt v-string |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
796 (package-desc-doc desc) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
797 (package-desc-reqs desc))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 (t |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 (error "Unknown package kind: %s" (symbol-name kind))))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
800 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 ;;;###autoload |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 (defun package-install (name) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 "Install the package named NAME. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 Interactively, prompt for the package name. |
109580
3021343b766a
Update package-x to latest package.el changes.
Chong Yidong <cyd@stupidchicken.com>
parents:
109567
diff
changeset
|
805 The package is found on one of the archives in `package-archives'." |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (interactive |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
807 (list (intern (completing-read "Install package: " |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
808 (mapcar (lambda (elt) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
809 (cons (symbol-name (car elt)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
810 nil)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
811 package-archive-contents) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
812 nil t)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
813 (let ((pkg-desc (assq name package-archive-contents))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
814 (unless pkg-desc |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
815 (error "Package '%s' is not available for installation" |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
816 (symbol-name name))) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
817 (package-download-transaction |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
818 (package-compute-transaction (list name) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
819 (package-desc-reqs (cdr pkg-desc))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
820 ;; Try to activate it. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
821 (package-initialize)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
822 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
823 (defun package-strip-rcs-id (v-str) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
824 "Strip RCS version ID from the version string. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
825 If the result looks like a dotted numeric version, return it. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
826 Otherwise return nil." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
827 (if v-str |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
828 (if (string-match "^[ \t]*[$]Revision:[ \t]\([0-9.]+\)[ \t]*[$]$" v-str) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
829 (match-string 1 v-str) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
830 (if (string-match "^[0-9.]*$" v-str) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
831 v-str)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
832 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
833 (defun package-buffer-info () |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
834 "Return a vector describing the package in the current buffer. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
835 The vector has the form |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
836 |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
837 [FILENAME REQUIRES DESCRIPTION VERSION COMMENTARY] |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
838 |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
839 FILENAME is the file name, a string, sans the \".el\" extension. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
840 REQUIRES is a requires list, or nil. |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
841 DESCRIPTION is the package description, a string. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
842 VERSION is the version, a string. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
843 COMMENTARY is the commentary section, a string, or nil if none. |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
844 |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
845 If the buffer does not contain a conforming package, signal an |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
846 error. If there is a package, narrow the buffer to the file's |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
847 boundaries." |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
848 (goto-char (point-min)) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
849 (unless (re-search-forward "^;;; \\([^ ]*\\)\\.el --- \\(.*\\)$" nil t) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
850 (error "Packages lacks a file header")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
851 (let ((file-name (match-string-no-properties 1)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
852 (desc (match-string-no-properties 2)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
853 (start (line-beginning-position))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
854 (unless (search-forward (concat ";;; " file-name ".el ends here")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
855 (error "Package lacks a terminating comment")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
856 ;; Try to include a trailing newline. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
857 (forward-line) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
858 (narrow-to-region start (point)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
859 (require 'lisp-mnt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
860 ;; Use some headers we've invented to drive the process. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
861 (let* ((requires-str (lm-header "package-requires")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
862 (requires (if requires-str |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
863 (package-read-from-string requires-str))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
864 ;; Prefer Package-Version; if defined, the package author |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
865 ;; probably wants us to use it. Otherwise try Version. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
866 (pkg-version |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
867 (or (package-strip-rcs-id (lm-header "package-version")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
868 (package-strip-rcs-id (lm-header "version")))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
869 (commentary (lm-commentary))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
870 (unless pkg-version |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
871 (error |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
872 "Package lacks a \"Version\" or \"Package-Version\" header")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
873 ;; Turn string version numbers into list form. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
874 (setq requires |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
875 (mapcar |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
876 (lambda (elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
877 (list (car elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
878 (version-to-list (car (cdr elt))))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
879 requires)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
880 (vector file-name requires desc pkg-version commentary)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
881 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
882 (defun package-tar-file-info (file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
883 "Find package information for a tar file. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
884 FILE is the name of the tar file to examine. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
885 The return result is a vector like `package-buffer-info'." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
886 (unless (string-match "^\\(.+\\)-\\([0-9.]+\\)\\.tar$" file) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
887 (error "Invalid package name `%s'" file)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
888 (let* ((pkg-name (file-name-nondirectory (match-string-no-properties 1 file))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
889 (pkg-version (match-string-no-properties 2 file)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
890 ;; Extract the package descriptor. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
891 (pkg-def-contents (shell-command-to-string |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
892 ;; Requires GNU tar. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
893 (concat "tar -xOf " file " " |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
894 pkg-name "-" pkg-version "/" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
895 pkg-name "-pkg.el"))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
896 (pkg-def-parsed (package-read-from-string pkg-def-contents))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
897 (unless (eq (car pkg-def-parsed) 'define-package) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
898 (error "No `define-package' sexp is present in `%s-pkg.el'" pkg-name)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
899 (let ((name-str (nth 1 pkg-def-parsed)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
900 (version-string (nth 2 pkg-def-parsed)) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
901 (docstring (nth 3 pkg-def-parsed)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
902 (requires (nth 4 pkg-def-parsed)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
903 (readme (shell-command-to-string |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
904 ;; Requires GNU tar. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
905 (concat "tar -xOf " file " " |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
906 pkg-name "-" pkg-version "/README")))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
907 (unless (equal pkg-version version-string) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
908 (error "Package has inconsistent versions")) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
909 (unless (equal pkg-name name-str) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
910 (error "Package has inconsistent names")) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
911 ;; Kind of a hack. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
912 (if (string-match ": Not found in archive" readme) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
913 (setq readme nil)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
914 ;; Turn string version numbers into list form. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
915 (if (eq (car requires) 'quote) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
916 (setq requires (car (cdr requires)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
917 (setq requires |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
918 (mapcar (lambda (elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
919 (list (car elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
920 (version-to-list (cadr elt)))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
921 requires)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
922 (vector pkg-name requires docstring version-string readme)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
923 |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
924 ;;;###autoload |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
925 (defun package-install-from-buffer (pkg-info type) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
926 "Install a package from the current buffer. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
927 When called interactively, the current buffer is assumed to be a |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
928 single .el file that follows the packaging guidelines; see info |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
929 node `(elisp)Packaging'. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
930 |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
931 When called from Lisp, PKG-INFO is a vector describing the |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
932 information, of the type returned by `package-buffer-info'; and |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
933 TYPE is the package type (either `single' or `tar')." |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
934 (interactive (list (package-buffer-info) 'single)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
935 (save-excursion |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
936 (save-restriction |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
937 (let* ((file-name (aref pkg-info 0)) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
938 (requires (aref pkg-info 1)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
939 (desc (if (string= (aref pkg-info 2) "") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
940 "No description available." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
941 (aref pkg-info 2))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
942 (pkg-version (aref pkg-info 3))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
943 ;; Download and install the dependencies. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
944 (let ((transaction (package-compute-transaction nil requires))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
945 (package-download-transaction transaction)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
946 ;; Install the package itself. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
947 (cond |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
948 ((eq type 'single) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
949 (package-unpack-single file-name pkg-version desc requires)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
950 ((eq type 'tar) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
951 (package-unpack (intern file-name) pkg-version)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
952 (t |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
953 (error "Unknown type: %s" (symbol-name type)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
954 ;; Try to activate it. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
955 (package-initialize))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
956 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
957 ;;;###autoload |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
958 (defun package-install-file (file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
959 "Install a package from a file. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
960 The file can either be a tar file or an Emacs Lisp file." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
961 (interactive "fPackage file name: ") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
962 (with-temp-buffer |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
963 (insert-file-contents-literally file) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
964 (cond |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
965 ((string-match "\\.el$" file) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
966 (package-install-from-buffer (package-buffer-info) 'single)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
967 ((string-match "\\.tar$" file) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
968 (package-install-from-buffer (package-tar-file-info file) 'tar)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
969 (t (error "Unrecognized extension `%s'" (file-name-extension file)))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
970 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
971 (defun package-delete (name version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
972 (require 'dired) ; for dired-delete-file |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
973 (dired-delete-file (expand-file-name (concat name "-" version) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
974 package-user-dir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
975 ;; FIXME: query user? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
976 'always)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
977 |
109580
3021343b766a
Update package-x to latest package.el changes.
Chong Yidong <cyd@stupidchicken.com>
parents:
109567
diff
changeset
|
978 (defun package-archive-url (name) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
979 "Return the archive containing the package NAME." |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
980 (let ((desc (cdr (assq (intern-soft name) package-archive-contents)))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
981 (cdr (assoc (aref desc (- (length desc) 1)) package-archives)))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
982 |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
983 (defun package--download-one-archive (archive file) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
984 "Download an archive file FILE from ARCHIVE, and cache it locally." |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
985 (let* ((archive-name (car archive)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
986 (archive-url (cdr archive)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
987 (dir (expand-file-name "archives" package-user-dir)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
988 (dir (expand-file-name archive-name dir)) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
989 (buffer (url-retrieve-synchronously (concat archive-url file)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
990 (with-current-buffer buffer |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
991 (package-handle-response) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
992 (re-search-forward "^$" nil 'move) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
993 (forward-char) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
994 (delete-region (point-min) (point)) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
995 (make-directory dir t) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
996 (setq buffer-file-name (expand-file-name file dir)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
997 (let ((version-control 'never)) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
998 (save-buffer))) |
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
999 (kill-buffer buffer))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1000 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1001 (defun package-refresh-contents () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1002 "Download the ELPA archive description if needed. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1003 Invoking this will ensure that Emacs knows about the latest versions |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1004 of all packages. This will let Emacs make them available for |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1005 download." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1006 (interactive) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1007 (unless (file-exists-p package-user-dir) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1008 (make-directory package-user-dir t)) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
1009 (dolist (archive package-archives) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1010 (condition-case nil |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1011 (package--download-one-archive archive "archive-contents") |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1012 (error (message "Failed to download `%s' archive." |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1013 (car archive))))) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
1014 (package-read-all-archive-contents)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1015 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1016 ;;;###autoload |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1017 (defun package-initialize () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1018 "Load Emacs Lisp packages, and activate them. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1019 The variable `package-load-list' controls which packages to load." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1020 (interactive) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1021 (require 'finder-inf nil t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1022 (setq package-alist package--builtins) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1023 (setq package-activated-list (mapcar #'car package-alist)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1024 (setq package-obsolete-alist nil) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1025 (package-load-all-descriptors) |
109567
0fc9f7a0d319
Add support for non-default package repositories.
Chong Yidong <cyd@stupidchicken.com>
parents:
109027
diff
changeset
|
1026 (package-read-all-archive-contents) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1027 ;; Try to activate all our packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1028 (mapc (lambda (elt) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1029 (package-activate (car elt) (package-desc-vers (cdr elt)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1030 package-alist)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1031 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1032 |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1033 ;;;; Package description buffer. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1034 |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1035 ;;;###autoload |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1036 (defun describe-package (package) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1037 "Display the full documentation of PACKAGE (a symbol)." |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1038 (interactive |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1039 (let* ((packages (append (mapcar 'car package-alist) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1040 (mapcar 'car package-archive-contents))) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1041 (guess (function-called-at-point)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1042 val) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1043 (unless (memq guess packages) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1044 (setq guess nil)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1045 (setq packages (mapcar 'symbol-name packages)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1046 (setq val |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1047 (completing-read (if guess |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1048 (format "Describe package (default %s): " |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1049 guess) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1050 "Describe package: ") |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1051 packages nil t nil nil guess)) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1052 (list (if (equal val "") guess (intern val))))) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1053 (if (or (null package) (null (symbolp package))) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1054 (message "You did not specify a package") |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1055 (help-setup-xref (list #'describe-package package) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1056 (called-interactively-p 'interactive)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1057 (with-help-window (help-buffer) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1058 (with-current-buffer standard-output |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1059 (describe-package-1 package))))) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1060 |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1061 (defun describe-package-1 (package) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1062 (require 'lisp-mnt) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1063 (let ((package-name (symbol-name package)) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1064 (built-in (assq package package--builtins)) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1065 desc pkg-dir reqs version installable) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1066 (prin1 package) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1067 (princ " is ") |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1068 (if (setq desc (cdr (assq package package-alist))) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1069 ;; This package is loaded (i.e. in `package-alist'). |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1070 (progn |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1071 (setq version (package-version-join (package-desc-vers desc))) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1072 (cond (built-in |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1073 (princ "a built-in package.\n\n")) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1074 ((setq pkg-dir (package--dir package-name version)) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1075 (insert "an installed package.\n\n")) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1076 (t ;; This normally does not happen. |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1077 (insert "a deleted package.\n\n") |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1078 (setq version nil)))) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1079 ;; This package is not installed. |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1080 (setq desc (cdr (assq package package-archive-contents)) |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1081 version (package-version-join (package-desc-vers desc)) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1082 installable t) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1083 (insert "an uninstalled package.\n\n")) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1084 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1085 (insert " " (propertize "Status" 'font-lock-face 'bold) ": ") |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1086 (cond (pkg-dir |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1087 (insert (propertize "Installed" |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1088 'font-lock-face 'font-lock-comment-face)) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1089 (insert " in `") |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1090 ;; Todo: Add button for uninstalling. |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1091 (help-insert-xref-button (file-name-as-directory pkg-dir) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1092 'help-package-def pkg-dir) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1093 (insert "'.")) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1094 (installable |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1095 (insert "Available -- ") |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1096 (let ((button-text (if (display-graphic-p) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1097 "Install" |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1098 "[Install]")) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1099 (button-face (if (display-graphic-p) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1100 '(:box (:line-width 2 :color "dark grey") |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1101 :background "light grey" |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1102 :foreground "black") |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1103 'link))) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1104 (insert-text-button button-text |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1105 'face button-face |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1106 'follow-link t |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1107 'package-symbol package |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1108 'action 'package-install-button-action))) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1109 (built-in |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1110 (insert (propertize "Built-in" |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1111 'font-lock-face 'font-lock-builtin-face) ".")) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1112 (t (insert "Deleted."))) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1113 (insert "\n") |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1114 (and version |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1115 (> (length version) 0) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1116 (insert " " |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1117 (propertize "Version" 'font-lock-face 'bold) ": " version "\n")) |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1118 (setq reqs (package-desc-reqs desc)) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1119 (when reqs |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1120 (insert " " (propertize "Requires" 'font-lock-face 'bold) ": ") |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1121 (let ((first t) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1122 name vers text) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1123 (dolist (req reqs) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1124 (setq name (car req) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1125 vers (cadr req) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1126 text (format "%s-%s" (symbol-name name) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1127 (package-version-join vers))) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1128 (cond (first (setq first nil)) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1129 ((>= (+ 2 (current-column) (length text)) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1130 (window-width)) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1131 (insert ",\n ")) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1132 (t (insert ", "))) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1133 (help-insert-xref-button text 'help-package name)) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1134 (insert "\n"))) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1135 (insert " " (propertize "Summary" 'font-lock-face 'bold) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1136 ": " (package-desc-doc desc) "\n\n") |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1137 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1138 (if (assq package package--builtins) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1139 ;; For built-in packages, insert the commentary. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1140 (let ((fn (locate-file (concat package-name ".el") load-path |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1141 load-file-rep-suffixes)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1142 (opoint (point))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1143 (insert (or (lm-commentary fn) "")) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1144 (save-excursion |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1145 (goto-char opoint) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1146 (when (re-search-forward "^;;; Commentary:\n" nil t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1147 (replace-match "")) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1148 (while (re-search-forward "^\\(;+ ?\\)" nil t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1149 (replace-match "")))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1150 (let ((readme (expand-file-name (concat package-name "-readme.txt") |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1151 package-user-dir))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1152 ;; For elpa packages, try downloading the commentary. If that |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1153 ;; fails, try an existing readme file in `package-user-dir'. |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1154 (cond ((let ((buffer (ignore-errors |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1155 (url-retrieve-synchronously |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1156 (concat (package-archive-url package) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1157 package-name "-readme.txt")))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1158 response) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1159 (when buffer |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1160 (with-current-buffer buffer |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1161 (setq response (url-http-parse-response)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1162 (if (or (< response 200) (>= response 300)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1163 (setq response nil) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1164 (setq buffer-file-name |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1165 (expand-file-name readme package-user-dir)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1166 (delete-region (point-min) (1+ url-http-end-of-headers)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1167 (save-buffer))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1168 (when response |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1169 (insert-buffer-substring buffer) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1170 (kill-buffer buffer) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1171 t)))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1172 ((file-readable-p readme) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1173 (insert-file-contents readme) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1174 (goto-char (point-max)))))))) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1175 |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1176 (defun package-install-button-action (button) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1177 (let ((package (button-get button 'package-symbol))) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1178 (when (y-or-n-p (format "Install package `%s'? " package)) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1179 (package-install package) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1180 (revert-buffer nil t) |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1181 (goto-char (point-min))))) |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1182 |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109020
diff
changeset
|
1183 |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1184 ;;;; Package menu mode. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1185 |
109018
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1186 (defvar package-menu-mode-map |
109020
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1187 (let ((map (make-keymap)) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1188 (menu-map (make-sparse-keymap "Package"))) |
109018
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1189 (suppress-keymap map) |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1190 (define-key map "\C-m" 'package-menu-describe-package) |
109018
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1191 (define-key map "q" 'quit-window) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1192 (define-key map "n" 'next-line) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1193 (define-key map "p" 'previous-line) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1194 (define-key map "u" 'package-menu-mark-unmark) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1195 (define-key map "\177" 'package-menu-backup-unmark) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1196 (define-key map "d" 'package-menu-mark-delete) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1197 (define-key map "i" 'package-menu-mark-install) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1198 (define-key map "g" 'package-menu-revert) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1199 (define-key map "r" 'package-menu-refresh) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1200 (define-key map "~" 'package-menu-mark-obsolete-for-deletion) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1201 (define-key map "x" 'package-menu-execute) |
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1202 (define-key map "h" 'package-menu-quick-help) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1203 (define-key map "?" 'package-menu-describe-package) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1204 (define-key map [follow-link] 'mouse-face) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1205 (define-key map [mouse-2] 'mouse-select-window) |
109020
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1206 (define-key map [menu-bar package-menu] (cons "Package" menu-map)) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1207 (define-key menu-map [mq] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1208 '(menu-item "Quit" quit-window |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1209 :help "Quit package selection")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1210 (define-key menu-map [s1] '("--")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1211 (define-key menu-map [mn] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1212 '(menu-item "Next" next-line |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1213 :help "Next Line")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1214 (define-key menu-map [mp] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1215 '(menu-item "Previous" previous-line |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1216 :help "Previous Line")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1217 (define-key menu-map [s2] '("--")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1218 (define-key menu-map [mu] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1219 '(menu-item "Unmark" package-menu-mark-unmark |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1220 :help "Clear any marks on a package and move to the next line")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1221 (define-key menu-map [munm] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1222 '(menu-item "Unmark backwards" package-menu-backup-unmark |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1223 :help "Back up one line and clear any marks on that package")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1224 (define-key menu-map [md] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1225 '(menu-item "Mark for deletion" package-menu-mark-delete |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1226 :help "Mark a package for deletion and move to the next line")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1227 (define-key menu-map [mi] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1228 '(menu-item "Mark for install" package-menu-mark-install |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1229 :help "Mark a package for installation and move to the next line")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1230 (define-key menu-map [s3] '("--")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1231 (define-key menu-map [mg] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1232 '(menu-item "Update package list" package-menu-revert |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1233 :help "Update the list of packages")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1234 (define-key menu-map [mr] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1235 '(menu-item "Refresh package list" package-menu-refresh |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1236 :help "Download the ELPA archive")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1237 (define-key menu-map [s4] '("--")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1238 (define-key menu-map [mt] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1239 '(menu-item "Mark obsolete packages" package-menu-mark-obsolete-for-deletion |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1240 :help "Mark all obsolete packages for deletion")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1241 (define-key menu-map [mx] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1242 '(menu-item "Execute actions" package-menu-execute |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1243 :help "Perform all the marked actions")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1244 (define-key menu-map [s5] '("--")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1245 (define-key menu-map [mh] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1246 '(menu-item "Help" package-menu-quick-help |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1247 :help "Show short key binding help for package-menu-mode")) |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1248 (define-key menu-map [mc] |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1249 '(menu-item "View Commentary" package-menu-view-commentary |
9087d6113b47
* lisp/emacs-lisp/package.el (package-menu-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109018
diff
changeset
|
1250 :help "Display information about this package")) |
109018
3fa4756bb7be
emacs-lisp/package.el (package-menu-mode-map): Move initialization into declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
109016
diff
changeset
|
1251 map) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1252 "Local keymap for `package-menu-mode' buffers.") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1253 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1254 (defvar package-menu-sort-button-map |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1255 (let ((map (make-sparse-keymap))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1256 (define-key map [header-line mouse-1] 'package-menu-sort-by-column) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1257 (define-key map [header-line mouse-2] 'package-menu-sort-by-column) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1258 (define-key map [follow-link] 'mouse-face) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1259 map) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1260 "Local keymap for package menu sort buttons.") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1261 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1262 (put 'package-menu-mode 'mode-class 'special) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1263 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1264 (defun package-menu-mode () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1265 "Major mode for browsing a list of packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1266 Letters do not insert themselves; instead, they are commands. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1267 \\<package-menu-mode-map> |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1268 \\{package-menu-mode-map}" |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1269 (kill-all-local-variables) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1270 (use-local-map package-menu-mode-map) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1271 (setq major-mode 'package-menu-mode) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1272 (setq mode-name "Package Menu") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1273 (setq truncate-lines t) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1274 (setq buffer-read-only t) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1275 (setq header-line-format |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1276 (mapconcat |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1277 (lambda (pair) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1278 (let ((column (car pair)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1279 (name (cdr pair))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1280 (concat |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1281 ;; Insert a space that aligns the button properly. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1282 (propertize " " 'display (list 'space :align-to column) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1283 'face 'fixed-pitch) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1284 ;; Set up the column button. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1285 (propertize name |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1286 'column-name name |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1287 'help-echo "mouse-1: sort by column" |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1288 'mouse-face 'highlight |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1289 'keymap package-menu-sort-button-map)))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1290 ;; We take a trick from buff-menu and have a dummy leading |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1291 ;; space to align the header line with the beginning of the |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1292 ;; text. This doesn't really work properly on Emacs 21, but |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1293 ;; it is close enough. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1294 '((0 . "") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1295 (2 . "Package") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1296 (20 . "Version") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1297 (32 . "Status") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1298 (43 . "Description")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1299 "")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1300 (run-mode-hooks 'package-menu-mode-hook)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1301 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1302 (defun package-menu-refresh () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1303 "Download the ELPA archive. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1304 This fetches the file describing the current contents of |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1305 the Emacs Lisp Package Archive, and then refreshes the |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1306 package menu. This lets you see what new packages are |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1307 available for download." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1308 (interactive) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1309 (unless (eq major-mode 'package-menu-mode) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1310 (error "The current buffer is not a Package Menu")) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1311 (package-refresh-contents) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1312 (package--generate-package-list)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1313 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1314 (defun package-menu-revert () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1315 "Update the list of packages." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1316 (interactive) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1317 (unless (eq major-mode 'package-menu-mode) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1318 (error "The current buffer is not a Package Menu")) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1319 (package--generate-package-list)) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1320 |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1321 (defun package-menu-describe-package () |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1322 "Describe the package in the current line." |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1323 (interactive) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1324 (let ((name (package-menu-get-package))) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1325 (if name |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1326 (describe-package (intern name)) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1327 (message "No package on this line")))) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1328 |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1329 (defun package-menu-mark-internal (what) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1330 (unless (eobp) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1331 (let ((buffer-read-only nil)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1332 (beginning-of-line) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1333 (delete-char 1) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1334 (insert what) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1335 (forward-line)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1336 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1337 ;; fixme numeric argument |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1338 (defun package-menu-mark-delete (num) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1339 "Mark a package for deletion and move to the next line." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1340 (interactive "p") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1341 (package-menu-mark-internal "D")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1342 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1343 (defun package-menu-mark-install (num) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1344 "Mark a package for installation and move to the next line." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1345 (interactive "p") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1346 (package-menu-mark-internal "I")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1347 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1348 (defun package-menu-mark-unmark (num) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1349 "Clear any marks on a package and move to the next line." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1350 (interactive "p") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1351 (package-menu-mark-internal " ")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1352 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1353 (defun package-menu-backup-unmark () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1354 "Back up one line and clear any marks on that package." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1355 (interactive) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1356 (forward-line -1) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1357 (package-menu-mark-internal " ") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1358 (forward-line -1)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1359 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1360 (defun package-menu-mark-obsolete-for-deletion () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1361 "Mark all obsolete packages for deletion." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1362 (interactive) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1363 (save-excursion |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1364 (goto-char (point-min)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1365 (forward-line 2) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1366 (while (not (eobp)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1367 (if (looking-at ".*\\s obsolete\\s ") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1368 (package-menu-mark-internal "D") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1369 (forward-line 1))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1370 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1371 (defun package-menu-quick-help () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1372 "Show short key binding help for package-menu-mode." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1373 (interactive) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1374 (message "n-ext, i-nstall, d-elete, u-nmark, x-ecute, r-efresh, h-elp")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1375 |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1376 (define-obsolete-function-alias |
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109970
diff
changeset
|
1377 'package-menu-view-commentary 'package-menu-describe-package "24.1") |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1378 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1379 ;; Return the name of the package on the current line. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1380 (defun package-menu-get-package () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1381 (save-excursion |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1382 (beginning-of-line) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1383 (if (looking-at ". \\([^ \t]*\\)") |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1384 (match-string-no-properties 1)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1385 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1386 ;; Return the version of the package on the current line. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1387 (defun package-menu-get-version () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1388 (save-excursion |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1389 (beginning-of-line) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1390 (if (looking-at ". [^ \t]*[ \t]*\\([0-9.]*\\)") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1391 (match-string 1)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1392 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1393 (defun package-menu-get-status () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1394 (save-excursion |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1395 (if (looking-at ". [^ \t]*[ \t]*[^ \t]*[ \t]*\\([^ \t]*\\)") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1396 (match-string 1) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1397 ""))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1398 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1399 (defun package-menu-execute () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1400 "Perform all the marked actions. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1401 Packages marked for installation will be downloaded and |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1402 installed. Packages marked for deletion will be removed. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1403 Note that after installing packages you will want to restart |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1404 Emacs." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1405 (interactive) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1406 (goto-char (point-min)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1407 (while (not (eobp)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1408 (let ((cmd (char-after)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1409 (pkg-name (package-menu-get-package)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1410 (pkg-vers (package-menu-get-version)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1411 (pkg-status (package-menu-get-status))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1412 (cond |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1413 ((eq cmd ?D) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1414 (when (and (string= pkg-status "installed") |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1415 (string= pkg-name "package")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1416 ;; FIXME: actually, we could be tricky and remove all info. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1417 ;; But that is drastic and the user can do that instead. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1418 (error "Can't delete most recent version of `package'")) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1419 ;; Ask for confirmation here? Maybe if package status is ""? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1420 ;; Or if any lisp from package is actually loaded? |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1421 (message "Deleting %s-%s..." pkg-name pkg-vers) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1422 (package-delete pkg-name pkg-vers) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1423 (message "Deleting %s-%s... done" pkg-name pkg-vers)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1424 ((eq cmd ?I) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1425 (package-install (intern pkg-name))))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1426 (forward-line)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1427 (package-menu-revert)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1428 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1429 (defun package-print-package (package version key desc) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1430 (let ((face |
109602
a86a4e812897
Package listing tweaks.
Chong Yidong <cyd@stupidchicken.com>
parents:
109580
diff
changeset
|
1431 (cond ((string= key "built-in") 'font-lock-builtin-face) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1432 ((string= key "available") 'default) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1433 ((string= key "held") 'font-lock-constant-face) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1434 ((string= key "disabled") 'font-lock-warning-face) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1435 ((string= key "installed") 'font-lock-comment-face) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1436 (t ; obsolete, but also the default. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1437 'font-lock-warning-face)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1438 (insert (propertize " " 'font-lock-face face)) |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1439 (insert-text-button (symbol-name package) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1440 'face 'link |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1441 'follow-link t |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1442 'package-symbol package |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1443 'action (lambda (button) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1444 (describe-package |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1445 (button-get button 'package-symbol)))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1446 (indent-to 20 1) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1447 (insert (propertize (package-version-join version) 'font-lock-face face)) |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1448 (indent-to 32 1) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1449 (insert (propertize key 'font-lock-face face)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1450 ;; FIXME: this 'when' is bogus... |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1451 (when desc |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
1452 (indent-to 43 1) |
109602
a86a4e812897
Package listing tweaks.
Chong Yidong <cyd@stupidchicken.com>
parents:
109580
diff
changeset
|
1453 (let ((opoint (point))) |
a86a4e812897
Package listing tweaks.
Chong Yidong <cyd@stupidchicken.com>
parents:
109580
diff
changeset
|
1454 (insert (propertize desc 'font-lock-face face)) |
a86a4e812897
Package listing tweaks.
Chong Yidong <cyd@stupidchicken.com>
parents:
109580
diff
changeset
|
1455 (upcase-region opoint (min (point) (1+ opoint))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1456 (insert "\n"))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1457 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1458 (defun package-list-maybe-add (package version status description result) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1459 (unless (assoc (cons package version) result) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1460 (setq result (cons (list (cons package version) status description) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1461 result))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1462 result) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1463 |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1464 (defvar package-menu-package-list nil |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1465 "List of packages to display in the Package Menu buffer. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1466 A value of nil means to display all packages.") |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1467 |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1468 (defvar package-menu-sort-key nil |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1469 "Sort key for the current Package Menu buffer.") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1470 |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1471 (defun package--generate-package-list () |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1472 "Populate the current Package Menu buffer." |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1473 (package-initialize) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1474 (let ((inhibit-read-only t) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1475 info-list name desc hold builtin) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1476 (setq buffer-read-only nil) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1477 (erase-buffer) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1478 ;; List installed packages |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1479 (dolist (elt package-alist) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1480 (setq name (car elt)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1481 (when (and (not (eq name 'emacs)) ; Hide the `emacs' package. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1482 (or (null package-menu-package-list) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1483 (memq name package-menu-package-list))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1484 (setq desc (cdr elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1485 hold (cadr (assq name package-load-list)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1486 builtin (cdr (assq name package--builtins))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1487 (setq info-list |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1488 (package-list-maybe-add |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1489 name (package-desc-vers desc) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1490 ;; FIXME: it turns out to be tricky to see if this |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1491 ;; package is presently activated. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1492 (cond ((stringp hold) "held") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1493 ((and builtin |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1494 (version-list-= |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1495 (package-desc-vers builtin) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1496 (package-desc-vers desc))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1497 "built-in") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1498 (t "installed")) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1499 (package-desc-doc desc) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1500 info-list)))) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1501 |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1502 ;; List available and disabled packages |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1503 (dolist (elt package-archive-contents) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1504 (setq name (car elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1505 desc (cdr elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1506 hold (assq name package-load-list)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1507 (when (or (null package-menu-package-list) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1508 (memq name package-menu-package-list)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1509 (setq info-list |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1510 (package-list-maybe-add name |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1511 (package-desc-vers desc) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1512 (if (and hold (null (cadr hold))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1513 "disabled" |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1514 "available") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1515 (package-desc-doc (cdr elt)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1516 info-list)))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1517 ;; List obsolete packages |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1518 (mapc (lambda (elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1519 (mapc (lambda (inner-elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1520 (setq info-list |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1521 (package-list-maybe-add (car elt) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1522 (package-desc-vers |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1523 (cdr inner-elt)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1524 "obsolete" |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1525 (package-desc-doc |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1526 (cdr inner-elt)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1527 info-list))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1528 (cdr elt))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1529 package-obsolete-alist) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1530 |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1531 (setq info-list |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1532 (sort info-list |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1533 (cond ((string= package-menu-sort-key "Package") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1534 'package-menu--name-predicate) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1535 ((string= package-menu-sort-key "Version") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1536 'package-menu--version-predicate) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1537 ((string= package-menu-sort-key "Description") |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1538 'package-menu--description-predicate) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1539 (t ; By default, sort by package status |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1540 'package-menu--status-predicate)))) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1541 |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1542 (dolist (elt info-list) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1543 (package-print-package (car (car elt)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1544 (cdr (car elt)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1545 (car (cdr elt)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1546 (car (cdr (cdr elt))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1547 (goto-char (point-min)) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1548 (set-buffer-modified-p nil) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1549 (current-buffer))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1550 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1551 (defun package-menu--version-predicate (left right) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1552 (let ((vleft (or (cdr (car left)) '(0))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1553 (vright (or (cdr (car right)) '(0)))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1554 (if (version-list-= vleft vright) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1555 (package-menu--name-predicate left right) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1556 (version-list-< vleft vright)))) |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1557 |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1558 (defun package-menu--status-predicate (left right) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1559 (let ((sleft (cadr left)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1560 (sright (cadr right))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1561 (cond ((string= sleft sright) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1562 (package-menu--name-predicate left right)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1563 ((string= sleft "available") t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1564 ((string= sright "available") nil) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1565 ((string= sleft "installed") t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1566 ((string= sright "installed") nil) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1567 ((string= sleft "held") t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1568 ((string= sright "held") nil) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1569 ((string= sleft "built-in") t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1570 ((string= sright "built-in") nil) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1571 ((string= sleft "obsolete") t) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1572 ((string= sright "obsolete") nil) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1573 (t (string< sleft sright))))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1574 |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1575 (defun package-menu--description-predicate (left right) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1576 (let ((sleft (car (cddr left))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1577 (sright (car (cddr right)))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1578 (if (string= sleft sright) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1579 (package-menu--name-predicate left right) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1580 (string< sleft sright)))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1581 |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1582 (defun package-menu--name-predicate (left right) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1583 (string< (symbol-name (caar left)) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1584 (symbol-name (caar right)))) |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1585 |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1586 (defun package-menu-sort-by-column (&optional e) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1587 "Sort the package menu by the column of the mouse click E." |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1588 (interactive "e") |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1589 (let* ((pos (event-start e)) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1590 (obj (posn-object pos)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1591 (col (if obj |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1592 (get-text-property (cdr obj) 'column-name (car obj)) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1593 (get-text-property (posn-point pos) 'column-name))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1594 (buf (window-buffer (posn-window (event-start e))))) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1595 (with-current-buffer buf |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1596 (when (eq major-mode 'package-menu-mode) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1597 (setq package-menu-sort-key col) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1598 (package--generate-package-list))))) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1599 |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1600 (defun package--list-packages (&optional packages) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1601 "Generate and pop to the *Packages* buffer. |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1602 Optional PACKAGES is a list of names of packages (symbols) to |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1603 list; the default is to display everything in `package-alist'." |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1604 (with-current-buffer (get-buffer-create "*Packages*") |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1605 (package-menu-mode) |
110056
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1606 (set (make-local-variable 'package-menu-package-list) packages) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1607 (set (make-local-variable 'package-menu-sort-key) nil) |
8be2f62f7851
Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents:
110017
diff
changeset
|
1608 (package--generate-package-list) |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1609 ;; It's okay to use pop-to-buffer here. The package menu buffer |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1610 ;; has keybindings, and the user just typed `M-x list-packages', |
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1611 ;; suggesting that they might want to use them. |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1612 (pop-to-buffer (current-buffer)))) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1613 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1614 ;;;###autoload |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1615 (defun list-packages () |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1616 "Display a list of packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1617 Fetches the updated list of packages before displaying. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1618 The list is displayed in a buffer named `*Packages*'." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1619 (interactive) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1620 (package-refresh-contents) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1621 (package--list-packages)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1622 |
109970
77c4a65b9011
* emacs-lisp/package.el (list-packages): Alias for package-list-packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
109731
diff
changeset
|
1623 ;;;###autoload |
110017
10e66ac64b61
Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
1624 (defalias 'package-list-packages 'list-packages) |
109970
77c4a65b9011
* emacs-lisp/package.el (list-packages): Alias for package-list-packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
109731
diff
changeset
|
1625 |
109016
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1626 (defun package-list-packages-no-fetch () |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1627 "Display a list of packages. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1628 Does not fetch the updated list of packages before displaying. |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1629 The list is displayed in a buffer named `*Packages*'." |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1630 (interactive) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1631 (package--list-packages)) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1632 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1633 (provide 'package) |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1634 |
d73c5483c3d2
Merge package.el, written by Tom Tromey <tromey@redhat.com>.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1635 ;;; package.el ends here |