Function: xml-remove-comments
xml-remove-comments is an autoloaded and byte-compiled function
defined in xml.el.gz.
Signature
(xml-remove-comments BEG END)
Documentation
Remove XML/HTML comments in the region between BEG and END.
All text between the <!-- ... --> markers will be removed.
Probably introduced at or before Emacs version 27.1.
Source Code
;; Defined in /usr/src/emacs/lisp/xml.el.gz
;;;###autoload
(defun xml-remove-comments (beg end)
"Remove XML/HTML comments in the region between BEG and END.
All text between the <!-- ... --> markers will be removed."
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char beg)
(while (search-forward "<!--" nil t)
(let ((start (match-beginning 0)))
(when (search-forward "-->" nil t)
(delete-region start (point))))))))