summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-14 07:19:41 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-14 07:19:41 -0800
commit32385342eaa73711cbd2d3481ecd98969bb382ef (patch)
tree9d3daba823213b63976aed07bcaa6ca091d7f1e1 /share
parentfe43a541f9a5eaee27ff2ce2811cfd83eb6e3b1c (diff)
downloadtxr-32385342eaa73711cbd2d3481ecd98969bb382ef.tar.gz
txr-32385342eaa73711cbd2d3481ecd98969bb382ef.tar.bz2
txr-32385342eaa73711cbd2d3481ecd98969bb382ef.zip
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.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/package.tl7
1 files changed, 7 insertions, 0 deletions
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))))