aboutsummaryrefslogtreecommitdiffstats
path: root/src/xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/xml.c b/src/xml.c
index d087a34a5e0..7afaa63c421 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -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
298DEFUN ("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 ***********************************************************************/
299void 325void
300syms_of_xml (void) 326syms_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 */