From 32385342eaa73711cbd2d3481ecd98969bb382ef Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 14 Nov 2016 07:19:41 -0800 Subject: New in-package macro. * lisplib.c (package_set_entries): Add in-package symbol name to autload list. * share/txr/stdlib/package.tl (in-package): New macro. * txr.1: Documented. --- share/txr/stdlib/package.tl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'share') diff --git a/share/txr/stdlib/package.tl b/share/txr/stdlib/package.tl index 1827628f..7e62b6e5 100644 --- a/share/txr/stdlib/package.tl +++ b/share/txr/stdlib/package.tl @@ -81,3 +81,10 @@ ,*(unless (assoc :use clauses) ^((use-package "usr" ,pkg))) ,*exp-clauses ,pkg))) + +(defmacro in-package (pkg) + (unless (or (symbolp pkg) (stringp pkg)) + (throwf 'eval-error "~s: ~s isn't a package name" 'in-package pkg)) + ^(set *package* (or (find-package ',pkg) + (throwf 'eval-error "~s: no such package: ~s" + 'in-package ',pkg)))) -- cgit v1.2.3