diff lisp/package-ui.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children d7a9135ec789
line wrap: on
line diff
--- a/lisp/package-ui.el	Mon Aug 13 11:33:40 2007 +0200
+++ b/lisp/package-ui.el	Mon Aug 13 11:35:02 2007 +0200
@@ -31,7 +31,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defgroup pui nil
-  "Conventient interface to the package system."
+  "Convenient interface to the package system."
   :group 'package-tools
   :tag "Package User interface"
   :prefix "pui-")
@@ -140,12 +140,12 @@
 (defun pui-directory-exists (dir)
   "Check to see if DIR exists in `package-get-remote'."
   (let (found)
-    (mapcar '(lambda (item)
-	       (if (and (null (car item))
-			(string-equal (file-name-as-directory (car (cdr item)))
-				      (file-name-as-directory dir)))
-		   (setq found t))
-	       ) package-get-remote)
+    (mapcar #'(lambda (item)
+		(if (and (null (car item))
+			 (string-equal (file-name-as-directory (car (cdr item)))
+				       (file-name-as-directory dir)))
+		    (setq found t)))
+	    package-get-remote)
     found
     ))
 
@@ -309,7 +309,7 @@
 	      (delete pkg-sym pui-deleted-packages))
       (setq pui-deleted-packages
 	    (cons pkg-sym pui-deleted-packages))
-      (setq pui-seleted-packages
+      (setq pui-selected-packages
 	    (delete pkg-sym pui-selected-packages)))
     (pui-update-package-display extent pkg-sym)
     ))
@@ -358,11 +358,8 @@
       (save-window-excursion
 	(with-output-to-temp-buffer tmpbuf
 	  (display-completion-list (sort
-				    (mapcar '(lambda (pkg)
-					       (symbol-name pkg)
-					       )
-					    pui-deleted-packages)
-				    'string<)
+				    (mapcar #'symbol-name pui-deleted-packages)
+				    #'string<)
 				   :activate-callback nil
 				   :help-string "Packages selected for removal:\n"
 				   :completion-string t
@@ -389,16 +386,12 @@
 	  ;; errors occur, which would normally be caused by display-buffer).
 	  (save-window-excursion
 	    (with-output-to-temp-buffer tmpbuf
-	      (display-completion-list (sort
-					(mapcar '(lambda (pkg)
-						   (symbol-name pkg)
-						   )
-						pui-selected-packages)
-					'string<)
-				       :activate-callback nil
-				       :help-string "Packages selected for installation:\n"
-				       :completion-string t
-				       ))
+	      (display-completion-list
+	       (sort (mapcar #'symbol-name pui-selected-packages) #'string<)
+	       :activate-callback nil
+	       :help-string "Packages selected for installation:\n"
+	       :completion-string t
+	       ))
 	    (setq tmpbuf (get-buffer-create tmpbuf))
 	    (display-buffer tmpbuf)
 	    (setq do-install (y-or-n-p "Install these packages? "))
@@ -528,17 +521,6 @@
 	  (error "No package under cursor!")))
       )))
 
-;;; "Why is there no standard function to do this?"
-(defun pui-popup-context-sensitive (event)
-  (interactive "e")
-  (save-excursion
-    (set-buffer (event-buffer event))
-    (goto-char (event-point event))
-    (popup-menu pui-menu event)
-    ;; I agree with dired.el - this is seriously bogus.
-    (while (popup-menu-up-p)
-      (dispatch-event (next-event)))))
-
 (defvar pui-menu
   '("Packages"
     ["Toggle install " pui-toggle-package-key :active (pui-current-package) :suffix (format "`%s'" (or (pui-current-package) "..."))]
@@ -554,6 +536,16 @@
     ["Help" pui-help t]
     ["Quit" pui-quit t]))
 
+;;; "Why is there no standard function to do this?"
+(defun pui-popup-context-sensitive (event)
+  (interactive "e")
+  (save-excursion
+    (set-buffer (event-buffer event))
+    (goto-char (event-point event))
+    (popup-menu pui-menu event)
+    ;; I agree with dired.el - this is seriously bogus.
+    (while (popup-up-p)
+      (dispatch-event (next-event)))))
 
 (defun list-packages-mode ()
     "Symbols in the leftmost column:
@@ -618,67 +610,66 @@
 "))
     (insert sep-string)
     (setq start (point))
-    (mapcar '(lambda (pkg)
-	       (let (pkg-sym info version desc
-			     b e extent current-vers disp)
-		 (setq pkg-sym (car pkg)
-		       info (package-get-info-version (cdr pkg) nil))
-		 (setq version (package-get-info-prop info 'version)
-		       desc (package-get-info-prop info 'description))
+    (mapcar
+     #'(lambda (pkg)
+	 (let (pkg-sym info version desc
+		       b e extent current-vers disp)
+	   (setq pkg-sym (car pkg)
+		 info (package-get-info-version (cdr pkg) nil))
+	   (setq version (package-get-info-prop info 'version)
+		 desc (package-get-info-prop info 'description))
 
-		 (setq disp (pui-package-symbol-char pkg-sym
-						     version))
-		 (setq b (point))
-		 (if pui-list-verbose
-		     (progn
-		       (setq current-vers (package-get-key pkg-sym :version))
-		       (cond
-			( (not current-vers)
-			  (setq current-vers "-----") )
-			( (stringp current-vers)
-			  (setq current-vers
-				(format "%.2f"
-					(string-to-number current-vers))) )
-			( (numberp current-vers)
-			  (setq current-vers (format "%.2f" current-vers)) )
-			)
-		       (insert
-			(format "%s %-15s %-5.2f  %-5s  %s\n"
-				(car disp) pkg-sym 
-				(if (stringp version)
-				    (string-to-number version)
-				  version)
-				current-vers desc))
-;;		       (insert
-;;			(format "\t\t  %-12s  %s\n"
-;;				(package-get-info-prop info 'author-version)
-;;				(package-get-info-prop info 'date)
-;;				))
-		       )
-		   (insert (format "%s %-15s %-5s %s\n"
-				   (car disp)
-				   pkg-sym version desc)))
-		 (save-excursion
-		   (setq e (progn
-			     (forward-line -1)
-			     (end-of-line)
-			     (point)))
-		   )
-		 (setq extent (make-extent b e))
-		 (if (car (cdr disp))
-		     (set-extent-face extent (get-face (car (cdr disp))))
-		   (set-extent-face extent (get-face 'default)))
-		 (set-extent-property extent 'highlight t)
-		 (set-extent-property extent 'pui t)
-		 (set-extent-property extent 'pui-package pkg-sym)
-		 (set-extent-property extent 'pui-info info)
-		 (set-extent-property extent 'help-echo 'pui-help-echo)
-		 (set-extent-property extent 'keymap pui-package-keymap)
-		 )) (sort (copy-sequence package-get-base)
-			  '(lambda (a b)
-			     (string< (symbol-name (car a))
-				      (symbol-name (car b)))
-			       )))
+	   (setq disp (pui-package-symbol-char pkg-sym
+					       version))
+	   (setq b (point))
+	   (if pui-list-verbose
+	       (progn
+		 (setq current-vers (package-get-key pkg-sym :version))
+		 (cond
+		  ( (not current-vers)
+		    (setq current-vers "-----") )
+		  ( (stringp current-vers)
+		    (setq current-vers
+			  (format "%.2f"
+				  (string-to-number current-vers))) )
+		  ( (numberp current-vers)
+		    (setq current-vers (format "%.2f" current-vers)) )
+		  )
+		 (insert
+		  (format "%s %-15s %-5.2f  %-5s  %s\n"
+			  (car disp) pkg-sym 
+			  (if (stringp version)
+			      (string-to-number version)
+			    version)
+			  current-vers desc))
+		 ;; (insert
+		 ;;  (format "\t\t  %-12s  %s\n"
+		 ;;    (package-get-info-prop info 'author-version)
+		 ;;    (package-get-info-prop info 'date)))
+		 )
+	     (insert (format "%s %-15s %-5s %s\n"
+			     (car disp)
+			     pkg-sym version desc)))
+	   (save-excursion
+	     (setq e (progn
+		       (forward-line -1)
+		       (end-of-line)
+		       (point))))
+	   (setq extent (make-extent b e))
+	   (if (car (cdr disp))
+	       (set-extent-face extent (get-face (car (cdr disp))))
+	     (set-extent-face extent (get-face 'default)))
+	   (set-extent-property extent 'highlight t)
+	   (set-extent-property extent 'pui t)
+	   (set-extent-property extent 'pui-package pkg-sym)
+	   (set-extent-property extent 'pui-info info)
+	   (set-extent-property extent 'help-echo 'pui-help-echo)
+	   (set-extent-property extent 'keymap pui-package-keymap)
+	   ))
+     (sort (copy-sequence package-get-base)
+	   #'(lambda (a b)
+	       (string< (symbol-name (car a))
+			(symbol-name (car b))))))
     (insert sep-string)
     (insert (documentation 'list-packages-mode))
     (set-buffer-modified-p nil)
@@ -693,7 +684,7 @@
       (add-submenu '() pui-menu)
       (setq mode-popup-menu pui-menu))
     (clear-message)
-;    (message (substitute-command-keys "Press `\\[pui-help]' for help."))
+    ;;    (message (substitute-command-keys "Press `\\[pui-help]' for help."))
     ))
 
 ;;;###autoload