Homepage: https://github.com/ndw/xmlunicode
Author: Norman Walsh
Updated:
Unicode support for XML
This file provides a suite of functions designed to make it easier
to enter Unicode into Emacs. It is not, in fact, particularly XML-specific though
it does define an 'xml input-mode and does support the ISO 8879 entity names.
Usage
1. By default, the entire Unicode character list (as defined in
xmlunicode-character-list.el) will be loaded. You can tailor
the selection of characters presented in the list by defining
xmlunicode-character-list before loading xmlunicode. The
xmlunicode-character-list is a list of triples of the form:
(codepoint "unicode name" "iso name") ; iso name can be nil
e.g.: (defvar xmlunicode-character-list
'(
;Codept Unicode name ISO Name
(#x000000 "NULL" nil )
(#x000001 "START OF HEADING" nil )
...
(#x0000a0 "NO-BREAK SPACE" "nbsp" )
(#x0000a1 "INVERTED EXCLAMATION MARK" "iexcl" )
(#x0000a2 "CENT SIGN" "cent" )
...))
2. Bind the functions defined in this file to keys you find convenient.
The likely candidates are:
xmlunicode-character-insert insert a character by unicode name
(with completion)
xmlunicode-iso8879-character-insert insert a character by ISO entity name
(with completion)
xmlunicode-smart-double-quote inserts an appropriate double quote
xmlunicode-smart-single-quote inserts an appropriate single quote
xmlunicode-character-menu-insert choose special character from a popup menu
xmlunicode-character-shortcut-insert enter a two-character shortcut for a
unicode character
Helm integration is provided in `xmlunicode-helm.el`. For helm,
use the function `xmlunicode-character-insert-helm`.
You can also create a standard Emacs menu for the character menu list
(instead of, or in addition to, the popup). To do that:
(define-key APPROPRIATE-MAP [menu-bar unichar]
(cons "UniChar" xmlunicode-character-menu-map))
Where APPROPRIATE-MAP is the name of the Emacs keymap to bind into
3. If you want to use the xml input-mode, which provides automatic replacement for the
ISO entity names:
(set-input-method 'xml)
in the appropriate context. Unlike sgml-input, xml-input only inserts the
characters for which you have glyphs. It inserts other characters as numeric
character references. (If you want to insert a literal character even if
you don't have it in your fonts, use xmlunicode-character-insert or
xmlunicode-iso8879-character-insert with a prefix.)
Changes
v1.26 20 Aug 2023
Fixed some docstring errors.
Improved "smart" quoting functions to avoid smart features in YAML files
and Org mode source blocks.
Updated xmlunicode-character-list.el to the latest UnicodeDatabase.txt
v1.25 29 Aug 2021
Added a progress message when loading the xmlunicode-character-alist.
Fixed a few docstrings.
Updated to Unicode 14.0.0d13.
v1.24 17 Jul 2021
Changed the format of the xmlunicode-character-alist so that it's
more useful for searching by adding the XML entity name and the
hex codepoint to the displayed string. The performance of
computing that alist is kind of bad, but I'm not sure how to
improve it. In the meantime, I've reworked things so that it's
only computed when it's first used, so you don't pay the cost at
startup time.
v1.23 23 Aug 2020
Fixed bug where xmlunicode-smart-hyphen didn't recognize the
context "
Dependencies