From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] xml-escape-region Date: Fri, 09 Oct 2009 15:11:16 -0400 Message-ID: References: <200910071456.31966.danc@merrillprint.com> <18A0FD1E-DAFE-4058-B6FC-630750EBBCEA@merrillpress.com> <76BA010B-EFE0-48CA-BD43-B3CB63CDDAFF@merrillpress.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1255115523 28336 80.91.229.12 (9 Oct 2009 19:12:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Oct 2009 19:12:03 +0000 (UTC) Cc: Emacs-Devel devel To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 09 21:11:31 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MwKsC-0007OI-9e for ged-emacs-devel@m.gmane.org; Fri, 09 Oct 2009 21:11:28 +0200 Original-Received: from localhost ([127.0.0.1]:47219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MwKsB-0001Fp-Q0 for ged-emacs-devel@m.gmane.org; Fri, 09 Oct 2009 15:11:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MwKs6-0001Ct-ER for emacs-devel@gnu.org; Fri, 09 Oct 2009 15:11:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MwKs2-00013s-PG for emacs-devel@gnu.org; Fri, 09 Oct 2009 15:11:22 -0400 Original-Received: from [199.232.76.173] (port=50859 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MwKs2-00013g-Lr for emacs-devel@gnu.org; Fri, 09 Oct 2009 15:11:18 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:57852) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MwKs2-00061z-9e for emacs-devel@gnu.org; Fri, 09 Oct 2009 15:11:18 -0400 Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id n99JBGE9015712; Fri, 9 Oct 2009 15:11:16 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 188AD3A1AC; Fri, 9 Oct 2009 15:11:16 -0400 (EDT) In-Reply-To: <76BA010B-EFE0-48CA-BD43-B3CB63CDDAFF@merrillpress.com> (Daniel Colascione's message of "Thu, 8 Oct 2009 02:01:05 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3381=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116023 Archived-At: > 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