GNU bug report logs - #11916
24.1.50; Making url-dav work

Previous Next

Package: emacs;

Reported by: David Engster <deng <at> randomsample.de>

Date: Wed, 11 Jul 2012 21:06:02 UTC

Severity: normal

Found in version 24.1.50

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 11916 <at> debbugs.gnu.org (full text, mbox):

From: David Engster <deng <at> randomsample.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 11916 <at> debbugs.gnu.org
Subject: Re: bug#11916: 24.1.50; Making url-dav work
Date: Wed, 18 Jul 2012 19:45:53 +0200
Stefan Monnier writes:
>> I started rewriting url-dav to work with the cons's returned by xml.el,
>> but it's tedious work and, more importantly, makes the code really
>> ugly.
>
> Could you show us some example of the ugliness to get a feeling for the
> tradeoffs?  I see you'd need to change url-dav-find-parser, but that
> doesn't sound so terrible, so the ugliness seems to come from parts that
> aren't as immediately apparent.

Just do an M-x occur on "'DAV:"; pretty much every test you see against
some symbol 'DAV:foo (about 30) has to be changed to test against
'("DAV" . "foo") instead. This also implies that every 'eq' has to be
changed to 'equal', 'assq' to 'assoc', 'plist-get' to 'lax-plist-get',
and so on. I started doing that and it just felt wrong; the code gets
larger, less readable and possibly slower without any real
benefit. However, I don't feel terribly strong about this, so if this
in-place XML change is considered too hack-ish, I can still finish that
rewrite.

>> Instead, I now just use a small function to replace the cons's in
>> xml.el's output with the plain symbols the package expects. Please find
>> the patch attached.
>
> Rather than provide a "changexml" function which traverses the XML tree
> and changes the cons to symbols, how 'bout changing xml-parse-region?
>
> I have the vague impression that the representation was changed from
> symbols to cons cells on the premise that it was more Lispy (would
> avoid (re)parsing the symbol names), but if it turns out to be a pain
> to use, maybe that was a bad call (basically, you're saying that you
> never need/want to parse those QNAMES).

I think namespace-aware parsing was added in 2004 or so, so changing it
now would surely break some code out there. Also, I could imagine that
under other circumstances you can profit from such a representation; but
url-dav simply wants to make sure that everything is in the 'DAV'
namespace.

> Another issue is: what does libxml-parse-xml-region do (it would be better
> to try and reduce the difference between the two)?

libxml simply does not do namespace-aware parsing; you just get the
plain symbols without any prefix.

-David




This bug report was last modified 12 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.