+(defmacro export-from-file (file &optional package)
+ (if package
+ `(export ',(list-autoexported-symbols-in-file file) ,package)
+ `(export ',(list-autoexported-symbols-in-file file))))
+
+(defmacro export-from-files (files &optional package)
+ `(progn
+ ,@(loop for file in files collect `(export-from-file ,file ,package))))
+
+(defmacro export-from-system (&optional package)
+ (let ((depends-on (cdar (asdf:component-depends-on asdf:*operation* asdf:*component*))))
+ `(progn
+ ,@(loop
+ for component in depends-on
+ as pathname = (asdf:component-pathname
+ (asdf:find-component asdf:*system* component))
+ collect `(export-from-file ,pathname ,package)))))
+
+(defun copy-hash-table (hash-table)
+ (let ((new-hash-table (make-hash-table
+ :test (hash-table-test hash-table)
+ :size (hash-table-size hash-table))))
+ (maphash
+ #'(lambda (key value)
+ (setf (gethash key new-hash-table) value))
+ hash-table)
+ new-hash-table))
+
+(defmacro with-export-handlers (&body body)
+ `(let ((*export-handlers* (copy-hash-table *export-handlers*)))
+ ,@body))
+