mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 15:00:45 -08:00
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.
This commit is contained in:
parent
92b2cedec6
commit
620247ac20
5 changed files with 57 additions and 17 deletions
|
|
@ -4536,9 +4536,9 @@ It should be somewhat more efficient on larger buffers than
|
|||
@cindex symmetric cipher
|
||||
@cindex cipher, symmetric
|
||||
|
||||
If compiled with GnuTLS, Emacs offers built-in cryptographic support.
|
||||
Following the GnuTLS API terminology, the available tools are digests,
|
||||
MACs, symmetric ciphers, and AEAD ciphers.
|
||||
If compiled with GnuTLS, Emacs offers built-in cryptographic
|
||||
support. Following the GnuTLS API terminology, the available tools
|
||||
are digests, MACs, symmetric ciphers, and AEAD ciphers.
|
||||
|
||||
The terms used herein, such as IV (Initialization Vector), require
|
||||
some familiarity with cryptography and will not be defined in detail.
|
||||
|
|
@ -4556,7 +4556,7 @@ structure of the GnuTLS library.
|
|||
@cindex format of gnutls cryptography inputs
|
||||
@cindex gnutls cryptography inputs format
|
||||
|
||||
The inputs to GnuTLS cryptographic functions can be specified in
|
||||
The inputs to GnuTLS cryptographic functions can be specified in
|
||||
several ways, both as primitive Emacs Lisp types or as lists.
|
||||
|
||||
The list form is currently similar to how @code{md5} and
|
||||
|
|
@ -4723,8 +4723,15 @@ IV used.
|
|||
@section Parsing HTML and XML
|
||||
@cindex parsing html
|
||||
|
||||
When Emacs is compiled with libxml2 support, the following functions
|
||||
are available to parse HTML or XML text into Lisp object trees.
|
||||
Emacs can be compiled with built-in libxml2 support.
|
||||
|
||||
@defun libxml-available-p
|
||||
This function returns non-@code{nil} if built-in libxml2 support is
|
||||
available in this Emacs session.
|
||||
@end defun
|
||||
|
||||
When libxml2 support is available, the following functions can be used
|
||||
to parse HTML or XML text into Lisp object trees.
|
||||
|
||||
@defun libxml-parse-html-region start end &optional base-url discard-comments
|
||||
This function parses the text between @var{start} and @var{end} as
|
||||
|
|
@ -4791,9 +4798,9 @@ about syntax).
|
|||
@cindex DOM
|
||||
@cindex Document Object Model
|
||||
|
||||
The @acronym{DOM} returned by @code{libxml-parse-html-region} (and the
|
||||
other @acronym{XML} parsing functions) is a tree structure where each
|
||||
node has a node name (called a @dfn{tag}), and optional key/value
|
||||
The @acronym{DOM} returned by @code{libxml-parse-html-region} (and
|
||||
the other @acronym{XML} parsing functions) is a tree structure where
|
||||
each node has a node name (called a @dfn{tag}), and optional key/value
|
||||
@dfn{attribute} list, and then a list of @dfn{child nodes}. The child
|
||||
nodes are either strings or @acronym{DOM} objects.
|
||||
|
||||
|
|
|
|||
8
etc/NEWS
8
etc/NEWS
|
|
@ -39,6 +39,14 @@ text.
|
|||
+++
|
||||
** New function 'logcount' calculates an integer's Hamming weight.
|
||||
|
||||
+++
|
||||
** New function 'libxml-available-p'.
|
||||
This function returns non-nil if libxml support is both compiled in
|
||||
and available at run time. Lisp programs should use this function to
|
||||
detect built-in libxml support, instead of testing for that
|
||||
indirectly, e.g., by checking that functions like
|
||||
'libxml-parse-html-region' return nil.
|
||||
|
||||
|
||||
* Editing Changes in Emacs 27.1
|
||||
|
||||
|
|
|
|||
|
|
@ -1542,9 +1542,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
|
|||
#endif
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
syms_of_xml ();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCMS2
|
||||
syms_of_lcms2 ();
|
||||
|
|
|
|||
|
|
@ -4391,9 +4391,9 @@ extern void syms_of_xterm (void);
|
|||
extern char *x_get_keysym_name (int);
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
/* Defined in xml.c. */
|
||||
extern void syms_of_xml (void);
|
||||
#ifdef HAVE_LIBXML2
|
||||
extern void xml_cleanup_parser (void);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
37
src/xml.c
37
src/xml.c
|
|
@ -18,15 +18,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#include "lisp.h"
|
||||
#include "buffer.h"
|
||||
|
||||
#ifdef HAVE_LIBXML2
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
|
||||
#include "lisp.h"
|
||||
#include "buffer.h"
|
||||
|
||||
|
||||
#ifdef WINDOWSNT
|
||||
|
||||
|
|
@ -291,16 +291,43 @@ If DISCARD-COMMENTS is non-nil, all HTML comments are discarded. */)
|
|||
return parse_region (start, end, base_url, discard_comments, false);
|
||||
return Qnil;
|
||||
}
|
||||
#endif /* HAVE_LIBXML2 */
|
||||
|
||||
|
||||
|
||||
DEFUN ("libxml-available-p", Flibxml_available_p, Slibxml_available_p, 0, 0, 0,
|
||||
doc: /* Return t if libxml2 support is available in this instance of Emacs.*/)
|
||||
(void)
|
||||
{
|
||||
#ifdef HAVE_LIBXML2
|
||||
# ifdef WINDOWSNT
|
||||
Lisp_Object found = Fassq (Qlibxml2, Vlibrary_cache);
|
||||
if (CONSP (found))
|
||||
return XCDR (found);
|
||||
else
|
||||
{
|
||||
Lisp_Object status;
|
||||
status = init_libxml2_functions () ? Qt : Qnil;
|
||||
Vlibrary_cache = Fcons (Fcons (Qlibxml2, status), Vlibrary_cache);
|
||||
return status;
|
||||
}
|
||||
# else
|
||||
return Qt;
|
||||
# endif /* WINDOWSNT */
|
||||
#else
|
||||
return Qnil;
|
||||
#endif /* HAVE_LIBXML2 */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Initialization
|
||||
***********************************************************************/
|
||||
void
|
||||
syms_of_xml (void)
|
||||
{
|
||||
#ifdef HAVE_LIBXML2
|
||||
defsubr (&Slibxml_parse_html_region);
|
||||
defsubr (&Slibxml_parse_xml_region);
|
||||
#endif
|
||||
defsubr (&Slibxml_available_p);
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBXML2 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue