How to export all definition symbols in a file in Common Lisp?

Viewed 653

My lisp file contains about 50 function and macro definitions. At the head of the file is:

(defpackage :utils
  (:use :common-lisp))

(in-package :utils)

; ...  ~50 defuns/defmacros follow along with some other code

I want to export all these 50 definitions. But no other symbols. To write them all out in :export clauses inside defpackage seems very tedious.

I tried getting the necessary symbols by using loop's facility for listing symbols in a package. But both "symbol" and "present-symbol" don't output the needed definition symbols. I could somehow subtract "external-symbols" and inherited symbols. But this seems like the kind of thing everyone would need and there should be an established easy solution. I looked around and haven't found a straightforward answer.

How do I export all the definition symbols without having to write them out individually and manually?

2 Answers
Related