Subject: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument

From: Sean McAfee <[email-masked]>
Date: Wed, 31 May 2017 17:07:03 -0700

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:

  <p>This <!-- and --> that</p>

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.

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

In GNU Emacs 26.0.50 (build 1, x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1911))
 of 2017-05-15 built on builder10-9.local
Windowing system distributor 'Apple', version 10.3.1504
Recent messages:
(html nil (body nil (p nil "this " (comment nil " and ") " that"))) [2
times]
Auto-saving...
funcall-interactively: Beginning of buffer
(html nil (body nil (p nil "this " (comment nil " and ") " that"))) [2
times]
Quit [4 times]
Mark activated
(p nil "this " (comment nil " and ") " that")
uncompressing dom.el.gz...done
Note: standard-indent adjusted to 2
Quit [3 times]

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  recentf-mode: t
  global-anzu-mode: t
  anzu-mode: t
  volatile-highlights-mode: t
  dtrt-indent-mode: t
  projectile-mode: t
  elisp-slime-nav-mode: t
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  google-this-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  minibuffer-depth-indicate-mode: t
  ido-everywhere: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  paredit-mode: t
  override-global-mode: t
  show-paren-mode: t
  electric-pair-mode: t
  savehist-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  prettify-symbols-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail apropos ruby-end autoload
lisp-mnt skeleton perl6-mode perl6-indent perl6-font-lock cus-edit
cus-start cus-load warnings pcmpl-gnu mc-edit-lines edbi sql view epc
ctable concurrent deferred cperl-mode-expansions cperl-mode tabify
iso-transl bookmark woman man tmm pcmpl-unix vc-annotate vc
vc-dispatcher pulse mm-archive rvm pp cl-print ag vc-svn find-dired
wdired misearch multi-isearch dired-aux debug eieio-opt speedbar
sb-image ezimage dframe define-word help-fns radix-tree network-stream
starttls url-cache recentf tree-widget markdown-mode rng-xsd xsd-regexp
rng-cmpct nxml-mode-expansions rng-nxml rng-valid rng-loc rng-uri
rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-enc xmltok sh-script
executable conf-mode js-mode-expansions js tagedit s
html-mode-expansions sgml-mode dom imenu cc-mode-expansions cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs org-element org-rmail org-mhe org-irc org-info org-gnus
org-docview doc-view image-mode org-bibtex bibtex org-bbdb org-w3m
the-org-mode-expansions org org-macro org-footnote org-pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs gnus-dired restclient perl6-detect anzu vc-git
robe url-http tls gnutls url-auth url-gw nsm inf-ruby
ruby-mode-expansions ruby-mode smie yasnippet term disp-table ehelp
volatile-highlights iedit iedit-lib multiple-cursors-core rect
dtrt-indent projectile grep ibuf-ext ibuffer ibuffer-loaddefs
elisp-slime-nav etags xref project magit-obsolete magit-blame
magit-stash magit-bisect magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-branch magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
magit-diff smerge-mode diff-mode magit-core magit-autorevert autorevert
filenotify magit-process magit-margin magit-mode magit-git magit-section
magit-popup git-commit magit-utils crm log-edit message puny rfc822 mml
mml-sec epa epg mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader pcvs-util add-log with-editor
async-bytecomp async tramp-sh tramp tramp-compat tramp-loaddefs trampver
shell pcomplete parse-time format-spec google-this url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap flycheck derived json map find-func subr-x dash
jka-compr compile let-alist gnus nnheader gnus-util rmail rmail-loaddefs
rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr wid-edit
autoinsert misc mb-depth ido dired-details+ dired dired-loaddefs
dired-details change-inner expand-region text-mode-expansions
er-basic-expansions expand-region-core advice expand-region-custom
org-bullets undo-tree diff paredit edmacro kmacro cl-extra help-mode
use-package pcase diminish bind-key easy-mmode finder-inf rx info
package easymenu epg-config url-handlers url-parse auth-source eieio
eieio-core eieio-loaddefs password-cache url-vars seq byte-opt bytecomp
byte-compile cconv paren elec-pair savehist desktop frameset server
hippie-exp comint ansi-color ring thingatpt cl-seq perl-mode cl-macs cl
gv cl-loaddefs cl-lib time-date tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 1962060 148065)
 (symbols 48 60774 13)
 (miscs 40 9578 7951)
 (strings 32 245948 52334)
 (string-bytes 1 7136436)
 (vectors 16 106836)
 (vector-slots 8 2489273 298510)
 (floats 8 419 1325)
 (intervals 56 216342 2447)
 (buffers 976 204))