[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's the right way to detect libxml2?

From: Clément Pit-Claudel
Subject: What's the right way to detect libxml2?
Date: Sun, 22 Oct 2017 10:14:44 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Hi emacs-devel,

In Flycheck we use ``libxml-parse-region`` if available, and fall back to 
``xml-parse-region`` otherwise.  We recently realized that our libxml detection 
code was wrong, however.

We used to write ``(if (fboundp 'libxml-parse-region) (libxml-parse-region …) 
(xml-parse-region …))``, but this isn't sufficient on Windows, where 
``fboundp`` succeeds if Emacs was compiled with libxml support, even if the 
appropriate DLL isn't installed on the user's system.

What's the proper way to autodetect libxml? We're thinking of doing this 

   (if (and (fboundp 'libxml-parse-region)
              (insert "<xml/>")
              (libxml-parse-region (point-min) (point-max))))
       (libxml-parse-region …)
     (xml-parse-region …))

Do we have better options?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]