Re: Lisp indenting tool
- From: Xah Lee <xah@xxxxxxxxxx>
- Date: Mon, 28 Jan 2008 10:41:21 -0800 (PST)
Rainer Joswig wrote:
But Common Lisp has that. The function is called PPRINT.
It is based on a huge machinery defined in ANSI Common Lisp.
Jeremy Smith wrote:
This looks like a good indenting solution. The only problem is that it
doesn't seem to keep comments, which is a problem on a big source file.
Maybe there would be some way to keep comments after pretty-printing the
source, by re-inserting them afterwards.
Good point.
From my experience with Mathematica, this is not possible when the
solution is based on the compiler taking source code as input (since
it discards comments).
Maybe CL has a way to tell the compiler to keep the comments...
If some lisper writes a simple parser in elisp, that'd be great.
This'll solve problems in Common/Scheme/Emacs lisps. I just want this
to work in emacs lisp.
------------------------------
(Mathematica has this build-in, so that when you press a keyboard
shortcut, it reformats your code in any one of the predefined ways,
namely InputForm (plain source text), StandardForm (displaying it as
typeset 2D math), TraditionalForm (like StandardForm, but follows
traditional math notation much like LaTeX's default) (you can write
code to process whole source code exactly like lisp because of the
“source = data” property, and this is done practically often. One
example is a transparent built-in converter for opening older
Mathematica notebooks (i.e. the source code file) in a newer
Mathematica version. (it reads the source code, add extra info or
structure for the newer Mathematica version if necessary (such as
adding a version declaration), then display it in the “word-processor
like” integrated editor)))
------------------------------
Btw, i've always thougth that lisp's notation are not as regular as
Mathematica. For example, there's the “'(1 2 3)”. But that is
syntactically the same as “(quote (1 2 3))”, so it doesn't count as a
exception. But i think there are few others involving other chars like
“#”, “,”, but i'm not sure which of these are just syntax sugars and
which are genuine exception to the nested paren syntax.
My question is, could anyone list all these, and show exactly which
are just syntax equivalent on top of sexp and which are true
exceptions?
Xah
xah@xxxxxxxxxx
∑ http://xahlee.org/
☄
.
- Follow-Ups:
- Re: Lisp indenting tool
- From: Rainer Joswig
- Re: Lisp indenting tool
- References:
- Lisp indenting tool
- From: Jeremy Smith
- Re: Lisp indenting tool
- From: Xah Lee
- Re: Lisp indenting tool
- From: Jeremy Smith
- Re: Lisp indenting tool
- From: Patrick May
- Re: Lisp indenting tool
- From: Xah Lee
- Re: Lisp indenting tool
- From: Patrick May
- Re: Lisp indenting tool
- From: Xah Lee
- Re: Lisp indenting tool
- From: Rainer Joswig
- Re: Lisp indenting tool
- From: Jeremy Smith
- Lisp indenting tool
- Prev by Date: Re: Current semantic web work?
- Next by Date: Re: dynamic bindings and macros
- Previous by thread: Re: Lisp indenting tool
- Next by thread: Re: Lisp indenting tool
- Index(es):
Relevant Pages
|
Loading