diff options
| author | Lars Ingebrigtsen | 2022-08-22 12:48:37 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-08-22 12:48:37 +0200 |
| commit | cc33c6cf3a4868ab8cd3cc52679985026a42d176 (patch) | |
| tree | 543b010ab183f10f6698f83667310002c2b5b201 /src | |
| parent | b04ec9a7d3a7c823427609abc67cd811424f9e06 (diff) | |
| download | emacs-cc33c6cf3a4868ab8cd3cc52679985026a42d176.tar.gz emacs-cc33c6cf3a4868ab8cd3cc52679985026a42d176.zip | |
Make start/end in libxml-parse-html-region optional
* doc/lispref/text.texi (Parsing HTML/XML): Adjust.
* src/xml.c (parse_region): Default start/end to point-min/point-max.
(Flibxml_parse_html_region, Flibxml_parse_xml_region): Make
start/end optional.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xml.c | 16 |
1 files changed, 14 insertions, 2 deletions
| @@ -186,6 +186,12 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, | |||
| 186 | 186 | ||
| 187 | xmlCheckVersion (LIBXML_VERSION); | 187 | xmlCheckVersion (LIBXML_VERSION); |
| 188 | 188 | ||
| 189 | if (NILP (start)) | ||
| 190 | start = Fpoint_min (); | ||
| 191 | |||
| 192 | if (NILP (end)) | ||
| 193 | end = Fpoint_max (); | ||
| 194 | |||
| 189 | validate_region (&start, &end); | 195 | validate_region (&start, &end); |
| 190 | 196 | ||
| 191 | istart = XFIXNUM (start); | 197 | istart = XFIXNUM (start); |
| @@ -269,8 +275,11 @@ xml_cleanup_parser (void) | |||
| 269 | 275 | ||
| 270 | DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region, | 276 | DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region, |
| 271 | Slibxml_parse_html_region, | 277 | Slibxml_parse_html_region, |
| 272 | 2, 4, 0, | 278 | 0, 4, 0, |
| 273 | doc: /* Parse the region as an HTML document and return the parse tree. | 279 | doc: /* Parse the region as an HTML document and return the parse tree. |
| 280 | If START is nil, it defaults to `point-min'. If END is nil, it | ||
| 281 | defaults to `point-max'. | ||
| 282 | |||
| 274 | If BASE-URL is non-nil, it is used to expand relative URLs. | 283 | If BASE-URL is non-nil, it is used to expand relative URLs. |
| 275 | 284 | ||
| 276 | If you want comments to be stripped, use the `xml-remove-comments' | 285 | If you want comments to be stripped, use the `xml-remove-comments' |
| @@ -284,8 +293,11 @@ function to strip comments before calling this function. */) | |||
| 284 | 293 | ||
| 285 | DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region, | 294 | DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region, |
| 286 | Slibxml_parse_xml_region, | 295 | Slibxml_parse_xml_region, |
| 287 | 2, 4, 0, | 296 | 0, 4, 0, |
| 288 | doc: /* Parse the region as an XML document and return the parse tree. | 297 | doc: /* Parse the region as an XML document and return the parse tree. |
| 298 | If START is nil, it defaults to `point-min'. If END is nil, it | ||
| 299 | defaults to `point-max'. | ||
| 300 | |||
| 289 | If BASE-URL is non-nil, it is used to expand relative URLs. | 301 | If BASE-URL is non-nil, it is used to expand relative URLs. |
| 290 | 302 | ||
| 291 | If you want comments to be stripped, use the `xml-remove-comments' | 303 | If you want comments to be stripped, use the `xml-remove-comments' |