;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;###autoload
-(cl-defun make-package (name &key nicknames use (size 10))
+(cl-defun make-package (name &key nicknames use (size 10)
+ (register nil))
"Create and return a new package with name NAME.
NAME must be a string designator, that is a string, a symbol, or
SIZE gives the size to use for the symbol table of the new
package. Default is 10.
+REGISTER if true means register the package in the package
+registry.
+
Please note that the newly created package is not automaticall
registered in the package registry, that is it will not be found
under its names by `find-package'. Use `register-package' to
(package (make-%package name size)))
(setf (package-%nicknames package) nicknames
(package-%use-list package) use)
+ (when register
+ (register-package package))
package))
(defun register-package (package)
(should-error (make-package "x" :nicknames))
(should-error (make-package "x" :use))
(should-error (make-package "x" :nicknames 1))
- (should-error (make-package "x" :use 1)))
+ (should-error (make-package "x" :use 1))
+ ;; Registering package
+ (let ((p (make-package "x" :nicknames '(y) :register t)))
+ (unwind-protect
+ (progn
+ (should (packagep p))
+ (should (eq (find-package "x") p))
+ (should (eq (find-package "y") p)))
+ (delete-package p))))
(ert-deftest pkg-tests-make-package-nicknames ()
;; Valid nicknames