all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Daniel Colascione <danc@merrillpress.com>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] xml-escape-region
Date: Fri, 09 Oct 2009 15:11:16 -0400	[thread overview]
Message-ID: <jwvfx9sgzgg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <76BA010B-EFE0-48CA-BD43-B3CB63CDDAFF@merrillpress.com> (Daniel Colascione's message of "Thu, 8 Oct 2009 02:01:05 -0400")

> Pretty often, actually. XML (or XML-like syntax) crops up in a lot of
> places, including
> literal strings in many programming languages. Some basic XML-editing
> functionality being available everywhere would be useful.

OK, then.

>>> (let ((search-re (mapconcat #'regexp-quote
>>> (mapcar #'cdr xml-entity-alist)
>>> "\\|"))
>> Rather than a big \| of single chars, why not make a [...] regexp?
>> If you use regexp-opt, it should happen automatically.
> I figured the constant-factor overhead of regexp-opt (and its autoloading)
> wasn't worth it for such a simple regexp.

Not sure if it makes a difference, indeed.

>> Actually, now that I look at it, xml-entity-alist is poorly defined.
>> Instead of being a list of pairs of string and string (where the second
>> string is always of size 1), it should be a list of pairs of string
>> and char.
> I think the idea was to be able to replace multi-character strings with XML
> entities defined for the current document.

All the examples I saw were single-char strings.  If indeed multi-char
strings can be used there, then the current definition is fine, indeed,
but then xml-escape-string is not.

> Does anyone actually use the unquotep parameter? It seems like quoting and
> unquoting should be separate functions.

Separate functions yes, but I think it makes sense to provide both under
the same key-binding, hence a single command.  This said, I never use
either, so I don't have a strong opinion.

> Nevertheless, the patch below should preserve existing behavior. I've
> also renamed the XML functions to better match existing code,
> e.g., base64.

Looks good,


        Stefan




      parent reply	other threads:[~2009-10-09 19:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07 18:56 [PATCH] xml-escape-region Daniel Colascione
2009-10-07 22:10 ` Stefan Monnier
2009-10-08  2:13   ` Daniel Colascione
2009-10-08  5:29     ` Stefan Monnier
2009-10-08  6:01       ` Daniel Colascione
2009-10-08  6:03         ` Daniel Colascione
2009-10-09 19:11         ` Stefan Monnier [this message]

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=jwvfx9sgzgg.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=danc@merrillpress.com \
    --cc=emacs-devel@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.