annotate lisp/package-ui.el @ 394:7d59cb494b73 r21-2-12

Import from CVS: tag r21-2-12
author cvs
date Mon, 13 Aug 2007 11:11:37 +0200
parents bbff43aa5eb7
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
1 ;;; package-ui.el ---
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
2
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
3 ;; Copyright (C) 1998 by Darryl Okahata
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
4
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
5 ;; Author: Darryl Okahata <darrylo@sr.hp.com>
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
6 ;; Keywords: internal
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
7
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
9
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
13 ;; any later version.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
14
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
18 ;; General Public License for more details.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
19
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
23 ;; 02111-1307, USA.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
24
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
25 ;;; Synched up with: Not in FSF
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
26
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
27 (require 'package-get) ;; which, in turn, requires 'package-admin
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
28
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
30 ;; User-changeable variables:
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
32
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
33 (defgroup pui nil
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
34 "Conventient interface to the package system."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
35 :group 'package-tools
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
36 :tag "Package User interface"
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
37 :prefix "pui-")
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
38
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
39 (defcustom pui-package-install-dest-dir nil
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
40 "*If non-nil (Automatic) path to package tree to install packages in.
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
41 Otherwise, use old path for installed packages and make a guess for
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
42 new ones."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
43 :group 'pui
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
44 :tag "Install Location"
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
45 :type '(choice (const :tag "Automatic" nil)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
46 (directory)))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
47
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
48 (defcustom pui-list-verbose t
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
49 "*If non-nil, display verbose info in the package list buffer."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
50 :group 'pui
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
51 :tag "Verbose Listing"
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
52 :type 'boolean)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
53
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
54 (defcustom pui-up-to-date-package-face nil
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
55 "*The face to use for packages that are up-to-date."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
56 :group 'pui
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
57 :type 'face)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
58
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
59 (defcustom pui-selected-package-face 'bold
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
60 "*The face to use for selected packages.
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
61 Set this to `nil' to use the `default' face."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
62 :group 'pui
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
63 :type 'face)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
64
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
65 (defcustom pui-deleted-package-face 'blue
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
66 "*The face to use for packages marked for removal.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
67 Set this to `nil' to use the `default' face."
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
68 :group 'pui
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
69 :type 'face)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
70
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
71 (defcustom pui-outdated-package-face 'red
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
72 "*The face to use for outdated packages.
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
73 Set this to `nil' to use the `default' face."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
74 :group 'pui
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
75 :type 'face)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
76
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
77 (defcustom pui-uninstalled-package-face 'italic
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
78 "*The face to use for uninstalled packages.
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
79 Set this to `nil' to use the `default' face."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
80 :group 'pui
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
81 :type 'face)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
82
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
83
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
84
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
85
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
86 (defvar pui-info-buffer "*Packages*"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
87 "Buffer to use for displaying package information.")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
88
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
89 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
90 ;; End of user-changeable variables.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
91 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
92
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
93 (defvar pui-selected-packages nil
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
94 "The list of user-selected packages to install.")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
95
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
96 (defvar pui-deleted-packages nil
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
97 "The list of user-selected packages to remove.")
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
98
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
99 (defvar pui-actual-package "")
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
100
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
101 (defvar pui-display-keymap
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
102 (let ((m (make-keymap)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
103 (suppress-keymap m)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
104 (set-keymap-name m 'pui-display-keymap)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
105 (define-key m "q" 'pui-quit)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
106 (define-key m "g" 'pui-list-packages)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
107 (define-key m "i" 'pui-display-info)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
108 (define-key m "?" 'describe-mode)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
109 (define-key m "v" 'pui-toggle-verbosity-redisplay)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
110 (define-key m "d" 'pui-toggle-package-delete-key)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
111 (define-key m "D" 'pui-toggle-package-delete-key)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
112 (define-key m [return] 'pui-toggle-package-key)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
113 (define-key m "x" 'pui-install-selected-packages)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
114 (define-key m "I" 'pui-install-selected-packages)
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
115 (define-key m "r" 'pui-add-required-packages)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
116 (define-key m "n" 'next-line)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
117 (define-key m "+" 'pui-toggle-package-key)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
118 (define-key m "p" 'previous-line)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
119 (define-key m " " 'scroll-up-command)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
120 (define-key m [delete] 'scroll-down-command)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
121 m)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
122 "Keymap to use in the `pui-info-buffer' buffer")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
123
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
124 (defvar pui-package-keymap
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
125 (let ((m (make-sparse-keymap)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
126 (set-keymap-name m 'pui-package-keymap)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
127 (define-key m 'button2 'pui-toggle-package-event)
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
128 ;; We use a popup menu
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
129 (define-key m 'button3 'pui-popup-context-sensitive)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
130 m)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
131 "Keymap to use over package names/descriptions.")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
132
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
133 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
134 ;; End of variables
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
135
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
136
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
137 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
138 ;; Configuration routines
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
139
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
140 (defun pui-directory-exists (dir)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
141 "Check to see if DIR exists in `package-get-remote'."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
142 (let (found)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
143 (mapcar '(lambda (item)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
144 (if (and (null (car item))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
145 (string-equal (file-name-as-directory (car (cdr item)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
146 (file-name-as-directory dir)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
147 (setq found t))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
148 ) package-get-remote)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
149 found
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
150 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
151
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
152 (defun pui-package-dir-list (buffer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
153 "In BUFFER, format the list of package binary paths."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
154 (let ( (count 1) paths sys dir)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
155 (set-buffer buffer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
156 (buffer-disable-undo buffer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
157 (erase-buffer buffer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
158 (insert "Existing package binary paths:\n\n")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
159 (setq paths package-get-remote)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
160 (while paths
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
161 (setq sys (car (car paths))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
162 dir (car (cdr (car paths))))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
163 (insert (format "%2s. " count))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
164 (if (null sys)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
165 (insert dir)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
166 (insert sys ":" dir))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
167 (insert "\n")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
168 (setq count (1+ count))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
169 (setq paths (cdr paths))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
170 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
171 (insert "\nThese are the places that will be searched for package binaries.\n")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
172 (goto-char (point-min))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
173 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
174
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
175 ;;;###autoload
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
176 (defun package-ui-add-site (site)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
177 "Add site to package-get-remote and possibly offer to update package list."
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
178 (let ((had-none (null package-get-remote)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
179 (push site package-get-remote)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
180 (when (and had-none package-get-was-current
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
181 (y-or-n-p "Update Package list?"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
182 (setq package-get-was-current nil)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
183 (package-get-require-base t)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
184 (if (get-buffer pui-info-buffer)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
185 (save-window-excursion
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
186 (pui-list-packages))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
187 (set-menubar-dirty-flag)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
188
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
189
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
190 ;;;###autoload
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
191 (defun pui-add-install-directory (dir)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
192 "Add a new package binary directory to the head of `package-get-remote'.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
193 Note that no provision is made for saving any changes made by this function.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
194 It exists mainly as a convenience for one-time package installations from
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
195 disk."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
196 (interactive (let ( (tmpbuf (get-buffer-create
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
197 "*Existing Package Binary Paths*"))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
198 dir)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
199 (save-window-excursion
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
200 (save-excursion
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
201 (unwind-protect
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
202 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
203 (pui-package-dir-list tmpbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
204 (display-buffer tmpbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
205 (setq dir (read-directory-name
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
206 "New package binary directory to add? "
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
207 nil nil t))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
208 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
209 (kill-buffer tmpbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
210 )))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
211 (list dir)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
212 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
213 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
214 (if (not (pui-directory-exists dir))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
215 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
216 (setq package-get-remote (cons (list nil dir) package-get-remote))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
217 (message "Package directory \"%s\" added." dir)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
218 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
219 (message "Directory \"%s\" already exists in `package-get-remote'." dir))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
220 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
221
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
222 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
223 ;; Package list/installer routines
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
224
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
225 (defun pui-quit ()
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
226 (interactive)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
227 (kill-buffer nil))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
228
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
229 (defun pui-package-symbol-char (pkg-sym version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
230 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
231 (if (package-get-info-find-package packages-package-list pkg-sym)
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
232 (let ((installed (package-get-key pkg-sym :version)))
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
233 (if (>= (if (stringp installed)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
234 (string-to-number installed)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
235 installed)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
236 (if (stringp version)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
237 (string-to-number version)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
238 version))
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
239 (list " " pui-up-to-date-package-face)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
240 (list "*" pui-outdated-package-face)))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
241 (list "-" pui-uninstalled-package-face))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
242 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
243
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
244 (defun pui-update-package-display (extent &optional pkg-sym version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
245 "Update the package status for EXTENT.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
246 If PKG-SYM or VERSION are not given, they are read from the extent.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
247 These are used to determine whether or not the package is installed,
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
248 and whether or not it is up-to-date."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
249 (let (buffer-read-only disp sym-char)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
250 (if (not pkg-sym)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
251 (setq pkg-sym (extent-property extent 'pui-package)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
252 (if (not version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
253 (setq version (package-get-info-prop (extent-property extent 'pui-info)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
254 'version)))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
255 (cond ((member pkg-sym pui-selected-packages)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
256 (if pui-selected-package-face
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
257 (set-extent-face extent (get-face pui-selected-package-face))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
258 (set-extent-face extent (get-face 'default)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
259 (setq sym-char "+"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
260 ((member pkg-sym pui-deleted-packages)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
261 (if pui-deleted-package-face
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
262 (set-extent-face extent (get-face pui-deleted-package-face))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
263 (set-extent-face extent (get-face 'default)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
264 (setq sym-char "D"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
265 (t
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
266 (setq disp (pui-package-symbol-char pkg-sym version))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
267 (setq sym-char (car disp))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
268 (if (car (cdr disp))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
269 (set-extent-face extent (get-face (car (cdr disp))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
270 (set-extent-face extent (get-face 'default)))))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
271 (save-excursion
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
272 (goto-char (extent-start-position extent))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
273 (delete-char 1)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
274 (insert sym-char)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
275 (set-buffer-modified-p nil)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
276 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
277 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
278
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
279 (defun pui-toggle-package (extent)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
280 (let (pkg-sym)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
281 (setq pkg-sym (extent-property extent 'pui-package))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
282 (if (member pkg-sym pui-selected-packages)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
283 (setq pui-selected-packages
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
284 (delete pkg-sym pui-selected-packages))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
285 (setq pui-selected-packages
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
286 (cons pkg-sym pui-selected-packages))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
287 (setq pui-deleted-packages
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
288 (delete pkg-sym pui-deleted-packages)))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
289 (pui-update-package-display extent pkg-sym)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
290 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
291
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
292 (defun pui-toggle-package-key ()
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
293 "Select/unselect package for installation, using the keyboard."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
294 (interactive)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
295 (let (extent)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
296 (if (setq extent (extent-at (point) (current-buffer) 'pui))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
297 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
298 (pui-toggle-package extent)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
299 (forward-line 1)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
300 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
301 (error "No package under cursor!"))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
302 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
303
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
304 (defun pui-toggle-package-delete (extent)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
305 (let (pkg-sym)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
306 (setq pkg-sym (extent-property extent 'pui-package))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
307 (if (member pkg-sym pui-deleted-packages)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
308 (setq pui-deleted-packages
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
309 (delete pkg-sym pui-deleted-packages))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
310 (setq pui-deleted-packages
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
311 (cons pkg-sym pui-deleted-packages))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
312 (setq pui-seleted-packages
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
313 (delete pkg-sym pui-selected-packages)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
314 (pui-update-package-display extent pkg-sym)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
315 ))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
316
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
317
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
318 (defun pui-toggle-package-delete-key ()
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
319 "Select/unselect package for removal, using the keyboard."
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
320 (interactive)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
321 (let (extent)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
322 (if (setq extent (extent-at (point) (current-buffer) 'pui))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
323 (progn
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
324 (pui-toggle-package-delete extent)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
325 (forward-line 1)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
326 )
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
327 (error "No package under cursor!"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
328 ))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
329
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
330 (defun pui-current-package ()
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
331 (let ((extent (extent-at (point) (current-buffer) 'pui)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
332 (if extent
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
333 (extent-property extent 'pui-package))))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
334
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
335 (defun pui-toggle-package-event (event)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
336 "Select/unselect package for installation, using the mouse."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
337 (interactive "e")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
338 (let* ( (ep (event-point event))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
339 (buffer (window-buffer (event-window event)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
340 (extent (extent-at ep buffer 'pui-package))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
341 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
342 (pui-toggle-package extent)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
343 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
344
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
345 (defun pui-toggle-verbosity-redisplay ()
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
346 "Toggle verbose package info."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
347 (interactive)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
348 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
349 (setq pui-list-verbose (not pui-list-verbose))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
350 (pui-list-packages)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
351 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
352
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
353 (defun pui-install-selected-packages ()
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
354 "Install selected packages."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
355 (interactive)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
356 (let ( (tmpbuf "*Packages-To-Remove*") do-delete)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
357 (when pui-deleted-packages
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
358 (save-window-excursion
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
359 (with-output-to-temp-buffer tmpbuf
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
360 (display-completion-list (sort
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
361 (mapcar '(lambda (pkg)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
362 (symbol-name pkg)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
363 )
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
364 pui-deleted-packages)
394
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
365 'string<)
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
366 :activate-callback nil
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
367 :help-string "Packages selected for removal:\n"
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
368 :completion-string t
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
369 ))
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
370 (setq tmpbuf (get-buffer-create tmpbuf))
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
371 (display-buffer tmpbuf)
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
372 (setq do-delete (yes-or-no-p "Remove these packages? "))
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
373 (kill-buffer tmpbuf))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
374 (when do-delete
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
375 (message "Deleting selected packages ...") (sit-for 0)
394
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
376 (mapcar (lambda (pkg)
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
377 (package-admin-delete-binary-package
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
378 pkg (package-admin-get-install-dir pkg nil)))
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
379 pui-deleted-packages)
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
380 (message "Packages deleted"))))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
381
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
382 (let ( (tmpbuf "*Packages-To-Install*") do-install)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
383 (if pui-selected-packages
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
384 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
385 ;; Don't change window config when asking the user if he really
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
386 ;; wants to install the packages. We do this to avoid messing up
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
387 ;; the window configuration if errors occur (we don't want to
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
388 ;; display random buffers in addition to the error buffer, if
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
389 ;; errors occur, which would normally be caused by display-buffer).
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
390 (save-window-excursion
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
391 (with-output-to-temp-buffer tmpbuf
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
392 (display-completion-list (sort
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
393 (mapcar '(lambda (pkg)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
394 (symbol-name pkg)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
395 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
396 pui-selected-packages)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
397 'string<)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
398 :activate-callback nil
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
399 :help-string "Packages selected for installation:\n"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
400 :completion-string t
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
401 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
402 (setq tmpbuf (get-buffer-create tmpbuf))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
403 (display-buffer tmpbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
404 (setq do-install (y-or-n-p "Install these packages? "))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
405 (kill-buffer tmpbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
406 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
407 (if do-install
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
408 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
409 (save-excursion
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
410 ;; Clear old temp buffer history
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
411 (set-buffer (get-buffer-create package-admin-temp-buffer))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
412 (buffer-disable-undo package-admin-temp-buffer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
413 (erase-buffer package-admin-temp-buffer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
414 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
415 (message "Installing selected packages ...") (sit-for 0)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
416 (if (catch 'done
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
417 (mapcar (lambda (pkg)
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
418 (if (not (package-get pkg nil nil
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
419 pui-package-install-dest-dir))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
420 (throw 'done nil)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
421 pui-selected-packages)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
422 t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
423 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
424 (pui-list-packages)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
425 (message "Packages installed")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
426 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
427 )
394
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
428 (clear-message)
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
429 )
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
430 )
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
431 (if pui-deleted-packages
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
432 (pui-list-packages)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
433 (error "No packages have been selected!")))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
434 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
435
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
436 (defun pui-add-required-packages ()
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
437 "Select packages required by those already selected for installation."
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
438 (interactive)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
439 (let ((tmpbuf "*Required-Packages*") do-select)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
440 (if pui-selected-packages
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
441 (let ((dependencies
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
442 (delq nil (mapcar
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
443 (lambda (pkg)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
444 (let ((installed
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
445 (package-get-key pkg :version))
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
446 (current
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
447 (package-get-info-prop
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
448 (package-get-info-version
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
449 (package-get-info-find-package
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
450 package-get-base pkg) nil)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
451 'version)))
394
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
452 (if (or (null installed)
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
453 (< (if (stringp installed)
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
454 (string-to-number installed)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
455 installed)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
456 (if (stringp current)
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
457 (string-to-number current)
394
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 384
diff changeset
458 current)))
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
459 pkg
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
460 nil)))
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
461 (package-get-dependencies pui-selected-packages)))))
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
462 ;; Don't change window config when asking the user if he really
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
463 ;; wants to add the packages. We do this to avoid messing up
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
464 ;; the window configuration if errors occur (we don't want to
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
465 ;; display random buffers in addition to the error buffer, if
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
466 ;; errors occur, which would normally be caused by display-buffer).
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
467 (save-window-excursion
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
468 (with-output-to-temp-buffer tmpbuf
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
469 (display-completion-list (sort
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
470 (mapcar #'(lambda (pkg)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
471 (symbol-name pkg))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
472 dependencies)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
473 'string<)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
474 :activate-callback nil
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
475 :help-string "Required packages:\n"
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
476 :completion-string t))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
477 (setq tmpbuf (get-buffer-create tmpbuf))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
478 (display-buffer tmpbuf)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
479 (setq do-select (y-or-n-p "Select these packages? "))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
480 (kill-buffer tmpbuf))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
481 (if do-select
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
482 (progn
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
483 (setq pui-selected-packages
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
484 (union pui-selected-packages dependencies))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
485 (map-extents #'(lambda (extent maparg)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
486 (pui-update-package-display extent))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
487 nil nil nil nil nil 'pui)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
488 (message "added dependencies"))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
489 (clear-message)))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
490 (error "No packages have been selected!"))))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
491
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
492 (defun pui-help-echo (extent &optional force-update)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
493 "Display additional package info in the modeline.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
494 EXTENT determines the package to display (the package information is
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
495 attached to the extent as properties)."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
496 (let (pkg-sym info inst-ver auth-ver date maintainer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
497 (if (or force-update (not (current-message))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
498 (string-match ".*: .*: " (current-message))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
499 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
500 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
501 (setq pkg-sym (extent-property extent 'pui-package)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
502 info (extent-property extent 'pui-info)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
503 inst-ver (package-get-key pkg-sym :version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
504 auth-ver (package-get-info-prop info 'author-version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
505 date (package-get-info-prop info 'date)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
506 maintainer (package-get-info-prop info 'maintainer))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
507 (if (not inst-ver)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
508 (setq inst-ver ""))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
509 (if pui-list-verbose
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
510 (format "Author version: %-8s %11s: %s"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
511 auth-ver date maintainer)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
512 (format "%-6s: %-8s %11s: %s"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
513 inst-ver auth-ver date maintainer))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
514 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
515 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
516
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
517 (defun pui-display-info (&optional no-error event)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
518 "Display additional package info in the modeline.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
519 Designed to be called interactively (from a keypress)."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
520 (interactive)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
521 (let (extent)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
522 (save-excursion
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
523 (beginning-of-line)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
524 (if (setq extent (extent-at (point) (current-buffer) 'pui))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
525 (message (pui-help-echo extent t))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
526 (if no-error
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
527 (clear-message nil)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
528 (error "No package under cursor!")))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
529 )))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
530
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
531 ;;; "Why is there no standard function to do this?"
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
532 (defun pui-popup-context-sensitive (event)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
533 (interactive "e")
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
534 (save-excursion
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
535 (set-buffer (event-buffer event))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
536 (goto-char (event-point event))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
537 (popup-menu pui-menu event)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
538 ;; I agreee with dired.el this is seriously bogus.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
539 (while (popup-menu-up-p)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
540 (dispatch-event (next-event)))))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
541
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
542 (defvar pui-menu
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
543 '("Packages"
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
544 ["Toggle install " pui-toggle-package-key :active (pui-current-package) :suffix (format "`%s'" (or (pui-current-package) "..."))]
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
545 ["Toggle delete " pui-toggle-package-delete-key :active (pui-current-package) :suffix (format "`%s'" (or (pui-current-package) "..."))]
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
546 ["Info on" pui-display-info :active (pui-current-package) :suffix (format "`%s'" (or (pui-current-package) "..."))]
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
547 "---"
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
548 ["Add Required" pui-add-required-packages t]
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
549 ["Install/Remove Selected" pui-install-selected-packages t]
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
550 "---"
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
551 ["Verbose" pui-toggle-verbosity-redisplay
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
552 :active t :style toggle :selected pui-list-verbose]
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
553 ["Refresh" pui-list-packages t]
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
554 ["Help" pui-help t]
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
555 ["Quit" pui-quit t]))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
556
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
557
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
558 (defun list-packages-mode ()
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
559 "Symbols in the leftmost column:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
560
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
561 + The package is marked for installation.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
562 - The package has not been installed.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
563 D The package has been marked for deletion.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
564 * The currently installed package is old, and a newer version is
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
565 available.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
566
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
567 Useful keys:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
568
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
569 `\\[pui-toggle-package-key]' to select/unselect the current package for installation.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
570 `\\[pui-toggle-package-delete-key]' to select/unselect the current package for removal.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
571 `\\[pui-add-required-packages]' to add any packages required by those selected.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
572 `\\[pui-install-selected-packages]' to install/delete selected packages.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
573 `\\[pui-display-info]' to display additional information about the package in the modeline.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
574 `\\[pui-list-packages]' to refresh the package list.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
575 `\\[pui-toggle-verbosity-redisplay]' to toggle between a verbose and non-verbose display.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
576 `\\[pui-quit]' to kill this buffer.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
577 "
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
578 (error "You cannot enter this mode directly. Use `pui-list-packages'"))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
579
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
580 (put 'list-packages-mode 'mode-class 'special)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
581
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
582 ;;;###autoload
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
583 (defun pui-list-packages ()
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
584 "List all packages and package information.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
585 The package name, version, and description are displayed. From the displayed
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
586 buffer, the user can see which packages are installed, which are not, and
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
587 which are out-of-date (a newer version is available). The user can then
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
588 select packages for installation via the keyboard or mouse."
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
589 (interactive)
377
d883f39b8495 Import from CVS: tag r21-2b4
cvs
parents: 375
diff changeset
590 (package-get-require-base t)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
591 (let ( (outbuf (get-buffer-create pui-info-buffer))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
592 (sep-string "===============================================================================\n")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
593 start )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
594 (message "Creating package list ...") (sit-for 0)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
595 (set-buffer outbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
596 (setq buffer-read-only nil)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
597 (buffer-disable-undo outbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
598 (erase-buffer outbuf)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
599 (kill-all-local-variables)
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
600 (use-local-map pui-display-keymap)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
601 (setq major-mode 'list-packages-mode)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
602 (setq mode-name "Packages")
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
603 (setq truncate-lines t)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
604
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
605 (unless package-get-remote
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
606 (insert "
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
607 Warning: No download sites specified. Package index may be out of date.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
608 If you intend to install packages, specify download sites first.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
609
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
610 "))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
611
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
612 (if pui-list-verbose
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
613 (insert " Latest Installed
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
614 Package name Vers. Vers. Description
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
615 ")
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
616 (insert " Latest
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
617 Package name Vers. Description
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
618 "))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
619 (insert sep-string)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
620 (setq start (point))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
621 (mapcar '(lambda (pkg)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
622 (let (pkg-sym info version desc
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
623 b e extent current-vers disp)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
624 (setq pkg-sym (car pkg)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
625 info (package-get-info-version (cdr pkg) nil))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
626 (setq version (package-get-info-prop info 'version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
627 desc (package-get-info-prop info 'description))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
628
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
629 (setq disp (pui-package-symbol-char pkg-sym
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
630 version))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
631 (setq b (point))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
632 (if pui-list-verbose
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
633 (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
634 (setq current-vers (package-get-key pkg-sym :version))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
635 (cond
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
636 ( (not current-vers)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
637 (setq current-vers "-----") )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
638 ( (stringp current-vers)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
639 (setq current-vers
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
640 (format "%.2f"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
641 (string-to-number current-vers))) )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
642 ( (numberp current-vers)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
643 (setq current-vers (format "%.2f" current-vers)) )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
644 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
645 (insert
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
646 (format "%s %-15s %-5.2f %-5s %s\n"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
647 (car disp) pkg-sym
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
648 (if (stringp version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
649 (string-to-number version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
650 version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
651 current-vers desc))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
652 ;; (insert
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
653 ;; (format "\t\t %-12s %s\n"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
654 ;; (package-get-info-prop info 'author-version)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
655 ;; (package-get-info-prop info 'date)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
656 ;; ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
657 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
658 (insert (format "%s %-15s %-5s %s\n"
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
659 (car disp)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
660 pkg-sym version desc)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
661 (save-excursion
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
662 (setq e (progn
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
663 (forward-line -1)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
664 (end-of-line)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
665 (point)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
666 )
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
667 (setq extent (make-extent b e))
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
668 (if (car (cdr disp))
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
669 (set-extent-face extent (get-face (car (cdr disp))))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
670 (set-extent-face extent (get-face 'default)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
671 (set-extent-property extent 'highlight t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
672 (set-extent-property extent 'pui t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
673 (set-extent-property extent 'pui-package pkg-sym)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
674 (set-extent-property extent 'pui-info info)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
675 (set-extent-property extent 'help-echo 'pui-help-echo)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
676 (set-extent-property extent 'keymap pui-package-keymap)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
677 )) (sort (copy-sequence package-get-base)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
678 '(lambda (a b)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
679 (string< (symbol-name (car a))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
680 (symbol-name (car b)))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
681 )))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
682 (insert sep-string)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
683 (insert (documentation 'list-packages-mode))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
684 (set-buffer-modified-p nil)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
685 (setq buffer-read-only t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
686 (pop-to-buffer outbuf)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
687 (delete-other-windows)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
688 (goto-char start)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
689 (setq pui-selected-packages nil) ; Reset list
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
690 (setq pui-deleted-packages nil) ; Reset list
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
691 (when (featurep 'menubar)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
692 (set-buffer-menubar current-menubar)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
693 (add-submenu '() pui-menu)
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
694 (setq mode-popup-menu pui-menu))
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
695 (clear-message)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
696 ; (message (substitute-command-keys "Press `\\[pui-help]' for help."))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
697 ))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
698
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
699 ;;;###autoload
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 377
diff changeset
700 (defalias 'list-packages 'pui-list-packages)
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
701
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
702 (provide 'package-ui)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
703
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents:
diff changeset
704 ;;; package-ui.el ends here