unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 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

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 --
     [not found] <mailman.7613.1346003346.855.help-gnu-emacs@gnu.org>
2012-08-27  4:14 ` Bringing psgml back to life Stefan Monnier
2012-08-27 20:25   ` Florian v. Savigny
2012-08-27 14:16 ` Laura Conrad
2012-08-26 13:25 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).