--- lisp/menubar-items.el.save2	Wed Oct 28 19:20:34 1998
+++ lisp/menubar-items.el	Wed Oct 28 20:42:23 1998
@@ -234,6 +234,10 @@
        ["Browse..." customize-browse])
       
       ("Manage Packages"
+       ("Add Download Site"
+        :filter (lambda (&rest junk)
+                  (package-get-download-menu)))
+       ["Update Package Index" package-get-update-base]
        ["List & Install" pui-list-packages]
        ("Using Custom"
 	("Select" :filter (lambda (&rest junk)
--- lisp/package-get.el.save2	Tue Oct 27 17:31:19 1998
+++ lisp/package-get.el	Wed Oct 28 20:33:10 1998
@@ -161,8 +161,7 @@
   :group 'package-get)
 
 ;; JV Any Custom expert know to get "Host" and "Dir" for the remote option
-(defcustom package-get-remote
-  '(("ftp.xemacs.org" "/pub/xemacs/packages"))
+(defcustom package-get-remote nil
   "*List of remote sites to contact for downloading packages.
 List format is '(site-name directory-on-site).  Each site is tried in
 order until the package is found.  As a special case, `site-name' can be
@@ -172,12 +171,58 @@
 			 (list :tag "Remote" string string) ))
   :group 'package-get)
 
+(defcustom package-get-download-sites
+  '(
+    ;; North America
+    ("xemacs.org" "ftp.xemacs.org" "pub/xemacs/packages")
+    ("cso.uiuc.edu" "ftp.cso.uiuc.edu" "pub/packages/xemacs/packages")
+
+    ;; South America
+    ("unicamp.br" "ftp.unicamp.br" "pub/xemacs/packages")
+
+    ;; Europe
+    ("sunsite.cnlab-switch.ch" "sunsite.cnlab-switch.ch" "mirror/xemacs/packages")
+    ("tu-darmstadt.de" "ftp.tu-darmstadt.de" "pub/editors/xemacs/packages")
+    ("sunsite.auc.dk" "sunsite.auc.dk" "pub/emacs/xemacs/packages")
+    ("pasteur.fr" "ftp.pasteur.fr" "pub/computing/xemacs/packages")
+    ("cenatls.cena.dgac.fr" "ftp.cenatls.cena.dgac.fr" "pub/Emacs/xemacs/packages")
+    ("kfki.hu" "ftp.kfki.hu" "pub/packages/xemacs/packages")
+    ("uniroma2.it" "ftp.uniroma2.it" "unix/misc/dist/XEMACS/packages")
+    ("icm.edu.pl" "ftp.icm.edu.pl" "pub/unix/editors/xemacs/packages")
+    ("sunet.se" "ftp.sunet.se" "pub/gnu/xemacs/packages")
+    ("doc.ic.ac.uk" "ftp.doc.ic.ac.uk" "packages/xemacs/packages")
+    ("srcc.msu.su" "ftp1.srcc.msu.su" "mirror/ftp.xemacs.org/packages")
+
+    ;; Asia
+    ("usyd.edu.au" "ftp.usyd.edu.au" "pub/Xemacs/packages")
+    ("netlab.is.tsukuba.ac.jp" "ftp.netlab.is.tsukuba.ac.jp" "pub/GNU/xemacs/packages")
+    ("jaist.ac.jp" "ftp.jaist.ac.jp" "pub/GNU/xemacs/packages")
+    ("ring.aist.go.jp" "ring.aist.go.jp" "pub/text/xemacs/packages")
+    ("ring.asahi-net.or.jp" "ring.asahi-net.or.jp" "pub/text/xemacs/packages")
+    ("SunSITE.sut.ac.jp" "SunSITE.sut.ac.jp" "pub/archives/packages/xemacs/packages")
+    ("dti.ad.jp" "ftp.dti.ad.jp" "pub/unix/editor/xemacs/packages")
+    ("kreonet.re.kr" "ftp.kreonet.re.kr" "pub/tools/emacs/xemacs/packages")
+    )
+  "*List of remote sites available for downloading packages.
+List format is '(site-description site-name directory-on-site).
+SITE-DESCRIPTION is a textual description of the site.  SITE-NAME
+is the internet address of the download site.  DIRECTORY-ON-SITE
+is the directory on the site in which packages may be found.
+This variable is used to initialize `package-get-remote', the
+variable actually used to specify package download sites."
+  :tag "Package download sites"
+  :type '(repeat (list string string))
+  :group 'package-get)
+
 (defcustom package-get-remove-copy nil
   "*After copying and installing a package, if this is T, then remove the
 copy.  Otherwise, keep it around."
   :type 'boolean
   :group 'package-get)
 
+;; #### it may make sense for this to be a list of names.
+;; #### also, should we rename "*base*" to "*index*" or "*db*"?
+;;      "base" is a pretty poor name.
 (defcustom package-get-base-filename "package-index.LATEST.pgp"
   "*Name of the default package-get database file.
 This may either be a relative path, in which case it is interpreted
@@ -193,6 +238,15 @@
   :group 'package-get)
 
 ;;;###autoload
+(defun package-get-download-menu ()
+  "Build the `Add Download Site' menu."
+  (mapcar (lambda (site)
+            (vector (car site)
+                    `(push (quote ,(cdr site))
+                           package-get-remote)))
+          package-get-download-sites))
+
+;;;###autoload
 (defun package-get-require-base ()
   "Require that a package-get database has been loaded."
   (when (or (not (boundp 'package-get-base))
@@ -218,9 +272,11 @@
       (setq package-get-base (cons entry package-get-base))
       (package-get-custom-add-entry (car entry) (car (cdr entry))))))
 
-(defun package-get-locate-file (file)
+(defun package-get-locate-file (file &optional nil-if-not-found)
   "Locate an existing FILE with respect to `package-get-remote'.
-If FILE is an absolute path or is not found, simply return FILE."
+If FILE is an absolute path or is not found, simply return FILE.
+If optional argument NIL-IF-NOT-FOUND is non-nil, return nil
+if FILE can not be located."
   (if (file-name-absolute-p file)
       file
     (let ((entries package-get-remote)
@@ -231,21 +287,28 @@
               (setq entries  nil
                     expanded expn)))
         (setq entries (cdr entries)))
-      (or expanded file))))
+      (or expanded
+          (and (not nil-if-not-found)
+               file)))))
+
+(defun package-get-locate-index-file ()
+  "Locate the package-get index file."
+  (or (package-get-locate-file package-get-base-filename t)
+      (locate-data-file package-get-base-filename)
+      package-get-base-filename))
 
 ;;;###autoload
 (defun package-get-update-base (&optional db-file)
   "Update the package-get database file with entries from DB-FILE."
   (interactive
-   (let ((dflt (package-get-locate-file package-get-base-filename)))
+   (let ((dflt (package-get-locate-index-file)))
      (list (read-file-name "Load package-get database: "
                            (file-name-directory dflt)
                            dflt
                            t
                            (file-name-nondirectory dflt)))))
   (setq db-file (expand-file-name (or db-file
-                                      (package-get-locate-file
-                                       package-get-base-filename))))
+                                      (package-get-locate-index-file))))
   (if (not (file-exists-p db-file))
       (error "Package-get database file `%s' does not exist" db-file))
   (if (not (file-readable-p db-file))


