unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* patch: bugfix in lisp/xml.el
@ 2005-10-28  2:23 Edward O'Connor
  2005-10-28 21:43 ` Mark A. Hershberger
  0 siblings, 1 reply; 4+ messages in thread
From: Edward O'Connor @ 2005-10-28  2:23 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

Hi,

Attached is a trivial (one-line) patch to lisp/xml.el, which fixes a bug
in its handling of text nodes broken by a comment.

Here's a demonstration of the bug:

(require 'xml)

(defun ted-parse-xml-from-string (string)
  (with-temp-buffer
    (insert string)
    (xml-parse-region (point-min) (point-max))))

(ted-parse-xml-from-string "<n>yo  yo</n>")
;; returns ((n nil "yo  yo"))

(ted-parse-xml-from-string "<n>yo <!-- comment --> yo</n>")
;; returns ((n nil 111 121 32 32 111 121))
;; expected ((n nil "yo  yo"))

The bug is in a call to `append'. After applying this patch, we get the
value we expect:

(ted-parse-xml-from-string "<n>yo <!-- comment --> yo</n>")
;; returns ((n nil "yo  yo"))


Ted

-- 
Edward O'Connor
hober0@gmail.com

Ense petit placidam sub libertate quietem.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bugfix in xml.el --]
[-- Type: text/x-patch, Size: 692 bytes --]

Index: xml.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/xml.el,v
retrieving revision 1.49
diff -u -r1.49 xml.el
--- xml.el	9 Aug 2005 02:52:15 -0000	1.49
+++ xml.el	28 Oct 2005 02:18:23 -0000
@@ -473,7 +473,7 @@
 			      (if (stringp expansion)
 				  (if (stringp (car children))
 				      ;; The two strings were separated by a comment.
-				      (setq children (append (concat (car children) expansion)
+				      (setq children (append (list (concat (car children) expansion))
 							     (cdr children)))
 				    (setq children (append (list expansion) children)))
 				(setq children (append expansion children))))))))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-03  3:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-28  2:23 patch: bugfix in lisp/xml.el Edward O'Connor
2005-10-28 21:43 ` Mark A. Hershberger
2005-11-02 18:20   ` Edward O'Connor
2005-11-03  3:57     ` Mark A. Hershberger

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).