 			( t (lwarn "expected archive name or pair %s" a) ) ) ) )
 
 
+(defmacro ngender-archive (&rest archives)
+	(cons
+		'ngender-package-archive
+		(mapcar (lambda (x) (cond
+													( (symbolp x) (symbol-name x) )
+													( (stringp x) x )
+													( t (list 'quote x) ) )) archives) ) )
+
+;; (macroexpand-1 '(ngender-archive gnu "marmalade" ("org" . "https://orgmode.org/elpa/")))
+												
+
 (defun ngender-drop-assoc-by-key (symbol key)
-  (set symbol (assoc-delete-all key (symbol-value symbol)))
+  (set symbol (assoc-delete-all key (ngender-symbol-value symbol)))
 )
 
 (defun ngender-package-archive-delete (key)
-	(ngender-drop-assoc-without 'package-archives key)
+	(ngender-drop-assoc-by-key 'package-archives key)
 )
 
 (defun ngender-package-archive-forget (key)
-	(ngender-drop-assoc-without 'package-archives key)
-	(ngender-drop-assoc-without '*ngender-known-package-archives* key)
-)
-
-;; variables
+	(ngender-drop-assoc-by-key 'package-archives key)
+	(ngender-drop-assoc-by-key '*ngender-known-package-archives* key)
+)
+
+;; Some notes on how Emacs manages package archives:
+;; Variables:
 ;; package-archives - where to fetch packages from
 ;; package-load-list - which installed packages to load - might be (all)
 ;; package-archive-contents - Cache of the contents of the
 ;;		Emacs Lisp Package Archive.  This is an alist mapping
 ;;		package names (symbols) to non-empty lists of
 ;;		`package-desc' structures.
-
-;; functions
+;; Functions:
 ;; package-initialize - load packages from package-load-list
 ;; package-refresh-contents - download descriptions of all packages on package-archives
 

;; We're loading, push us on the stack!
(setq *ngender-modules-loading* (cons (list 'ngender) *ngender-modules-loading*))

(defun ngender-normalize-module (x)
	"a module name should be a string suitable for a filename w/o extensions"
	(cond
		( (stringp x) x )
		( (symbolp x) (symbol-name x) )
		( (and (consp x) (eq 'quote (car x)) (eq 2 (length x)))
			(ngender-warn x "string")
			(ngender-normalize-module (cadr x)) )
		( t (ngender-warn x 'string) nil) ) )

(defun ngender-normalize-feature (x)
	"a feature should be a list whose first element is a symbol"
	(let ( (oops (lambda (x) (ngender-warn x "feature(list with symbol as head)"))) )
		(cond
			( (consp x)
				(let ((car (car x)))
					(cond
						( (symbolp car)
							(if (not (eq 'quote car))
								x
								(oops x)
								(ngender-normalize-module (cadr x)) ) )
						( (stringp car) (cons (intern car) (cdr x)) )
						( t (oops x) nil ) ) ) )
			( (symbolp x) (list x) )
			( (stringp x) (oops x) (list (intern x)) )
			( t (oops x) nil) ) ) )

(defun ngender-provide (module)
	"move (module feature...) from loading to loaded"
	(if-let ( (module (ngender-normalize-module module)) )
		(if-let ( (module+features (assoc module *ngender-modules-loading*)) )
			(lwarn :warning "ngender-provide: no %s being loaded, doing nothing" module)
			(setq *ngender-modules-loading* (cl-delete module+features *ngender-modules-loading*))
			(add-to-list *ngender-modules-loaded* module+features) ) ) )

(defun ngender-load (module &rest features)
	"show we are loading (module features...) and load module using our load path"
	(if-let ( (module (ngender-normalize-module module)) )

		 ("marmalade" . "http://marmalade-repo.org/packages/")
		 ("melpa-stable" . "http://melpa-stable.milkbox.net/packages/")
		 ("org" . "https://orgmode.org/elpa/")
		 ) "package archives we know exist" )

(defvar package-archives
	'( ("gnu" . "http://elpa.gnu.org/packages/") )
  "requested package archives" )

;; the regexp patterns are only heuristic, not definitive!
(defun ngender-archive-name-p (name) (and (stringp name) (string-match "^[[:alpha:]][[:alnum:]-]*$" name)))
(defun ngender-archive-url-p (url) (and (stringp url) (string-match "^https?://" url)))

;; (ngender-validate-list
;; 	*ngender-known-package-archives* (lambda (x) (ngender-archive-name-p (car x))) "package archive name" )

;; (ngender-validate-list
;; 	*ngender-known-package-archives* (lambda (x) (ngender-archive-url-p (cdr x))) "package archive url" )

(defun ngender-archive-p (pair)
	"return the cons archive represented by the list or cons archive pair or nil"
