From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: xml-parse-file and text properties Date: Tue, 25 Jul 2006 09:05:59 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1153843799 29910 80.91.229.2 (25 Jul 2006 16:09:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 25 Jul 2006 16:09:59 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 25 18:09:57 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G5PTS-0000S6-95 for ged-emacs-devel@m.gmane.org; Tue, 25 Jul 2006 18:09:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G5PTR-0004ix-Oq for ged-emacs-devel@m.gmane.org; Tue, 25 Jul 2006 12:09:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G5PRH-0003fL-IX for emacs-devel@gnu.org; Tue, 25 Jul 2006 12:07:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G5PRG-0003dx-KP for emacs-devel@gnu.org; Tue, 25 Jul 2006 12:07:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G5PRG-0003dk-AX for emacs-devel@gnu.org; Tue, 25 Jul 2006 12:07:18 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G5PSb-0003V8-Dn for emacs-devel@gnu.org; Tue, 25 Jul 2006 12:08:41 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1G5PQl-0008E0-Md for emacs-devel@gnu.org; Tue, 25 Jul 2006 18:06:47 +0200 Original-Received: from turtle.as.arizona.edu ([128.196.208.207]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Jul 2006 18:06:47 +0200 Original-Received: from jdsmith by turtle.as.arizona.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 25 Jul 2006 18:06:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 61 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: turtle.as.arizona.edu User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table) 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:57616 Archived-At: Just for completeness: Richard checked in the changes below, and they have the effect of avoiding the unwanted text properties for parsed files not already loaded in a buffer. > *** xml.el 06 Feb 2006 07:33:36 -0700 1.53 > --- xml.el 24 Jul 2006 09:40:07 -0700 > *************** > *** 161,187 **** > ;;;###autoload > (defun xml-parse-file (file &optional parse-dtd parse-ns) > "Parse the well-formed XML file FILE. > ! If FILE is already visited, use its buffer and don't kill it. > ! Returns the top node with all its children. > ! If PARSE-DTD is non-nil, the DTD is parsed rather than skipped. > ! If PARSE-NS is non-nil, then QNAMES are expanded." > ! (let ((keep)) > ! (if (get-file-buffer file) > ! (progn > ! (set-buffer (get-file-buffer file)) > ! (setq keep (point))) > ! (let (auto-mode-alist) ; no need for xml-mode > ! (find-file file))) > ! > ! (let ((xml (xml-parse-region (point-min) > ! (point-max) > ! (current-buffer) > ! parse-dtd parse-ns))) > ! (if keep > ! (goto-char keep) > ! (kill-buffer (current-buffer))) > ! xml))) > ! > > (defvar xml-name-re) > (defvar xml-entity-value-re) > --- 161,182 ---- > ;;;###autoload > (defun xml-parse-file (file &optional parse-dtd parse-ns) > "Parse the well-formed XML file FILE. > ! If FILE is already visited, use its buffer and don't kill it. Returns the > ! top node with all its children. If PARSE-DTD is non-nil, the DTD is parsed > ! rather than skipped. If PARSE-NS is non-nil, then QNAMES are expanded." > ! (if (get-file-buffer file) > ! (with-current-buffer (get-file-buffer file) > ! (save-excursion > ! (xml-parse-region (point-min) > ! (point-max) > ! (current-buffer) > ! parse-dtd parse-ns))) > ! (with-temp-buffer > ! (insert-file-contents file) > ! (xml-parse-region (point-min) > ! (point-max) > ! (current-buffer) > ! parse-dtd parse-ns)))) > > (defvar xml-name-re) > (defvar xml-entity-value-re)