From c34b237da0bb4bf08a3531a2e11442623df7e9d4 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] src/utilities.lisp (defvar-unbound): Make a variable with docs and no value. --- doc/SYMBOLS | 1 + doc/misc.tex | 3 +++ src/utilities.lisp | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/doc/SYMBOLS b/doc/SYMBOLS index 43ed0f2..909f993 100644 --- a/doc/SYMBOLS +++ b/doc/SYMBOLS @@ -2217,6 +2217,7 @@ utilities.lisp default-slot macro define-access-wrapper macro define-on-demand-slot macro + defvar-unbound macro designated-condition function dosequence macro sb-mop:eql-specializer class diff --git a/doc/misc.tex b/doc/misc.tex index 2e7b504..f6037e1 100644 --- a/doc/misc.tex +++ b/doc/misc.tex @@ -172,6 +172,9 @@ These symbols are defined in the @|sod-utilities| package. {compose @ \&rest @ @> @} \end{describe} +\begin{describe}{mac}{defvar @ @ @> @} +\end{describe} + \begin{describe}{fun}{symbolicate \&rest @ @> @} \end{describe} diff --git a/src/utilities.lisp b/src/utilities.lisp index 72423fd..72af8b3 100644 --- a/src/utilities.lisp +++ b/src/utilities.lisp @@ -709,6 +709,17 @@ (reduce #'compose1 more-functions :initial-value function))) ;;;-------------------------------------------------------------------------- +;;; Variables. + +(export 'defvar-unbound) +(defmacro defvar-unbound (var doc) + "Make VAR a special variable with documentation DOC, but leave it unbound." + `(eval-when (:compile-toplevel :load-toplevel :execute) + (defvar ,var) + (setf (documentation ',var 'variable) ',doc) + ',var)) + +;;;-------------------------------------------------------------------------- ;;; Symbols. (export 'symbolicate) -- 2.11.0