emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch: bugfix in lisp/xml.el


From: Edward O'Connor
Subject: patch: bugfix in lisp/xml.el
Date: Thu, 27 Oct 2005 19:23:45 -0700
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (darwin)

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
address@hidden

Ense petit placidam sub libertate quietem.

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]