From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Bringing psgml back to life
Date: Mon, 27 Aug 2012 00:14:05 -0400 [thread overview]
Message-ID: <jwv7gslm10r.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: mailman.7613.1346003346.855.help-gnu-emacs@gnu.org
> 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
next parent reply other threads:[~2012-08-27 4:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.7613.1346003346.855.help-gnu-emacs@gnu.org>
2012-08-27 4:14 ` Stefan Monnier [this message]
2012-08-27 20:25 ` Bringing psgml back to life 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv7gslm10r.fsf-monnier+gnu.emacs.help@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.