aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-07-31 20:38:19 -0400
committerChong Yidong2010-07-31 20:38:19 -0400
commit376c2b6b213e0cb7bec08a1ecc01731ac50865b8 (patch)
treedebdff7df2e28076fbdcf54aaf0f2b6be39f7f04
parent76417ef426d826482699766064e66c06af6a07f7 (diff)
downloademacs-376c2b6b213e0cb7bec08a1ecc01731ac50865b8.tar.gz
emacs-376c2b6b213e0cb7bec08a1ecc01731ac50865b8.zip
Package listing tweaks.
* emacs-lisp/package.el (package--list-packages): Fix column alignment. (package--builtins): Tweak descriptions. (package-print-package): Upcase descriptions if necessary. Show all built-in packages in font-lock-builtin-face. (package-list-packages-internal): Omit "emacs" package. Show status of built-in packages as "built-in".
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/emacs-lisp/package.el57
2 files changed, 39 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e282cef0c30..e6d67c13934 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12010-08-01 Chong Yidong <cyd@stupidchicken.com>
2
3 * emacs-lisp/package.el (package--list-packages): Fix column
4 alignment.
5 (package--builtins): Tweak descriptions.
6 (package-print-package): Upcase descriptions if necessary. Show
7 all built-in packages in font-lock-builtin-face.
8 (package-list-packages-internal): Omit "emacs" package. Show
9 status of built-in packages as "built-in".
10
12010-07-31 Chong Yidong <cyd@stupidchicken.com> 112010-07-31 Chong Yidong <cyd@stupidchicken.com>
2 12
3 * mouse.el (mouse-save-then-kill): Doc fix. Deactivate mark 13 * mouse.el (mouse-save-then-kill): Doc fix. Deactivate mark
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 73434a1717b..bcb8349c187 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -292,15 +292,15 @@ contrast, `package-user-dir' contains packages for personal use."
292 (if (>= emacs-major-version 22) 292 (if (>= emacs-major-version 22)
293 ;; FIXME: emacs 22 includes tramp, rcirc, maybe 293 ;; FIXME: emacs 22 includes tramp, rcirc, maybe
294 ;; other things... 294 ;; other things...
295 '((erc . [(5 2) nil "An Emacs Internet Relay Chat client"]) 295 '((erc . [(5 2) nil "Internet Relay Chat client"])
296 ;; The external URL is version 1.15, so make sure the 296 ;; The external URL is version 1.15, so make sure the
297 ;; built-in one looks newer. 297 ;; built-in one looks newer.
298 (url . [(1 16) nil "URL handling libary"]))) 298 (url . [(1 16) nil "URL handling libary"])))
299 (if (>= emacs-major-version 23) 299 (if (>= emacs-major-version 23)
300 '(;; Strangely, nxml-version is missing in Emacs 23. 300 '(;; Strangely, nxml-version is missing in Emacs 23.
301 ;; We pick the merge date as the version. 301 ;; We pick the merge date as the version.
302 (nxml . [(20071123) nil "Major mode for editing XML documents."]) 302 (nxml . [(20071123) nil "Major mode for XML documents"])
303 (bubbles . [(0 5) nil "Puzzle game for Emacs."]))))) 303 (bubbles . [(0 5) nil "A puzzle game"])))))
304 "Alist of all built-in packages. 304 "Alist of all built-in packages.
305Maps the package name to a vector [VERSION REQS DOCSTRING].") 305Maps the package name to a vector [VERSION REQS DOCSTRING].")
306(put 'package--builtins 'risky-local-variable t) 306(put 'package--builtins 'risky-local-variable t)
@@ -358,16 +358,6 @@ FUN can be <, <=, =, >, >=, or /=."
358 ;; Both null. 358 ;; Both null.
359 (funcall fun 0 0)))) 359 (funcall fun 0 0))))
360 360
361(defun package--test-version-compare ()
362 "Test suite for `package-version-compare'."
363 (unless (and (package-version-compare '(0) '(0) '=)
364 (not (package-version-compare '(1) '(0) '=))
365 (package-version-compare '(1 0 1) '(1) '>=)
366 (package-version-compare '(1 0 1) '(1) '>)
367 (not (package-version-compare '(0 9 1) '(1 0 2) '>=)))
368 (error "Failed"))
369 t)
370
371(defun package-strip-version (dirname) 361(defun package-strip-version (dirname)
372 "Strip the version from a combined package name and version. 362 "Strip the version from a combined package name and version.
373E.g., if given \"quux-23.0\", will return \"quux\"" 363E.g., if given \"quux-23.0\", will return \"quux\""
@@ -1422,7 +1412,7 @@ Emacs."
1422 1412
1423(defun package-print-package (package version key desc) 1413(defun package-print-package (package version key desc)
1424 (let ((face 1414 (let ((face
1425 (cond ((eq package 'emacs) 'font-lock-builtin-face) 1415 (cond ((string= key "built-in") 'font-lock-builtin-face)
1426 ((string= key "available") 'default) 1416 ((string= key "available") 'default)
1427 ((string= key "held") 'font-lock-constant-face) 1417 ((string= key "held") 'font-lock-constant-face)
1428 ((string= key "disabled") 'font-lock-warning-face) 1418 ((string= key "disabled") 'font-lock-warning-face)
@@ -1444,7 +1434,9 @@ Emacs."
1444 ;; FIXME: this 'when' is bogus... 1434 ;; FIXME: this 'when' is bogus...
1445 (when desc 1435 (when desc
1446 (indent-to 43 1) 1436 (indent-to 43 1)
1447 (insert (propertize desc 'font-lock-face face))) 1437 (let ((opoint (point)))
1438 (insert (propertize desc 'font-lock-face face))
1439 (upcase-region opoint (min (point) (1+ opoint)))))
1448 (insert "\n"))) 1440 (insert "\n")))
1449 1441
1450(defun package-list-maybe-add (package version status description result) 1442(defun package-list-maybe-add (package version status description result)
@@ -1462,22 +1454,31 @@ Emacs."
1462 (setq buffer-read-only nil) 1454 (setq buffer-read-only nil)
1463 (erase-buffer) 1455 (erase-buffer)
1464 (let ((info-list) 1456 (let ((info-list)
1465 name desc hold) 1457 name desc hold
1458 builtin)
1466 ;; List installed packages 1459 ;; List installed packages
1467 (dolist (elt package-alist) 1460 (dolist (elt package-alist)
1461 ;; Ignore the Emacs package.
1468 (setq name (car elt) 1462 (setq name (car elt)
1469 desc (cdr elt) 1463 desc (cdr elt)
1470 hold (assq name package-load-list)) 1464 hold (assq name package-load-list))
1471 (setq info-list 1465 (unless (eq name 'emacs)
1472 (package-list-maybe-add name (package-desc-vers desc) 1466 (setq info-list
1473 ;; FIXME: it turns out to be 1467 (package-list-maybe-add
1474 ;; tricky to see if this package 1468 name (package-desc-vers desc)
1475 ;; is presently activated. 1469 ;; FIXME: it turns out to be tricky to see if this
1476 (if (stringp (cadr hold)) 1470 ;; package is presently activated.
1477 "held" 1471 (cond ((stringp (cadr hold))
1478 "installed") 1472 "held")
1479 (package-desc-doc desc) 1473 ((and (setq builtin (assq name package--builtins))
1480 info-list))) 1474 (package-version-compare
1475 (package-desc-vers (cdr builtin))
1476 (package-desc-vers desc)
1477 '=))
1478 "built-in")
1479 (t "installed"))
1480 (package-desc-doc desc)
1481 info-list))))
1481 ;; List available packages 1482 ;; List available packages
1482 (dolist (elt package-archive-contents) 1483 (dolist (elt package-archive-contents)
1483 (setq name (car elt) 1484 (setq name (car elt)
@@ -1574,8 +1575,8 @@ Helper function that does all the work for the user-facing functions."
1574 '((0 . "") 1575 '((0 . "")
1575 (2 . "Package") 1576 (2 . "Package")
1576 (20 . "Version") 1577 (20 . "Version")
1577 (30 . "Status") 1578 (32 . "Status")
1578 (41 . "Description")) 1579 (43 . "Description"))
1579 "")) 1580 ""))
1580 1581
1581 ;; It's okay to use pop-to-buffer here. The package menu buffer 1582 ;; It's okay to use pop-to-buffer here. The package menu buffer