From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument Date: Sat, 10 Jun 2017 11:50:06 -0400 Message-ID: <877f0jx2oh.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1497109761 28074 195.159.176.226 (10 Jun 2017 15:49:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Jun 2017 15:49:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 27178@debbugs.gnu.org To: Sean McAfee Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 10 17:49:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJidU-0006bE-NS for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Jun 2017 17:49:12 +0200 Original-Received: from localhost ([::1]:58842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJidV-0007HF-DU for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Jun 2017 11:49:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJidN-0007Fi-9W for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 11:49:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJidK-0001G6-8v for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 11:49:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36401) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dJidK-0001G2-3K for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 11:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dJidJ-0000e7-Pw for bug-gnu-emacs@gnu.org; Sat, 10 Jun 2017 11:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Jun 2017 15:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27178 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27178-submit@debbugs.gnu.org id=B27178.14971097152451 (code B ref 27178); Sat, 10 Jun 2017 15:49:01 +0000 Original-Received: (at 27178) by debbugs.gnu.org; 10 Jun 2017 15:48:35 +0000 Original-Received: from localhost ([127.0.0.1]:39078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJict-0000dO-7T for submit@debbugs.gnu.org; Sat, 10 Jun 2017 11:48:35 -0400 Original-Received: from mail-it0-f66.google.com ([209.85.214.66]:34845) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJicr-0000d5-5d; Sat, 10 Jun 2017 11:48:33 -0400 Original-Received: by mail-it0-f66.google.com with SMTP id 67so8326054itx.2; Sat, 10 Jun 2017 08:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=4RBC/htvVbjlChyHBWmpqQvayQmO11pHj0RSAc6ogEU=; b=ETSvBlGqS6HCR4UwiVtgoeukerOa/I1PtcLDRo6l/ujWn3nAP9/6FfG8bXjUgMScHR bo2ozSo8ERk3GJQrWgENfasrWgy8yT/tFVUtg+QkPoID5wnUDFWgmDaP1NBTLYpV/E8u nn/O0twDglsxzI1j1w2juiyKp3i6Hc01s6EVy7KHprOcqz2q8vjDbVtX+SmpHjEP0wsg 9pxSwV2tBTbtd0QYBcWyhIoYBU5ARgXbzdB/V4Aw6wtmaK5wrQjIDVsR5254pqCwdBes NkU1qVykOZzAESV8zj15/PBkRpbHF8lEtQoC1QudDbGduycDWnTuwU9HmNGHr4674Kwx AZ9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=4RBC/htvVbjlChyHBWmpqQvayQmO11pHj0RSAc6ogEU=; b=Y0NP1VDoYeC0j45/b7m/0OYs2srUeRg2o3ZYd7JdkaVo+aiQSA3NzWe4hBYWNfBKkc 98hYOSq3kWSOnz0md8sFzLxGO0NdvQNi5yXxdkCuQep3M5lywbuExY26JZzTURojlupi K3CkWKhLQ0CCXw+a0y073Gr3g/QT+U6eA+eiIwwBlgBDmwnI9QA94HFXktCXPxuiDyqZ MTLB3XIvH/pHJJ5vL/SP+wdvM3qfeXEMzCqaW6KwUvPNpkuCIHeIlpF3GkwwY8lsoI3v FP1Hcf08NNutixZPj5uZQUQxD0HNHDtO752CH0xGneRSL2VeL5jSeJJuQgHyhQURsKhp o+EQ== X-Gm-Message-State: AODbwcDLNst9V7XqxhKwG3wnDNj6sOjXIc3BxiMURhiruoSHFGcmmjXQ S2RdPRzEhxe6Qtpm X-Received: by 10.36.44.201 with SMTP id i192mr4812161iti.21.1497109707354; Sat, 10 Jun 2017 08:48:27 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id g188sm1989610iof.6.2017.06.10.08.48.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Jun 2017 08:48:26 -0700 (PDT) In-Reply-To: (Sean McAfee's message of "Wed, 31 May 2017 17:07:03 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133448 Archived-At: retitle 27178 libxml-parse-*-region functions discard-comments argument only applies to top level comments found 27178 25.2 tags 27178 confirmed quit Sean McAfee writes: > The libxml-parse-html-region and libxml-parse-xml-region functions both > appear to ignore their discard-comments parameters. > > When I enter the following text in a buffer and mark it: > >

This that

> > Then the result of evaluating the expression > > (libxml-parse-html-region (mark) (point) nil t) > > is > > (html nil (body nil (p nil "This " (comment nil " and ") " that"))) > > and the result of evaluating the expression > > (libxml-parse-xml-region (mark) (point) nil t) > > is > > (p nil "This " (comment nil " and ") " that") > > In both cases, I would expect that passing t as the fourth argument > would cause the comments to be dropped, but they are not. It doesn't quite ignore that argument, but it only applies to top level comments. I think it's the implementation level leaking through. See in xml.c: static Lisp_Object parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Object discard_comments, bool htmlp) { ... /* The document doesn't have toplevel comments or we discarded them. Get the tree the proper way. */ xmlNode *node = xmlDocGetRootElement (doc); Apparently the "proper" way already discards top level comments, so the DISCARD-COMMENTS parameter was added to be able to control this. Maybe we should just update the docs to match the code though, not sure. > Incidentally, I notice that the documentation for > libxml-parse-xml-region includes the following sentence: > > If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. > > I imagine this ought to refer to "XML comments" rather than "HTML > comments." Yeah, looks like copy-pasta from libxml-parse-html-region.