Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalimehtar committed Jan 27, 2013
1 parent 6ac3c07 commit 7e28bec
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,22 @@ For example, this will be error:

Be careful: this change is not local to your package.

_set-macro-symbol_ - syntax is like set-macro-character,
------------------
_set-macro-symbol_ symbol func -- sets FUNC to process the SYMBOL.
--------------------------
FUNC will get stream of reader and the symbol (see set-macro-character).

To prevent symbol from processing (for example in set-macro-symbol construction) you should enclose it in bars.

This construction will set 'foo as an alias to 'long-package-name:long-name:

But FUNC is binded to SYMBOL, not character. This symbol will be processed
in all cases, where it is not bounded by ||.
(set-macro-symbol '|FOO|
(lambda (stream symbol)
(declare (ignore stream symbol))
'long-package-name:long-name))

Another way to prevent symbol processing is setting `advanced-readtable:*enable-symbol-readmacro*` to nil.
Remember, that symbol processing is done during reading the file, so, if you need to temporarily disable
`*enable-symbol-readmacro*`, then enclose it in #.

Now you may make something like

Expand All @@ -126,17 +137,13 @@ Now you may make something like
html:[ and sql:[ will have different handlers and you may mix them in
one expression.

Also it allows to make simple symbol-aliases. For example:

(set-macro-symbol '|ALIAS| (lambda (stream symbol)
(declare (ignore stream symbol))
'advanced-readtables:push-local-package))
Now you may do

(alias 'iter:iter :iterate)

Moreover, you may alias variables from other packages and set them through
alias. But be careful: this change is not local to your package.
alias. But be careful: this change is not local to your package. If you write qualified name
of the symbol, you should enclose package-name int bars:
(set-macro-symbol '|OTHER-PACKAGE|:foo
(lambda (stream symbol)
(declare (ignore stream symbol))
'long-package-name:long-name))


_get-macro-symbol_ - syntax is like get-macro-character,
Expand Down

0 comments on commit 7e28bec

Please sign in to comment.