[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bringing psgml back to life
From: |
Florian v. Savigny |
Subject: |
Bringing psgml back to life |
Date: |
Sun, 26 Aug 2012 09:25:23 -0400 |
Dear elisp experts,
Psgml has not been working anymore since Emacs version 23 or 24 (I
think I skipped 23). There seem to be several issues, although I am
not sure which ones are fatal and which are (for the time being)
merely deprecated.
I have several reasons for wanting to bring psgml back to life, and I
am entirely prepared to do this myself (and subsequently submit it to
the public), but even though I have programmed in Elisp for about 10
years, psgml has been programmed by somebody way above my
competence. Thus, I would be very grateful if I could get some advice
on the following points (I am referring to psgml version 1.3.2) (I
realise I might actually be asking the same question over and over,
but please be sympathetic towards my uncertainty) :
1. The following seems to trigger a fatal error (from psgml-parse.el, line 903)
(defmacro sgml-prop-fields (&rest names)
(cons
'progn
(loop for n in names collect
(`(defmacro (, (intern (format "sgml-eltype-%s" n))) (et)
(list 'get et ''(, n)))))))
namely:
File mode specification error: (invalid-function (\` (defmacro ((\, (intern
(format "sgml-eltype-%s" n)))) (et) (list (quote get) et (quote (quote ((\,
n))))))))
2. The old-style backquotes which psgml uses do not seem to be fatal
on compiling, but at runtime. E.g.,
`(1 2 3 ,(+ 2 2))
works fine, but
(`(1 2 3 (,(+ 2 2))))
throws an error and complains that (` ...) is an invalid function.
Is it correct to assume that the fix is to simply remove the
surrounding quotes? E.g.,
(` (char-int (, ch))) --> `(char-int ,ch)
And, likewise, (,@ ... ) --> ,@ ... ?
(In other words, is this the straightforward fix for the error in 1?)
3. Even if what I said under 2. is correct, Lennart has used this
construct a lot inside special forms and macros, the syntax of which
is somewhat scary to me. For example:
(defmacro sgml-move-token (x)
(` (car (, x))))
I'm never really sure if defmacro (which I have never used) would
normally require me to put parentheses around its body anyway, or if
the fix for this piece of code could legally look like:
(defmacro sgml-move-token (x)
`(car , x))
Another example is of course the (loop ...) construct shown in 1 (see
above). Does loop want parentheses where the backquote is preceded by
one?
In other words, are these old-style-backquotes, which would allow
simply removing the surrounding parentheses, or are they really
new-style backquotes, and the parentheses are really required by
defmacro and/or loop?
4. And what, for heaven's sake, is this stuff in the last line of the
(defmacro ) form in 1.?
''(, n) ?
A quick check shows that it would apparently be legal syntax to remove
the parentheses:
`(1 2 3 '',(+ 2 2))
--> (1 2 3 (quote (quote 4)))
So, simply no worries, and go ahead?
Thanks a bunch for any enlightenment!
Best regards,
Florian
- Bringing psgml back to life,
Florian v. Savigny <=