* Bringing psgml back to life
@ 2012-08-26 13:25 Florian v. Savigny
2012-08-27 19:54 ` PJ Weisberg
0 siblings, 1 reply; 7+ messages in thread
From: Florian v. Savigny @ 2012-08-26 13:25 UTC (permalink / raw
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bringing psgml back to life
[not found] <mailman.7613.1346003346.855.help-gnu-emacs@gnu.org>
@ 2012-08-27 4:14 ` Stefan Monnier
2012-08-27 20:25 ` Florian v. Savigny
2012-08-27 14:16 ` Laura Conrad
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2012-08-27 4:14 UTC (permalink / raw
To: help-gnu-emacs
> I have several reasons for wanting to bring psgml back to life, and I
I'd be interested to hear them.
> 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))))))))
You need a space after "(`". That's the old backquote syntax (which
originally didn't require the space, but now does, as a first step
towards fully removing support for it).
> 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.
Again, you need a space after the old-style "(`" and "(,".
> Is it correct to assume that the fix is to simply remove the
> surrounding quotes? E.g.,
> (` (char-int (, ch))) --> `(char-int ,ch)
Yes, that's the conversion to new-style and is what you should do.
> And, likewise, (,@ ... ) --> ,@ ... ?
Yup.
> (In other words, is this the straightforward fix for the error in 1?)
Yes, that should fix it as well.
> (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,
No, the body of a defmacro is a normal expression.
> or if the fix for this piece of code could legally look like:
> (defmacro sgml-move-token (x)
> `(car , x))
Yes, this is the better new-style form (tho I wouldn't put a space
between the "," and the "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?
No, the extra parens are for the old-style backquote and have nothing to
do with `loop'.
> 4. And what, for heaven's sake, is this stuff in the last line of the
> (defmacro ) form in 1.?
> ''(, n) ?
That's the old-style form of "'',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?
I think so, yes.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bringing psgml back to life
[not found] <mailman.7613.1346003346.855.help-gnu-emacs@gnu.org>
2012-08-27 4:14 ` Stefan Monnier
@ 2012-08-27 14:16 ` Laura Conrad
1 sibling, 0 replies; 7+ messages in thread
From: Laura Conrad @ 2012-08-27 14:16 UTC (permalink / raw
To: help-gnu-emacs
>>>>> "Florian" == Florian v Savigny <florian@fsavigny.de> writes:
Florian> I have several reasons for wanting to bring psgml back to
Florian> life, and I am entirely prepared to do this myself (and
Florian> subsequently submit it to the public), but even though I
Florian> have programmed in Elisp for about 10 years, psgml has been
Florian> programmed by somebody way above my competence.
Hurrah! I want psgml to work on emacs 24 as well.
I probably know even less about lisp programming than you do, but I'll
be happy to help with testing.
--
Laura (mailto:lconrad@laymusic.org, twitter: @serpentplayer)
(617) 661-8097 233 Broadway, Cambridge, MA 02139
http://www.laymusic.org/ http://www.serpentpublications.org
No, it's my subject.
Gore Vidal, when asked whether he had ever considered leaving the
United States permanently.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bringing psgml back to life
2012-08-26 13:25 Bringing psgml back to life Florian v. Savigny
@ 2012-08-27 19:54 ` PJ Weisberg
2012-08-28 9:50 ` Andreas Röhler
0 siblings, 1 reply; 7+ messages in thread
From: PJ Weisberg @ 2012-08-27 19:54 UTC (permalink / raw
To: Florian v. Savigny; +Cc: help-gnu-emacs
On Sun, Aug 26, 2012 at 6:25 AM, Florian v. Savigny <florian@fsavigny.de> wrote:
> 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
I haven't seen the code for psgml-mode and I don't know who wrote it,
but I'm reminded of a motto one of my professors had posted on his
door:
Any damn programmer can write code a compiler can understand. It
takes a good programmer to write code that any damn programmer can
understand.
-PJ
Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bringing psgml back to life
2012-08-27 4:14 ` Stefan Monnier
@ 2012-08-27 20:25 ` Florian v. Savigny
0 siblings, 0 replies; 7+ messages in thread
From: Florian v. Savigny @ 2012-08-27 20:25 UTC (permalink / raw
To: Stefan Monnier; +Cc: help-gnu-emacs
Stefan,
thank you very much for your help!
> I'd be interested to hear them.
> [reasons for wanting to continue to use psgml]
- I still use SGML files
- I have programmed other stuff on top of psgml (modes for specific
SGML formats), which uses psgml functions or variables
- It's DTD-aware, and I don't know how to deal with schemas (of which
nxml-mode seems to be aware). DTDs aren't (yet) powerless enough to
make me want to switch to schemas.
- Even beyond DTD-awareness, I find it more convenient than nxml,
e.g. C-c C-d. Or I have been too dumb to grasp the convenience of
nxml-mode.
I do use nxml-mode now and then (to edit html files), and find it has
other nice features, and, it seems to me, a very stringent
philosophy. But it's certainly not built for SGML and DTDs.
But as to my principal question(s): Thanks very much for your help! I
certainly could not have figured out for myself was that there is a
difference between ('foo and (' foo.
I have learnt something new I didn't know about elisp (this whole
backquoting business), and I think I have been able to fix the
package. I have weeded out all old-style backquoting: it turned out
there were fatal old-style backquotes -- as in "('foo" --, non-fatal
old-style backquotes -- as in "(' foo" -- and new-style
backquotes. Now, only the latter are left. Psgml now seems to be
working again. I'll try to submit the edited package to the
maintainers (I just hope somebody will answer).
Thanks very much again, and best regards,
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bringing psgml back to life
2012-08-27 19:54 ` PJ Weisberg
@ 2012-08-28 9:50 ` Andreas Röhler
2012-08-28 17:46 ` Florian v. Savigny
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2012-08-28 9:50 UTC (permalink / raw
To: help-gnu-emacs
On 27.08.2012 21:54, PJ Weisberg wrote:
> On Sun, Aug 26, 2012 at 6:25 AM, Florian v. Savigny <florian@fsavigny.de> wrote:
>
>> 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
>
> I haven't seen the code for psgml-mode and I don't know who wrote it,
> but I'm reminded of a motto one of my professors had posted on his
> door:
>
> Any damn programmer can write code a compiler can understand. It
> takes a good programmer to write code that any damn programmer can
> understand.
>
you may safely assume the later.
IMO psgml-package counts as one of the most useful and most skilled so far.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Bringing psgml back to life
2012-08-28 9:50 ` Andreas Röhler
@ 2012-08-28 17:46 ` Florian v. Savigny
0 siblings, 0 replies; 7+ messages in thread
From: Florian v. Savigny @ 2012-08-28 17:46 UTC (permalink / raw
To: help-gnu-emacs
Various contributors wrote:
> > Any damn programmer can write code a compiler can
> > understand. It takes a good programmer to write code that any
> > damn programmer can understand.
> you may safely assume the lat[t]er.
> IMO psgml-package counts as one of the most useful and most skilled so far.
Although I'm perhaps not really in a position to jugde, I agree that
psgml is an outstanding piece of code. It can (independently of
nsgmls) parse DTDs and SGML files, and correctly so, i.e. it
understands the logical structure of the document you are
editing. That alone, as far as I understand, is no small
achievement. (As far as I know, one of the reasons why XML was
invented was that it is such a headache to write an SGML parser.) I
certainly think that any damn programmer couldn't have written that.
It is against this backdrop that I assume that Lennart simply didn't
have the time to comment the code in a way that would have made it
easy to maintain even for tinkerers like me. Even so, he did write an
info file about the API, i.e. the kind of low-level functions that I
used to write my add-ons. (Sad I somehow didn't know that when I wrote
them, but found out about them by rummaging through the sources.)
> I don't know what is the copyright status w.r.t other
> contributors, but it would be worth checking it, to see if we can
> put psgml in GNU ELPA.
I've just gone through the change log. Although it looks like Lennart
wrote about 99.9% of the code, he also lists five other people as
having contributed to it:
Dave Love <fx@gnu.org>, <d.love@dl.ac.uk>
Yasushi Abe
Marc-Antoine Parent
David Megginson
Matthias Clasen <mclasen@sun2.mathematik.uni-freiburg.de>, <clasen@pong.mathematik.uni-freiburg.de>
[the email addresses have probably been defunct for years, but
who knows]
and the following two as having made suggestions which prompted him to
change something:
Dirk Frömbgen
Mark Eichin
Is there any standard way to check the copyright status with respect
to people which might be difficult to contact? (I have no idea whether
the latter two are relevant in any way.)
Best regards,
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-08-28 17:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-26 13:25 Bringing psgml back to life Florian v. Savigny
2012-08-27 19:54 ` PJ Weisberg
2012-08-28 9:50 ` Andreas Röhler
2012-08-28 17:46 ` Florian v. Savigny
[not found] <mailman.7613.1346003346.855.help-gnu-emacs@gnu.org>
2012-08-27 4:14 ` Stefan Monnier
2012-08-27 20:25 ` Florian v. Savigny
2012-08-27 14:16 ` Laura Conrad
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.