(define-namespace NAME [KEYWORD …] BODY)
Inside the namespace NAME, execute BODY. NAME can be any symbol (not quoted), but it’s highly recommended to use some form of separator (such as :, /, or -). For a complete description of this macro, please visit the frontpage with M-x names-view-manual.
In summary, this macro has two main effects:
-
Any definitions inside BODY will have NAME prepended to the symbol given. Ex:
(define-namespace foo- (defvar bar 1 “docs”) )
expands to
(defvar foo-bar 1 "docs")
-
Any function calls and variable names get NAME prepended to them if such a variable or function exists. Ex:
(define-namespace foo: (defun message (x y) nil) (message “%s” my-var) )
expands to
(defun foo:message (x y) nil)
(foo:message "%s" my-var)
Note how ‘message’ is expanded to ‘foo:message’ in the second form, because that function exists. Meanwhile, ‘bar’ is left untouched because ‘foo:bar’ is not a known variable name.
===============================
AUTOLOAD
In order for ‘define-namespace’ to work with “;;;###autoload” comments must replace all instances of “;;;###autoload” inside your ‘define-namespace’ with ‘:autoload’. Afterwards, add an “;;;###autoload” comment just above your ‘define-namespace’.
===============================
KEYWORDS
Immediately after NAME you may add keywords which customize the behaviour of ‘define-namespace’. For a list of possible keywords and a description of their effects, see the variable ‘names–keyword-list’.