annotate lisp/package-ui.el @ 316:512e409c26a2 r21-0b56

Import from CVS: tag r21-0b56
author cvs
date Mon, 13 Aug 2007 10:44:46 +0200
parents 341dac730539
children 19dcec799385
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
314
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
1 ;;; package-ui.el ---
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
2
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
3 ;; Copyright (C) 1998 by Darryl Okahata
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
4
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
5 ;; Author: Darryl Okahata <darrylo@sr.hp.com>
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
6 ;; Keywords: internal
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
7
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
9
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
13 ;; any later version.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
14
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
18 ;; General Public License for more details.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
19
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
23 ;; 02111-1307, USA.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
24
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
25 ;;; Synched up with: Not in FSF
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
26
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
27 (require 'package-get) ;; which, in turn, requires 'package-admin
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
28
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
30 ;; User-changeable variables:
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
32
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
33 (defvar pui-up-to-date-package-face nil
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
34 "The face to use for packages that are up-to-date.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
35
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
36 (defvar pui-selected-package-face (get-face 'bold)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
37 "The face to use for selected packages.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
38 Set this to `nil' to use the `default' face.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
39
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
40 (defvar pui-outdated-package-face (get-face 'red)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
41 "The face to use for outdated packages.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
42 Set this to `nil' to use the `default' face.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
43
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
44 (defvar pui-uninstalled-package-face (get-face 'italic)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
45 "The face to use for uninstalled packages.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
46 Set this to `nil' to use the `default' face.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
47
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
48 (defvar pui-list-verbose t
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
49 "If non-nil, display verbose info in the package list buffer.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
50
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
51 (defvar pui-info-buffer "*Packages*"
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
52 "Buffer to use for displaying package information.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
53
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
54 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
55 ;; End of user-changeable variables.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
56 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
57
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
58 (defvar pui-selected-packages nil
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
59 "The list of user-selected packages to install.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
60
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
61 (defvar pui-display-keymap
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
62 (let ((m (make-keymap)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
63 (suppress-keymap m)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
64 (set-keymap-name m 'pui-display-keymap)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
65 (define-key m "q" 'pui-quit)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
66 (define-key m "g" 'pui-list-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
67 (define-key m " " 'pui-display-info)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
68 (define-key m "?" 'pui-help)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
69 (define-key m "v" 'pui-toggle-verbosity-redisplay)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
70 (define-key m "d" 'pui-toggle-verbosity-redisplay)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
71 (define-key m [return] 'pui-toggle-package-key)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
72 (define-key m "x" 'pui-install-selected-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
73 (define-key m "I" 'pui-install-selected-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
74 (define-key m "n" 'next-line)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
75 (define-key m "+" 'next-line)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
76 (define-key m "p" 'previous-line)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
77 (define-key m "-" 'previous-line)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
78 m)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
79 "Keymap to use in the `pui-info-buffer' buffer")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
80
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
81 (defvar pui-package-keymap
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
82 (let ((m (make-sparse-keymap)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
83 (set-keymap-name m 'pui-package-keymap)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
84 (define-key m 'button2 'pui-toggle-package-event)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
85 (define-key m 'button3 'pui-toggle-package-event)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
86 m)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
87 "Keymap to use over package names/descriptions.")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
88
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
89 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
90 ;; End of variables
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
91
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
92
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
93 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
94 ;; Configuration routines
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
95
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
96 (defun pui-directory-exists (dir)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
97 "Check to see if DIR exists in `package-get-remote'."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
98 (let (found)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
99 (mapcar '(lambda (item)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
100 (if (and (null (car item))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
101 (string-equal (file-name-as-directory (car (cdr item)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
102 (file-name-as-directory dir)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
103 (setq found t))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
104 ) package-get-remote)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
105 found
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
106 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
107
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
108 (defun pui-package-dir-list (buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
109 "In BUFFER, format the list of package binary paths."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
110 (let ( (count 1) paths sys dir)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
111 (set-buffer buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
112 (buffer-disable-undo buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
113 (erase-buffer buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
114 (insert "Existing package binary paths:\n\n")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
115 (setq paths package-get-remote)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
116 (while paths
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
117 (setq sys (car (car paths))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
118 dir (car (cdr (car paths))))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
119 (insert (format "%2s. " count))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
120 (if (null sys)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
121 (insert dir)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
122 (insert sys ":" dir))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
123 (insert "\n")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
124 (setq count (1+ count))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
125 (setq paths (cdr paths))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
126 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
127 (insert "\nThese are the places that will be searched for package binaries.\n")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
128 (goto-char (point-min))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
129 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
130
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
131 ;;;###autoload
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
132 (defun pui-add-install-directory (dir)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
133 "Add a new package binary directory to the head of `package-get-remote'.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
134 Note that no provision is made for saving any changes made by this function.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
135 It exists mainly as a convenience for one-time package installations from
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
136 disk."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
137 (interactive (let ( (tmpbuf (get-buffer-create
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
138 "*Existing Package Binary Paths*"))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
139 dir)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
140 (save-window-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
141 (save-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
142 (unwind-protect
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
143 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
144 (pui-package-dir-list tmpbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
145 (display-buffer tmpbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
146 (setq dir (read-directory-name
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
147 "New package binary directory to add? "
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
148 nil nil t))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
149 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
150 (kill-buffer tmpbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
151 )))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
152 (list dir)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
153 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
154 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
155 (if (not (pui-directory-exists dir))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
156 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
157 (setq package-get-remote (cons (list nil dir) package-get-remote))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
158 (message "Package directory \"%s\" added." dir)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
159 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
160 (message "Directory \"%s\" already exists in `package-get-remote'." dir))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
161 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
162
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
163 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
164 ;; Package list/installer routines
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
165
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
166 (defun pui-quit ()
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
167 (interactive)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
168 (kill-buffer nil))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
169
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
170 (defun pui-help ()
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
171 (interactive)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
172 (let ( (help-buffer (get-buffer-create "*Help*")) )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
173 (display-buffer help-buffer t)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
174 (save-window-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
175 (set-buffer help-buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
176 (buffer-disable-undo help-buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
177 (erase-buffer help-buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
178 (insert (pui-help-string))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
179 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
180 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
181
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
182 (defun pui-package-symbol-char (pkg-sym version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
183 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
184 (if (package-get-info-find-package packages-package-list pkg-sym)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
185 (if (package-get-installedp pkg-sym version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
186 (list " " pui-up-to-date-package-face)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
187 (list "*" pui-outdated-package-face))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
188 (list "-" pui-uninstalled-package-face))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
189 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
190
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
191 (defun pui-update-package-display (extent &optional pkg-sym version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
192 "Update the package status for EXTENT.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
193 If PKG-SYM or VERSION are not given, they are read from the extent.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
194 These are used to determine whether or not the package is installed,
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
195 and whether or not it is up-to-date."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
196 (let (buffer-read-only disp sym-char)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
197 (if (not pkg-sym)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
198 (setq pkg-sym (extent-property extent 'pui-package)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
199 (if (not version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
200 (setq version (package-get-info-prop (extent-property extent 'pui-info)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
201 'version)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
202 (if (member pkg-sym pui-selected-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
203 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
204 (if pui-selected-package-face
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
205 (set-extent-face extent (get-face pui-selected-package-face))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
206 (set-extent-face extent (get-face 'default)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
207 (setq sym-char "+")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
208 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
209 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
210 (setq disp (pui-package-symbol-char pkg-sym version))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
211 (setq sym-char (car disp))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
212 (if (cdr disp)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
213 (set-extent-face extent (car (cdr disp)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
214 (set-extent-face extent (get-face 'default)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
215 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
216 (save-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
217 (goto-char (extent-start-position extent))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
218 (delete-char 1)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
219 (insert sym-char)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
220 (set-buffer-modified-p nil)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
221 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
222 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
223
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
224 (defun pui-toggle-package (extent)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
225 (let (pkg-sym)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
226 (setq pkg-sym (extent-property extent 'pui-package))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
227 (if (member pkg-sym pui-selected-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
228 (setq pui-selected-packages
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
229 (delete pkg-sym pui-selected-packages))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
230 (setq pui-selected-packages
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
231 (cons pkg-sym pui-selected-packages)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
232 (pui-update-package-display extent pkg-sym)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
233 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
234
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
235 (defun pui-toggle-package-key ()
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
236 "Select/unselect package for installation, using the keyboard."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
237 (interactive)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
238 (let (extent)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
239 (if (setq extent (extent-at (point) (current-buffer) 'pui))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
240 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
241 (pui-toggle-package extent)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
242 (forward-line 1)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
243 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
244 (error "No package under cursor!"))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
245 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
246
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
247 (defun pui-toggle-package-event (event)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
248 "Select/unselect package for installation, using the mouse."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
249 (interactive "e")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
250 (let* ( (ep (event-point event))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
251 (buffer (window-buffer (event-window event)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
252 (extent (extent-at ep buffer 'pui-package))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
253 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
254 (pui-toggle-package extent)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
255 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
256
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
257 (defun pui-toggle-verbosity-redisplay ()
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
258 "Toggle verbose package info."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
259 (interactive)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
260 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
261 (setq pui-list-verbose (not pui-list-verbose))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
262 (pui-list-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
263 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
264
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
265 (defun pui-install-selected-packages ()
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
266 "Install selected packages."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
267 (interactive)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
268 (let ( (tmpbuf "*Packages-To-Install*") do-install)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
269 (if pui-selected-packages
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
270 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
271 ;; Don't change window config when asking the user if he really
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
272 ;; wants to install the packages. We do this to avoid messing up
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
273 ;; the window configuration if errors occur (we don't want to
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
274 ;; display random buffers in addition to the error buffer, if
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
275 ;; errors occur, which would normally be caused by display-buffer).
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
276 (save-window-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
277 (with-output-to-temp-buffer tmpbuf
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
278 (display-completion-list (sort
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
279 (mapcar '(lambda (pkg)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
280 (symbol-name pkg)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
281 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
282 pui-selected-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
283 'string<)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
284 :activate-callback nil
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
285 :help-string "Packages selected for installation:\n"
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
286 :completion-string t
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
287 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
288 (setq tmpbuf (get-buffer-create tmpbuf))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
289 (display-buffer tmpbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
290 (setq do-install (y-or-n-p "Install these packages? "))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
291 (kill-buffer tmpbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
292 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
293 (if do-install
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
294 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
295 (save-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
296 ;; Clear old temp buffer history
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
297 (set-buffer (get-buffer-create package-admin-temp-buffer))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
298 (buffer-disable-undo package-admin-temp-buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
299 (erase-buffer package-admin-temp-buffer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
300 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
301 (message "Installing selected packages ...") (sit-for 0)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
302 (if (catch 'done
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
303 (mapcar (lambda (pkg)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
304 (if (not (package-get-all pkg nil))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
305 (throw 'done nil)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
306 pui-selected-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
307 t)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
308 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
309 (pui-list-packages)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
310 (message "Packages installed")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
311 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
312 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
313 (clear-message)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
314 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
315 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
316 (error "No packages have been selected!"))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
317 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
318
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
319 (defun pui-help-echo (extent &optional force-update)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
320 "Display additional package info in the modeline.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
321 EXTENT determines the package to display (the package information is
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
322 attached to the extent as properties)."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
323 (let (pkg-sym info inst-ver auth-ver date maintainer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
324 (if (or force-update (not (current-message))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
325 (string-match ".*: .*: " (current-message))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
326 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
327 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
328 (setq pkg-sym (extent-property extent 'pui-package)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
329 info (extent-property extent 'pui-info)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
330 inst-ver (package-get-key pkg-sym :version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
331 auth-ver (package-get-info-prop info 'author-version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
332 date (package-get-info-prop info 'date)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
333 maintainer (package-get-info-prop info 'maintainer))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
334 (if (not inst-ver)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
335 (setq inst-ver ""))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
336 (if pui-list-verbose
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
337 (format "Author version: %-8s %11s: %s"
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
338 auth-ver date maintainer)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
339 (format "%-6s: %-8s %11s: %s"
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
340 inst-ver auth-ver date maintainer))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
341 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
342 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
343
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
344 (defun pui-display-info (&optional no-error)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
345 "Display additional package info in the modeline.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
346 Designed to be called interactively (from a keypress)."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
347 (interactive)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
348 (let (extent)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
349 (save-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
350 (beginning-of-line)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
351 (if (setq extent (extent-at (point) (current-buffer) 'pui))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
352 (message (pui-help-echo extent t))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
353 (if no-error
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
354 (clear-message nil)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
355 (error "No package under cursor!")))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
356 )))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
357
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
358 (defun pui-help-string ()
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
359 "Return the help string for the package-info buffer.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
360 This is not a defconst because of the call to substitute-command-keys."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
361 (save-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
362 (set-buffer (get-buffer pui-info-buffer))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
363 (substitute-command-keys
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
364 "Symbols in the leftmost column:
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
365
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
366 + The package is marked for installation.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
367 - The package has not been installed.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
368 * The currently installed package is old, and a newer version is
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
369 available.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
370
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
371 Useful keys:
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
372
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
373 `\\[pui-toggle-package-key]' to select/unselect the current package for installation.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
374 `\\[pui-install-selected-packages]' to install selected packages.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
375 `\\[pui-display-info]' to display additional information about the package in the modeline.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
376 `\\[pui-list-packages]' to refresh the package list.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
377 `\\[pui-toggle-verbosity-redisplay]' to toggle between a verbose and non-verbose display.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
378 `\\[pui-quit]' to kill this buffer.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
379 ")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
380 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
381
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
382 ;;;###autoload
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
383 (defun pui-list-packages ()
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
384 "List all packages and package information.
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
385 The package name, version, and description are displayed. From the displayed
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
386 buffer, the user can see which packages are installed, which are not, and
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
387 which are out-of-date (a newer version is available). The user can then
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
388 select packages for installation via the keyboard or mouse."
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
389 (interactive)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
390 (let ( (outbuf (get-buffer-create pui-info-buffer))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
391 (sep-string "===============================================================================\n")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
392 start )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
393 (message "Creating package list ...") (sit-for 0)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
394 (set-buffer outbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
395 (setq buffer-read-only nil)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
396 (buffer-disable-undo outbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
397 (erase-buffer outbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
398 (use-local-map pui-display-keymap)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
399 (if pui-list-verbose
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
400 (insert " Latest Installed
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
401 Package name Vers. Vers. Description
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
402 ")
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
403 (insert " Latest
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
404 Package name Vers. Description
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
405 "))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
406 (insert sep-string)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
407 (setq start (point))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
408 (mapcar '(lambda (pkg)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
409 (let (pkg-sym info version desc
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
410 b e extent current-vers disp)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
411 (setq pkg-sym (car pkg)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
412 info (package-get-info-version (cdr pkg) nil))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
413 (setq version (package-get-info-prop info 'version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
414 desc (package-get-info-prop info 'description))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
415
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
416 (setq disp (pui-package-symbol-char pkg-sym
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
417 version))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
418 (setq b (point))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
419 (if pui-list-verbose
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
420 (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
421 (setq current-vers (package-get-key pkg-sym :version))
316
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
422 (cond
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
423 ( (not current-vers)
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
424 (setq current-vers "-----") )
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
425 ( (stringp current-vers)
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
426 (setq current-vers
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
427 (format "%.2f"
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
428 (string-to-number current-vers))) )
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
429 ( (numberp current-vers)
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
430 (setq current-vers (format "%.2f" current-vers)) )
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
431 )
314
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
432 (insert
316
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
433 (format "%s %-15s %-5.2f %-5s %s\n"
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
434 (car disp) pkg-sym
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
435 (if (stringp version)
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
436 (string-to-number version)
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
437 version)
512e409c26a2 Import from CVS: tag r21-0b56
cvs
parents: 314
diff changeset
438 current-vers desc))
314
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
439 ;; (insert
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
440 ;; (format "\t\t %-12s %s\n"
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
441 ;; (package-get-info-prop info 'author-version)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
442 ;; (package-get-info-prop info 'date)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
443 ;; ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
444 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
445 (insert (format "%s %-15s %-5s %s\n"
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
446 (car disp)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
447 pkg-sym version desc)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
448 (save-excursion
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
449 (setq e (progn
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
450 (forward-line -1)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
451 (end-of-line)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
452 (point)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
453 )
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
454 (setq extent (make-extent b e))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
455 (if (cdr disp)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
456 (set-extent-face extent (car (cdr disp)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
457 (set-extent-face extent (get-face 'default)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
458 (set-extent-property extent 'highlight t)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
459 (set-extent-property extent 'pui t)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
460 (set-extent-property extent 'pui-package pkg-sym)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
461 (set-extent-property extent 'pui-info info)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
462 (set-extent-property extent 'help-echo 'pui-help-echo)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
463 (set-extent-property extent 'keymap pui-package-keymap)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
464 )) (sort (copy-sequence package-get-base)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
465 '(lambda (a b)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
466 (string< (symbol-name (car a))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
467 (symbol-name (car b)))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
468 )))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
469 (insert sep-string)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
470 (insert (pui-help-string))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
471 (set-buffer-modified-p nil)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
472 (setq buffer-read-only t)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
473 (pop-to-buffer outbuf)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
474 (delete-other-windows)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
475 (goto-char start)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
476 (setq pui-selected-packages nil) ; Reset list
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
477 (clear-message)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
478 ; (message (substitute-command-keys "Press `\\[pui-help]' for help."))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
479 ))
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
480
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
481 (provide 'package-ui)
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
482
341dac730539 Import from CVS: tag r21-0b55
cvs
parents:
diff changeset
483 ;;; package-ui.el ends here