diff options
Diffstat (limited to 'lisp/xml.el')
-rw-r--r-- | lisp/xml.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/xml.el b/lisp/xml.el index 3bc8c08cb7b..6ce944ccb82 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -1073,6 +1073,19 @@ The first line is indented with INDENT-STRING." (insert ?\n indent-string)) (insert ?< ?/ (symbol-name (xml-node-name xml)) ?>)))) +;;;###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)))))))) + (provide 'xml) ;;; xml.el ends here |