Closed larsbrinkhoff closed 8 years ago
That looks like an implementation of the CL reader in CL, not in Elisp. :-) Definitely nice to be able to write Emacs extensions in CL, but it's different than what I had in mind (which is merely the ability to enhance the Elisp reader from itself, instead of providing a different language).
I'm not sure how one project could benefit from the other.
It really is Emacs Lisp. Why do you think otherwise?
It's part of a CL implementation written in Emacs Lisp, so it uses code from other files. Maybe that makes it look strange.
Yeah, I just noticed the IN-PACKAGE
and other CL stuff so I speculated it isn't just Elisp in there.
I cloned the project and try to load load-cl
, but I'm getting an error (void-variable EVERY)
in cl-flow.el. (vanilla Emacs 24.5.1 here, Linux)
In any case, I was wondering how (if?) do you replace the Elisp reader, that is, say I get it loaded, can I then just load a file containing CL syntax with plain M-x load-library
?
Sorry, it's not intensely maintained. I see the same error and will investigate.
It does not replace the Emacs Lisp reader. Rather, it adds a parallel Common Lisp environment alongside Emacs Lisp. So no, you would read and load CL syntax with separate functions.
I guess your reader accepts an extension of the Emacs Lisp syntax, e.i. it's backwards compatible? My reader by default doesn't cater to Emacs Lisp. But of course any CL reader can be extended to accept Emacs Lisp syntax.
It does not replace the Emacs Lisp reader. Rather, it adds a parallel Common Lisp environment alongside Emacs Lisp. So no, you would read and load CL syntax with separate functions.
That makes sense actually, the languages are quite different and you don't want to ruin Emacs' ability to load Elisp code.
Yes, my reader just reads Elisp (and defers to the original C reader for some things it can't handle, like loading bytecode). And since it reads Elisp, it can (and does) replace the original read
function by fset
-ing it.
The thing it adds is that, being written in Elisp rather than C, it's extensible; so it adds a syntax for regexps, i.e. #/(foo|bar)/
produces "\\(foo\\|bar\\)"
, and a def-reader-syntax
function which allows external code to define custom reader chars (sample usage).
I have a complete Emacs Lisp implementation of the Common Lisp reader here: https://github.com/larsbrinkhoff/emacs-cl/blob/master/cl-reader.el