diff options
| author | Robert Pluim | 2017-11-03 11:33:06 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-11-03 11:33:06 +0200 |
| commit | 620247ac205b80ceb142ee70500ab2c3ffa46fe2 (patch) | |
| tree | deb29eb58c456575d69b51f92decb8faab550c45 /src/xml.c | |
| parent | 92b2cedec60f47faa896963b51bfd370eb3e71cb (diff) | |
| download | emacs-620247ac205b80ceb142ee70500ab2c3ffa46fe2.tar.gz emacs-620247ac205b80ceb142ee70500ab2c3ffa46fe2.zip | |
New function 'libxml-available-p'
* src/emacs.c (main): Call syms_of_xml unconditionally.
* src/lisp.h: Provide syms_of_xml prototype even when
HAVE_LIBXML2 is not defined.
* src/xml.c (Flibxml_available_p): New function, cloned from
Fgnutls_available_p.
(syms_of_xml): Provide Slibxml_available_p.
* doc/lispref/text.texi (Parsing HTML/XML): Document libxml-available-p.
(GnuTLS Cryptography, Format of GnuTLS Cryptography Inputs)
(Document Object Model): Fix indentation of the first paragraph.
* etc/NEWS (libxml-available-p): Mention libxml-available-p.
Diffstat (limited to 'src/xml.c')
| -rw-r--r-- | src/xml.c | 37 |
1 files changed, 32 insertions, 5 deletions
| @@ -18,15 +18,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 18 | 18 | ||
| 19 | #include <config.h> | 19 | #include <config.h> |
| 20 | 20 | ||
| 21 | #include "lisp.h" | ||
| 22 | #include "buffer.h" | ||
| 23 | |||
| 21 | #ifdef HAVE_LIBXML2 | 24 | #ifdef HAVE_LIBXML2 |
| 22 | 25 | ||
| 23 | #include <libxml/tree.h> | 26 | #include <libxml/tree.h> |
| 24 | #include <libxml/parser.h> | 27 | #include <libxml/parser.h> |
| 25 | #include <libxml/HTMLparser.h> | 28 | #include <libxml/HTMLparser.h> |
| 26 | 29 | ||
| 27 | #include "lisp.h" | ||
| 28 | #include "buffer.h" | ||
| 29 | |||
| 30 | 30 | ||
| 31 | #ifdef WINDOWSNT | 31 | #ifdef WINDOWSNT |
| 32 | 32 | ||
| @@ -291,16 +291,43 @@ If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */) | |||
| 291 | return parse_region (start, end, base_url, discard_comments, false); | 291 | return parse_region (start, end, base_url, discard_comments, false); |
| 292 | return Qnil; | 292 | return Qnil; |
| 293 | } | 293 | } |
| 294 | #endif /* HAVE_LIBXML2 */ | ||
| 294 | 295 | ||
| 295 | 296 | ||
| 297 | |||
| 298 | DEFUN ("libxml-available-p", Flibxml_available_p, Slibxml_available_p, 0, 0, 0, | ||
| 299 | doc: /* Return t if libxml2 support is available in this instance of Emacs.*/) | ||
| 300 | (void) | ||
| 301 | { | ||
| 302 | #ifdef HAVE_LIBXML2 | ||
| 303 | # ifdef WINDOWSNT | ||
| 304 | Lisp_Object found = Fassq (Qlibxml2, Vlibrary_cache); | ||
| 305 | if (CONSP (found)) | ||
| 306 | return XCDR (found); | ||
| 307 | else | ||
| 308 | { | ||
| 309 | Lisp_Object status; | ||
| 310 | status = init_libxml2_functions () ? Qt : Qnil; | ||
| 311 | Vlibrary_cache = Fcons (Fcons (Qlibxml2, status), Vlibrary_cache); | ||
| 312 | return status; | ||
| 313 | } | ||
| 314 | # else | ||
| 315 | return Qt; | ||
| 316 | # endif /* WINDOWSNT */ | ||
| 317 | #else | ||
| 318 | return Qnil; | ||
| 319 | #endif /* HAVE_LIBXML2 */ | ||
| 320 | } | ||
| 321 | |||
| 296 | /*********************************************************************** | 322 | /*********************************************************************** |
| 297 | Initialization | 323 | Initialization |
| 298 | ***********************************************************************/ | 324 | ***********************************************************************/ |
| 299 | void | 325 | void |
| 300 | syms_of_xml (void) | 326 | syms_of_xml (void) |
| 301 | { | 327 | { |
| 328 | #ifdef HAVE_LIBXML2 | ||
| 302 | defsubr (&Slibxml_parse_html_region); | 329 | defsubr (&Slibxml_parse_html_region); |
| 303 | defsubr (&Slibxml_parse_xml_region); | 330 | defsubr (&Slibxml_parse_xml_region); |
| 331 | #endif | ||
| 332 | defsubr (&Slibxml_available_p); | ||
| 304 | } | 333 | } |
| 305 | |||
| 306 | #endif /* HAVE_LIBXML2 */ | ||