aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/nxml
diff options
context:
space:
mode:
authorStefan Monnier2016-01-15 10:29:20 -0500
committerStefan Monnier2016-01-15 10:29:20 -0500
commit930f8e8377e40ba161bd16ea4d612cb4c570ee1b (patch)
treefd3c9aa7fd154317758053492ad855df68658f15 /lisp/nxml
parenta600f4c69309bf37f67c02cbcc9a9e4ba1e69c76 (diff)
downloademacs-930f8e8377e40ba161bd16ea4d612cb4c570ee1b.tar.gz
emacs-930f8e8377e40ba161bd16ea4d612cb4c570ee1b.zip
Update nXML to use Emacs's Unicode support, and lexical-binding
* etc/nxml/*.el: Remove obsolete char-name files. * lisp/nxml/xsd-regexp.el (xsdre-range-list-difference): Remove unused var `next'. * lisp/nxml/rng-nxml.el (rng-set-state-after): Don't assume point-min==1. * lisp/nxml/rng-match.el (rng-update-match-state): Simplify. * lisp/nxml/nxml-outln.el (nxml-outline-state-transform-exceptions) (nxml-target-section-pos, nxml-depth-in-target-section) (nxml-outline-state-transform-alist) (nxml-outline-display-section-tag-function): Move decl before first use. * lisp/nxml/nxml-mode.el (nxml-char-name-ignore-case) (nxml-char-name-alist, nxml-char-name-table) (nxml-autoload-char-name-set-list, nxml-named-char-history): Remove vars. (nxml-enable-char-name-set, nxml-disable-char-name-set) (nxml-char-name-set-enabled-p, nxml-autoload-char-name-set) (nxml-define-char-name-set, nxml-get-char-name): Remove functions. (nxml-insert-named-char): Use read-char-by-name instead. (nxml-char-ref-display-extra): Use get-char-code-property. * lisp/nxml/nxml-maint.el (nxml-create-unicode-char-name-sets): Remove function. * lisp/nxml/nxml-glyph.el, lisp/nxml/nxml-uchnm.el: Remove files.
Diffstat (limited to 'lisp/nxml')
-rw-r--r--lisp/nxml/nxml-enc.el4
-rw-r--r--lisp/nxml/nxml-glyph.el423
-rw-r--r--lisp/nxml/nxml-maint.el44
-rw-r--r--lisp/nxml/nxml-mode.el119
-rw-r--r--lisp/nxml/nxml-outln.el26
-rw-r--r--lisp/nxml/nxml-parse.el2
-rw-r--r--lisp/nxml/nxml-rap.el2
-rw-r--r--lisp/nxml/nxml-uchnm.el251
-rw-r--r--lisp/nxml/rng-cmpct.el2
-rw-r--r--lisp/nxml/rng-dt.el4
-rw-r--r--lisp/nxml/rng-loc.el15
-rw-r--r--lisp/nxml/rng-maint.el2
-rw-r--r--lisp/nxml/rng-match.el5
-rw-r--r--lisp/nxml/rng-nxml.el6
-rw-r--r--lisp/nxml/rng-parse.el2
-rw-r--r--lisp/nxml/rng-pttrn.el2
-rw-r--r--lisp/nxml/rng-uri.el2
-rw-r--r--lisp/nxml/rng-valid.el18
-rw-r--r--lisp/nxml/rng-xsd.el8
-rw-r--r--lisp/nxml/xsd-regexp.el6
20 files changed, 61 insertions, 882 deletions
diff --git a/lisp/nxml/nxml-enc.el b/lisp/nxml/nxml-enc.el
index bcee0882aa2..6406f57ff63 100644
--- a/lisp/nxml/nxml-enc.el
+++ b/lisp/nxml/nxml-enc.el
@@ -1,4 +1,4 @@
1;;; nxml-enc.el --- XML encoding auto-detection 1;;; nxml-enc.el --- XML encoding auto-detection -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -68,7 +68,7 @@
68 (and nxml-non-xml-set-auto-coding-function 68 (and nxml-non-xml-set-auto-coding-function
69 (funcall nxml-non-xml-set-auto-coding-function file-name size)))) 69 (funcall nxml-non-xml-set-auto-coding-function file-name size))))
70 70
71(defun nxml-set-xml-coding (file-name size) 71(defun nxml-set-xml-coding (_file-name size)
72 "Function to use as `set-auto-coding-function' when file is known to be XML." 72 "Function to use as `set-auto-coding-function' when file is known to be XML."
73 (nxml-detect-coding-system (+ (point) (min size 1024)))) 73 (nxml-detect-coding-system (+ (point) (min size 1024))))
74 74
diff --git a/lisp/nxml/nxml-glyph.el b/lisp/nxml/nxml-glyph.el
deleted file mode 100644
index 4a518218c23..00000000000
--- a/lisp/nxml/nxml-glyph.el
+++ /dev/null
@@ -1,423 +0,0 @@
1;;; nxml-glyph.el --- glyph-handling for nxml-mode
2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4
5;; Author: James Clark
6;; Keywords: wp, hypermedia, languages, XML
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;; The entry point to this file is `nxml-glyph-display-string'.
26;; The current implementation is heuristic due to a lack of
27;; Emacs primitives necessary to implement it properly. The user
28;; can tweak the heuristics using `nxml-glyph-set-functions'.
29
30;;; Code:
31
32(defconst nxml-ascii-glyph-set
33 [(#x0020 . #x007E)])
34
35(defconst nxml-latin1-glyph-set
36 [(#x0020 . #x007E)
37 (#x00A0 . #x00FF)])
38
39;; These were generated by using nxml-insert-target-repertoire-glyph-set
40;; on the TARGET[123] files in
41;; http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
42
43(defconst nxml-misc-fixed-1-glyph-set
44 [(#x0020 . #x007E)
45 (#x00A0 . #x00FF)
46 (#x0100 . #x017F)
47 #x018F #x0192
48 (#x0218 . #x021B)
49 #x0259
50 (#x02C6 . #x02C7)
51 (#x02D8 . #x02DD)
52 (#x0374 . #x0375)
53 #x037A #x037E
54 (#x0384 . #x038A)
55 #x038C
56 (#x038E . #x03A1)
57 (#x03A3 . #x03CE)
58 (#x0401 . #x040C)
59 (#x040E . #x044F)
60 (#x0451 . #x045C)
61 (#x045E . #x045F)
62 (#x0490 . #x0491)
63 (#x05D0 . #x05EA)
64 (#x1E02 . #x1E03)
65 (#x1E0A . #x1E0B)
66 (#x1E1E . #x1E1F)
67 (#x1E40 . #x1E41)
68 (#x1E56 . #x1E57)
69 (#x1E60 . #x1E61)
70 (#x1E6A . #x1E6B)
71 (#x1E80 . #x1E85)
72 (#x1EF2 . #x1EF3)
73 (#x2010 . #x2022)
74 #x2026 #x2030
75 (#x2039 . #x203A)
76 #x20AC #x2116 #x2122 #x2126
77 (#x215B . #x215E)
78 (#x2190 . #x2193)
79 #x2260
80 (#x2264 . #x2265)
81 (#x23BA . #x23BD)
82 (#x2409 . #x240D)
83 #x2424 #x2500 #x2502 #x250C #x2510 #x2514 #x2518 #x251C #x2524 #x252C #x2534 #x253C #x2592 #x25C6 #x266A #xFFFD]
84 "Glyph set for TARGET1 glyph repertoire of misc-fixed-* font.
85This repertoire is supported for the bold and oblique fonts.")
86
87(defconst nxml-misc-fixed-2-glyph-set
88 [(#x0020 . #x007E)
89 (#x00A0 . #x00FF)
90 (#x0100 . #x017F)
91 #x018F #x0192
92 (#x01FA . #x01FF)
93 (#x0218 . #x021B)
94 #x0259
95 (#x02C6 . #x02C7)
96 #x02C9
97 (#x02D8 . #x02DD)
98 (#x0300 . #x0311)
99 (#x0374 . #x0375)
100 #x037A #x037E
101 (#x0384 . #x038A)
102 #x038C
103 (#x038E . #x03A1)
104 (#x03A3 . #x03CE)
105 #x03D1
106 (#x03D5 . #x03D6)
107 #x03F1
108 (#x0401 . #x040C)
109 (#x040E . #x044F)
110 (#x0451 . #x045C)
111 (#x045E . #x045F)
112 (#x0490 . #x0491)
113 (#x05D0 . #x05EA)
114 (#x1E02 . #x1E03)
115 (#x1E0A . #x1E0B)
116 (#x1E1E . #x1E1F)
117 (#x1E40 . #x1E41)
118 (#x1E56 . #x1E57)
119 (#x1E60 . #x1E61)
120 (#x1E6A . #x1E6B)
121 (#x1E80 . #x1E85)
122 (#x1EF2 . #x1EF3)
123 (#x2010 . #x2022)
124 #x2026 #x2030
125 (#x2032 . #x2034)
126 (#x2039 . #x203A)
127 #x203C #x203E #x2044
128 (#x2070 . #x2071)
129 (#x2074 . #x208E)
130 (#x20A3 . #x20A4)
131 #x20A7 #x20AC
132 (#x20D0 . #x20D7)
133 #x2102 #x2105 #x2113
134 (#x2115 . #x2116)
135 #x211A #x211D #x2122 #x2124 #x2126 #x212E
136 (#x215B . #x215E)
137 (#x2190 . #x2195)
138 (#x21A4 . #x21A8)
139 (#x21D0 . #x21D5)
140 (#x2200 . #x2209)
141 (#x220B . #x220C)
142 #x220F
143 (#x2211 . #x2213)
144 #x2215
145 (#x2218 . #x221A)
146 (#x221D . #x221F)
147 #x2221
148 (#x2224 . #x222B)
149 #x222E #x223C #x2243 #x2245
150 (#x2248 . #x2249)
151 #x2259
152 (#x225F . #x2262)
153 (#x2264 . #x2265)
154 (#x226A . #x226B)
155 (#x2282 . #x228B)
156 #x2295 #x2297
157 (#x22A4 . #x22A7)
158 (#x22C2 . #x22C3)
159 #x22C5 #x2300 #x2302
160 (#x2308 . #x230B)
161 #x2310
162 (#x2320 . #x2321)
163 (#x2329 . #x232A)
164 (#x23BA . #x23BD)
165 (#x2409 . #x240D)
166 #x2424 #x2500 #x2502 #x250C #x2510 #x2514 #x2518 #x251C #x2524 #x252C #x2534 #x253C
167 (#x254C . #x2573)
168 (#x2580 . #x25A1)
169 (#x25AA . #x25AC)
170 (#x25B2 . #x25B3)
171 #x25BA #x25BC #x25C4 #x25C6
172 (#x25CA . #x25CB)
173 #x25CF
174 (#x25D8 . #x25D9)
175 #x25E6
176 (#x263A . #x263C)
177 #x2640 #x2642 #x2660 #x2663
178 (#x2665 . #x2666)
179 (#x266A . #x266B)
180 (#xFB01 . #xFB02)
181 #xFFFD]
182 "Glyph set for TARGET2 glyph repertoire of the misc-fixed-* fonts.
183This repertoire is supported for the following fonts:
1845x7.bdf 5x8.bdf 6x9.bdf 6x10.bdf 6x12.bdf 7x13.bdf 7x14.bdf clR6x12.bdf")
185
186(defconst nxml-misc-fixed-3-glyph-set
187 [(#x0020 . #x007E)
188 (#x00A0 . #x00FF)
189 (#x0100 . #x01FF)
190 (#x0200 . #x0220)
191 (#x0222 . #x0233)
192 (#x0250 . #x02AD)
193 (#x02B0 . #x02EE)
194 (#x0300 . #x034F)
195 (#x0360 . #x036F)
196 (#x0374 . #x0375)
197 #x037A #x037E
198 (#x0384 . #x038A)
199 #x038C
200 (#x038E . #x03A1)
201 (#x03A3 . #x03CE)
202 (#x03D0 . #x03F6)
203 (#x0400 . #x0486)
204 (#x0488 . #x04CE)
205 (#x04D0 . #x04F5)
206 (#x04F8 . #x04F9)
207 (#x0500 . #x050F)
208 (#x0531 . #x0556)
209 (#x0559 . #x055F)
210 (#x0561 . #x0587)
211 (#x0589 . #x058A)
212 (#x05B0 . #x05B9)
213 (#x05BB . #x05C4)
214 (#x05D0 . #x05EA)
215 (#x05F0 . #x05F4)
216 (#x10D0 . #x10F8)
217 #x10FB
218 (#x1E00 . #x1E9B)
219 (#x1EA0 . #x1EF9)
220 (#x1F00 . #x1F15)
221 (#x1F18 . #x1F1D)
222 (#x1F20 . #x1F45)
223 (#x1F48 . #x1F4D)
224 (#x1F50 . #x1F57)
225 #x1F59 #x1F5B #x1F5D
226 (#x1F5F . #x1F7D)
227 (#x1F80 . #x1FB4)
228 (#x1FB6 . #x1FC4)
229 (#x1FC6 . #x1FD3)
230 (#x1FD6 . #x1FDB)
231 (#x1FDD . #x1FEF)
232 (#x1FF2 . #x1FF4)
233 (#x1FF6 . #x1FFE)
234 (#x2000 . #x200A)
235 (#x2010 . #x2027)
236 (#x202F . #x2052)
237 #x2057
238 (#x205F . #x2063)
239 (#x2070 . #x2071)
240 (#x2074 . #x208E)
241 (#x20A0 . #x20B1)
242 (#x20D0 . #x20EA)
243 (#x2100 . #x213A)
244 (#x213D . #x214B)
245 (#x2153 . #x2183)
246 (#x2190 . #x21FF)
247 (#x2200 . #x22FF)
248 (#x2300 . #x23CE)
249 (#x2400 . #x2426)
250 (#x2440 . #x244A)
251 (#x2500 . #x25FF)
252 (#x2600 . #x2613)
253 (#x2616 . #x2617)
254 (#x2619 . #x267D)
255 (#x2680 . #x2689)
256 (#x27E6 . #x27EB)
257 (#x27F5 . #x27FF)
258 (#x2A00 . #x2A06)
259 #x2A1D #x2A3F #x303F
260 (#xFB00 . #xFB06)
261 (#xFB13 . #xFB17)
262 (#xFB1D . #xFB36)
263 (#xFB38 . #xFB3C)
264 #xFB3E
265 (#xFB40 . #xFB41)
266 (#xFB43 . #xFB44)
267 (#xFB46 . #xFB4F)
268 (#xFE20 . #xFE23)
269 (#xFF61 . #xFF9F)
270 #xFFFD]
271 "Glyph set for TARGET3 glyph repertoire of the misc-fixed-* fonts.
272This repertoire is supported for the following fonts:
2736x13.bdf 8x13.bdf 9x15.bdf 9x18.bdf 10x20.bdf")
274
275(defconst nxml-wgl4-glyph-set
276 [(#x0020 . #x007E)
277 (#x00A0 . #x017F)
278 #x0192
279 (#x01FA . #x01FF)
280 (#x02C6 . #x02C7)
281 #x02C9
282 (#x02D8 . #x02DB)
283 #x02DD
284 (#x0384 . #x038A)
285 #x038C
286 (#x038E . #x03A1)
287 (#x03A3 . #x03CE)
288 (#x0401 . #x040C)
289 (#x040E . #x044F)
290 (#x0451 . #x045C)
291 (#x045E . #x045F)
292 (#x0490 . #x0491)
293 (#x1E80 . #x1E85)
294 (#x1EF2 . #x1EF3)
295 (#x2013 . #x2015)
296 (#x2017 . #x201E)
297 (#x2020 . #x2022)
298 #x2026 #x2030
299 (#x2032 . #x2033)
300 (#x2039 . #x203A)
301 #x203C #x203E #x2044 #x207F
302 (#x20A3 . #x20A4)
303 #x20A7 #x20AC #x2105 #x2113 #x2116 #x2122 #x2126 #x212E
304 (#x215B . #x215E)
305 (#x2190 . #x2195)
306 #x21A8 #x2202 #x2206 #x220F
307 (#x2211 . #x2212)
308 #x2215
309 (#x2219 . #x221A)
310 (#x221E . #x221F)
311 #x2229 #x222B #x2248
312 (#x2260 . #x2261)
313 (#x2264 . #x2265)
314 #x2302 #x2310
315 (#x2320 . #x2321)
316 #x2500 #x2502 #x250C #x2510 #x2514 #x2518 #x251C #x2524
317 #x252C #x2534 #x253C
318 (#x2550 . #x256C)
319 #x2580 #x2584 #x2588 #x258C
320 (#x2590 . #x2593)
321 (#x25A0 . #x25A1)
322 (#x25AA . #x25AC)
323 #x25B2 #x25BA #x25BC #x25C4
324 (#x25CA . #x25CB)
325 #x25CF
326 (#x25D8 . #x25D9)
327 #x25E6
328 (#x263A . #x263C)
329 #x2640 #x2642 #x2660 #x2663
330 (#x2665 . #x2666)
331 (#x266A . #x266B)
332 (#xFB01 . #xFB02)]
333 "Glyph set corresponding to Windows Glyph List 4.")
334
335(defvar nxml-glyph-set-functions nil
336 "Abnormal hook for determining the set of glyphs in a face.
337Each function in this hook is called in turn, unless one of them
338returns non-nil. Each function is called with a single argument
339FACE. If it can determine the set of glyphs representable by
340FACE, it must set the variable `nxml-glyph-set' and return
341non-nil. Otherwise, it must return nil.
342
343The constants `nxml-ascii-glyph-set', `nxml-latin1-glyph-set',
344`nxml-misc-fixed-1-glyph-set', `nxml-misc-fixed-2-glyph-set',
345`nxml-misc-fixed-3-glyph-set' and `nxml-wgl4-glyph-set' are
346predefined for use by `nxml-glyph-set-functions'.")
347
348(define-obsolete-variable-alias 'nxml-glyph-set-hook
349 'nxml-glyph-set-functions "24.3")
350
351(defvar nxml-glyph-set nil
352 "Used by `nxml-glyph-set-functions' to return set of glyphs in a FACE.
353This should dynamically bound by any function that runs
354`nxml-glyph-set-functions'. The value must be either nil representing an
355empty set or a vector. Each member of the vector is either a single
356integer or a cons (FIRST . LAST) representing the range of integers
357from FIRST to LAST. An integer represents a glyph with that Unicode
358code-point. The vector must be ordered.")
359
360(defun nxml-x-set-glyph-set (face)
361 (setq nxml-glyph-set
362 (if (equal (face-attribute face :family) "misc-fixed")
363 nxml-misc-fixed-3-glyph-set
364 nxml-wgl4-glyph-set)))
365
366(defun nxml-w32-set-glyph-set (face)
367 (setq nxml-glyph-set nxml-wgl4-glyph-set))
368
369(defun nxml-window-system-set-glyph-set (face)
370 (setq nxml-glyph-set nxml-latin1-glyph-set))
371
372(defun nxml-terminal-set-glyph-set (face)
373 (setq nxml-glyph-set nxml-ascii-glyph-set))
374
375(add-hook 'nxml-glyph-set-functions
376 (or (cdr (assq window-system
377 '((x . nxml-x-set-glyph-set)
378 (w32 . nxml-w32-set-glyph-set)
379 (nil . nxml-terminal-set-glyph-set))))
380 'nxml-window-system-set-glyph-set)
381 t)
382
383;;;###autoload
384(defun nxml-glyph-display-string (n face)
385 "Return a string that can display a glyph for Unicode code-point N.
386FACE gives the face that will be used for displaying the string.
387Return nil if the face cannot display a glyph for N."
388 (let ((nxml-glyph-set nil))
389 (run-hook-with-args-until-success 'nxml-glyph-set-functions face)
390 (and nxml-glyph-set
391 (nxml-glyph-set-contains-p n nxml-glyph-set)
392 (let ((ch (decode-char 'ucs n)))
393 (and ch (string ch))))))
394
395(defun nxml-glyph-set-contains-p (n v)
396 (let ((start 0)
397 (end (length v))
398 found mid mid-val mid-start-val mid-end-val)
399 (while (> end start)
400 (setq mid (+ start
401 (/ (- end start) 2)))
402 (setq mid-val (aref v mid))
403 (if (consp mid-val)
404 (setq mid-start-val (car mid-val)
405 mid-end-val (cdr mid-val))
406 (setq mid-start-val mid-val
407 mid-end-val mid-val))
408 (cond ((and (<= mid-start-val n)
409 (<= n mid-end-val))
410 (setq found t)
411 (setq start end))
412 ((< n mid-start-val)
413 (setq end mid))
414 (t
415 (setq start
416 (if (eq start mid)
417 end
418 mid)))))
419 found))
420
421(provide 'nxml-glyph)
422
423;;; nxml-glyph.el ends here
diff --git a/lisp/nxml/nxml-maint.el b/lisp/nxml/nxml-maint.el
index b81e3113efb..5d24d9b3138 100644
--- a/lisp/nxml/nxml-maint.el
+++ b/lisp/nxml/nxml-maint.el
@@ -1,4 +1,4 @@
1;;; nxml-maint.el --- commands for maintainers of nxml-*.el 1;;; nxml-maint.el --- commands for maintainers of nxml-*.el -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -24,48 +24,6 @@
24 24
25;;; Code: 25;;; Code:
26 26
27;;; Generating files with Unicode char names.
28
29(require 'nxml-uchnm)
30
31(defun nxml-create-unicode-char-name-sets (file)
32 "Generate files containing char names from Unicode standard."
33 (interactive "fUnicodeData file: ")
34 (mapc (lambda (block)
35 (let ((nameset (nxml-unicode-block-char-name-set (nth 0 block))))
36 (save-excursion
37 (find-file (concat (get nameset 'nxml-char-name-set-file)
38 ".el"))
39 (erase-buffer)
40 (insert "(nxml-define-char-name-set '")
41 (prin1 nameset (current-buffer))
42 (insert "\n '())\n")
43 (goto-char (- (point) 3)))))
44 nxml-unicode-blocks)
45 (save-excursion
46 (find-file file)
47 (goto-char (point-min))
48 (let ((blocks nxml-unicode-blocks)
49 code name)
50 (while (re-search-forward "^\\([0-9A-F]+\\);\\([^<;][^;]*\\);"
51 nil
52 t)
53 (setq code (string-to-number (match-string 1) 16))
54 (setq name (match-string 2))
55 (while (and blocks
56 (> code (nth 2 (car blocks))))
57 (setq blocks (cdr blocks)))
58 (when (and (<= (nth 1 (car blocks)) code)
59 (<= code (nth 2 (car blocks))))
60 (save-excursion
61 (find-file (concat (get (nxml-unicode-block-char-name-set
62 (nth 0 (car blocks)))
63 'nxml-char-name-set-file)
64 ".el"))
65 (insert "(")
66 (prin1 name (current-buffer))
67 (insert (format " #x%04X)\n " code))))))))
68
69;;; Parsing target repertoire files from ucs-fonts. 27;;; Parsing target repertoire files from ucs-fonts.
70;; This is for converting the TARGET? files in 28;; This is for converting the TARGET? files in
71;; http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz 29;; http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 324350f591c..db607502889 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -33,7 +33,6 @@
33 33
34(require 'xmltok) 34(require 'xmltok)
35(require 'nxml-enc) 35(require 'nxml-enc)
36(require 'nxml-glyph)
37(require 'nxml-util) 36(require 'nxml-util)
38(require 'nxml-rap) 37(require 'nxml-rap)
39(require 'nxml-outln) 38(require 'nxml-outln)
@@ -55,9 +54,7 @@
55 54
56(defcustom nxml-char-ref-display-glyph-flag t 55(defcustom nxml-char-ref-display-glyph-flag t
57 "Non-nil means display glyph following character reference. 56 "Non-nil means display glyph following character reference.
58The glyph is displayed in face `nxml-glyph'. The abnormal hook 57The glyph is displayed in face `nxml-glyph'."
59`nxml-glyph-set-functions' can be used to change the characters
60for which glyphs are displayed."
61 :group 'nxml 58 :group 'nxml
62 :type 'boolean) 59 :type 'boolean)
63 60
@@ -583,8 +580,7 @@ Many aspects this mode can be customized using
583 (jit-lock-contextually . t) 580 (jit-lock-contextually . t)
584 (font-lock-unfontify-region-function . nxml-unfontify-region))) 581 (font-lock-unfontify-region-function . nxml-unfontify-region)))
585 582
586 (rng-nxml-mode-init) 583 (with-demoted-errors (rng-nxml-mode-init)))
587 (nxml-enable-unicode-char-name-sets))
588 584
589(defun nxml-cleanup () 585(defun nxml-cleanup ()
590 "Clean up after nxml-mode." 586 "Clean up after nxml-mode."
@@ -2477,116 +2473,15 @@ and attempts to find another possible way to do the markup."
2477 2473
2478;;; Character names 2474;;; Character names
2479 2475
2480(defvar nxml-char-name-ignore-case t)
2481
2482(defvar nxml-char-name-alist nil
2483 "Alist of character names.
2484Each member of the list has the form (NAME CODE . NAMESET),
2485where NAME is a string naming a character, NAMESET is a symbol
2486identifying a set of names and CODE is an integer specifying the
2487Unicode scalar value of the named character.
2488The NAME will only be used for completion if NAMESET has
2489a non-nil `nxml-char-name-set-enabled' property.
2490If NAMESET does does not have `nxml-char-name-set-defined' property,
2491then it must have a `nxml-char-name-set-file' property and `load'
2492will be applied to the value of this property if the nameset
2493is enabled.")
2494
2495(defvar nxml-char-name-table (make-hash-table :test 'eq)
2496 "Hash table for mapping char codes to names.
2497Each key is a Unicode scalar value.
2498Each value is a list of pairs of the form (NAMESET . NAME),
2499where NAMESET is a symbol identifying a set of names,
2500and NAME is a string naming a character.")
2501
2502(defvar nxml-autoload-char-name-set-list nil
2503 "List of char namesets that can be autoloaded.")
2504
2505(defun nxml-enable-char-name-set (nameset)
2506 (put nameset 'nxml-char-name-set-enabled t))
2507
2508(defun nxml-disable-char-name-set (nameset)
2509 (put nameset 'nxml-char-name-set-enabled nil))
2510
2511(defun nxml-char-name-set-enabled-p (nameset)
2512 (get nameset 'nxml-char-name-set-enabled))
2513
2514(defun nxml-autoload-char-name-set (nameset file)
2515 (unless (memq nameset nxml-autoload-char-name-set-list)
2516 (setq nxml-autoload-char-name-set-list
2517 (cons nameset nxml-autoload-char-name-set-list)))
2518 (put nameset 'nxml-char-name-set-file file))
2519
2520(defun nxml-define-char-name-set (nameset alist)
2521 "Define a set of character names.
2522NAMESET is a symbol identifying the set.
2523ALIST is a list where each member has the form (NAME CODE),
2524where NAME is a string naming a character and code is an
2525integer giving the Unicode scalar value of the character."
2526 (when (get nameset 'nxml-char-name-set-defined)
2527 (error "Nameset `%s' already defined" nameset))
2528 (let ((iter alist))
2529 (while iter
2530 (let* ((name-code (car iter))
2531 (name (car name-code))
2532 (code (cadr name-code)))
2533 (puthash code
2534 (cons (cons nameset name)
2535 (gethash code nxml-char-name-table))
2536 nxml-char-name-table))
2537 (setcdr (cdr (car iter)) nameset)
2538 (setq iter (cdr iter))))
2539 (setq nxml-char-name-alist
2540 (nconc alist nxml-char-name-alist))
2541 (put nameset 'nxml-char-name-set-defined t))
2542
2543(defun nxml-get-char-name (code)
2544 (mapc 'nxml-maybe-load-char-name-set nxml-autoload-char-name-set-list)
2545 (let ((names (gethash code nxml-char-name-table))
2546 name)
2547 (while (and names (not name))
2548 (if (nxml-char-name-set-enabled-p (caar names))
2549 (setq name (cdar names))
2550 (setq names (cdr names))))
2551 name))
2552
2553(defvar nxml-named-char-history nil)
2554
2555(defun nxml-insert-named-char (arg) 2476(defun nxml-insert-named-char (arg)
2556 "Insert a character using its name. 2477 "Insert a character using its name.
2557The name is read from the minibuffer. 2478The name is read from the minibuffer.
2558Normally, inserts the character as a numeric character reference. 2479Normally, inserts the character as a numeric character reference.
2559With a prefix argument, inserts the character directly." 2480With a prefix argument, inserts the character directly."
2560 (interactive "*P") 2481 (interactive "*P")
2561 (mapc 'nxml-maybe-load-char-name-set nxml-autoload-char-name-set-list) 2482 (let ((code (read-char-by-name "Character name: ")))
2562 (let ((name
2563 (let ((completion-ignore-case nxml-char-name-ignore-case))
2564 (completing-read "Character name: "
2565 nxml-char-name-alist
2566 (lambda (member)
2567 (get (cddr member) 'nxml-char-name-set-enabled))
2568 t
2569 nil
2570 'nxml-named-char-history)))
2571 (alist nxml-char-name-alist)
2572 elt code)
2573 (while (and alist (not code))
2574 (setq elt (assoc name alist))
2575 (if (get (cddr elt) 'nxml-char-name-set-enabled)
2576 (setq code (cadr elt))
2577 (setq alist (cdr (member elt alist)))))
2578 (when code 2483 (when code
2579 (insert (if arg 2484 (insert (if arg code (format "&#x%X;" code))))))
2580 (or (decode-char 'ucs code)
2581 (error "Character %x is not supported by Emacs"
2582 code))
2583 (format "&#x%X;" code))))))
2584
2585(defun nxml-maybe-load-char-name-set (sym)
2586 (when (and (get sym 'nxml-char-name-set-enabled)
2587 (not (get sym 'nxml-char-name-set-defined))
2588 (stringp (get sym 'nxml-char-name-set-file)))
2589 (load (get sym 'nxml-char-name-set-file))))
2590 2485
2591(defun nxml-toggle-char-ref-extra-display (arg) 2486(defun nxml-toggle-char-ref-extra-display (arg)
2592 "Toggle the display of extra information for character references." 2487 "Toggle the display of extra information for character references."
@@ -2602,9 +2497,11 @@ With a prefix argument, inserts the character directly."
2602 2497
2603(defun nxml-char-ref-display-extra (start end n) 2498(defun nxml-char-ref-display-extra (start end n)
2604 (when nxml-char-ref-extra-display 2499 (when nxml-char-ref-extra-display
2605 (let ((name (nxml-get-char-name n)) 2500 (let ((name (or (get-char-code-property n 'name)
2501 (get-char-code-property n 'old-name)))
2606 (glyph-string (and nxml-char-ref-display-glyph-flag 2502 (glyph-string (and nxml-char-ref-display-glyph-flag
2607 (nxml-glyph-display-string n 'nxml-glyph))) 2503 (char-displayable-p n)
2504 (string n)))
2608 ov) 2505 ov)
2609 (when (or name glyph-string) 2506 (when (or name glyph-string)
2610 (setq ov (make-overlay start end nil t)) 2507 (setq ov (make-overlay start end nil t))
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el
index 962160cb435..79e6406f553 100644
--- a/lisp/nxml/nxml-outln.el
+++ b/lisp/nxml/nxml-outln.el
@@ -1,4 +1,4 @@
1;;; nxml-outln.el --- outline support for nXML mode 1;;; nxml-outln.el --- outline support for nXML mode -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2004, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2004, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -248,6 +248,16 @@ customize which elements are recognized as sections and headings."
248 (interactive) 248 (interactive)
249 (nxml-transform-subtree-outline '((hide-children . t)))) 249 (nxml-transform-subtree-outline '((hide-children . t))))
250 250
251;; These variables are dynamically bound. They are use to pass information to
252;; nxml-section-tag-transform-outline-state.
253
254(defvar nxml-outline-state-transform-exceptions nil)
255(defvar nxml-target-section-pos nil)
256(defvar nxml-depth-in-target-section nil)
257(defvar nxml-outline-state-transform-alist nil)
258
259(defvar nxml-outline-display-section-tag-function nil)
260
251(defun nxml-hide-other () 261(defun nxml-hide-other ()
252 "Hide text content other than that directly in the section containing point. 262 "Hide text content other than that directly in the section containing point.
253Hide headings other than those of ancestors of that section and their 263Hide headings other than those of ancestors of that section and their
@@ -275,14 +285,6 @@ customize which elements are recognized as sections and headings."
275 (nxml-transform-buffer-outline '((nil . hide-children) 285 (nxml-transform-buffer-outline '((nil . hide-children)
276 (t . hide-children))))) 286 (t . hide-children)))))
277 287
278;; These variables are dynamically bound. They are use to pass information to
279;; nxml-section-tag-transform-outline-state.
280
281(defvar nxml-outline-state-transform-exceptions nil)
282(defvar nxml-target-section-pos nil)
283(defvar nxml-depth-in-target-section nil)
284(defvar nxml-outline-state-transform-alist nil)
285
286(defun nxml-transform-buffer-outline (alist) 288(defun nxml-transform-buffer-outline (alist)
287 (let ((nxml-target-section-pos nil) 289 (let ((nxml-target-section-pos nil)
288 (nxml-depth-in-target-section 0) 290 (nxml-depth-in-target-section 0)
@@ -350,7 +352,7 @@ customize which elements are recognized as sections and headings."
350(defun nxml-section-tag-transform-outline-state (startp 352(defun nxml-section-tag-transform-outline-state (startp
351 section-start-pos 353 section-start-pos
352 &optional 354 &optional
353 heading-start-pos) 355 _heading-start-pos)
354 (if (not startp) 356 (if (not startp)
355 (setq nxml-depth-in-target-section 357 (setq nxml-depth-in-target-section
356 (and nxml-depth-in-target-section 358 (and nxml-depth-in-target-section
@@ -427,8 +429,6 @@ customize which elements are recognized as sections and headings."
427 (nxml-outline-error 429 (nxml-outline-error
428 (nxml-report-outline-error "Cannot display outline: %s" err))))) 430 (nxml-report-outline-error "Cannot display outline: %s" err)))))
429 431
430(defvar nxml-outline-display-section-tag-function nil)
431
432(defun nxml-outline-display-rest (outline-state start-tag-indent tag-qnames) 432(defun nxml-outline-display-rest (outline-state start-tag-indent tag-qnames)
433 "Display up to and including the end of the current element. 433 "Display up to and including the end of the current element.
434OUTLINE-STATE can be nil, t, hide-children. START-TAG-INDENT is the 434OUTLINE-STATE can be nil, t, hide-children. START-TAG-INDENT is the
@@ -789,7 +789,7 @@ no new overlay will be created."
789(defun nxml-end-of-heading () 789(defun nxml-end-of-heading ()
790 "Move from the start of the content of the heading to the end. 790 "Move from the start of the content of the heading to the end.
791Do not move past the end of the line." 791Do not move past the end of the line."
792 (let ((pos (condition-case err 792 (let ((pos (condition-case nil
793 (and (nxml-scan-element-forward (point) t) 793 (and (nxml-scan-element-forward (point) t)
794 xmltok-start) 794 xmltok-start)
795 (nxml-scan-error nil)))) 795 (nxml-scan-error nil))))
diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el
index 41b2e8ee513..edf012921a9 100644
--- a/lisp/nxml/nxml-parse.el
+++ b/lisp/nxml/nxml-parse.el
@@ -1,4 +1,4 @@
1;;; nxml-parse.el --- XML parser, sharing infrastructure with nxml-mode 1;;; nxml-parse.el --- XML parser, sharing infrastructure with nxml-mode -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index 47b23da62ad..e68c8a427fd 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -1,4 +1,4 @@
1;;; nxml-rap.el --- low-level support for random access parsing for nXML mode 1;;; nxml-rap.el --- low-level support for random access parsing for nXML mode -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003-2004, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003-2004, 2007-2016 Free Software Foundation, Inc.
4 4
diff --git a/lisp/nxml/nxml-uchnm.el b/lisp/nxml/nxml-uchnm.el
deleted file mode 100644
index 7d7d785f152..00000000000
--- a/lisp/nxml/nxml-uchnm.el
+++ /dev/null
@@ -1,251 +0,0 @@
1;;; nxml-uchnm.el --- support for Unicode standard cha names in nxml-mode
2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4
5;; Author: James Clark
6;; Keywords: wp, hypermedia, languages, XML
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;; This enables the use of the character names defined in the Unicode
26;; Standard. The use of the names can be controlled on a per-block
27;; basis, so as both to reduce memory usage and loading time,
28;; and to make completion work better.
29
30;;; Code:
31
32(require 'nxml-mode)
33
34(defconst nxml-unicode-blocks
35 '(("Basic Latin" #x0000 #x007F)
36 ("Latin-1 Supplement" #x0080 #x00FF)
37 ("Latin Extended-A" #x0100 #x017F)
38 ("Latin Extended-B" #x0180 #x024F)
39 ("IPA Extensions" #x0250 #x02AF)
40 ("Spacing Modifier Letters" #x02B0 #x02FF)
41 ("Combining Diacritical Marks" #x0300 #x036F)
42 ("Greek and Coptic" #x0370 #x03FF)
43 ("Cyrillic" #x0400 #x04FF)
44 ("Cyrillic Supplementary" #x0500 #x052F)
45 ("Armenian" #x0530 #x058F)
46 ("Hebrew" #x0590 #x05FF)
47 ("Arabic" #x0600 #x06FF)
48 ("Syriac" #x0700 #x074F)
49 ("Thaana" #x0780 #x07BF)
50 ("Devanagari" #x0900 #x097F)
51 ("Bengali" #x0980 #x09FF)
52 ("Gurmukhi" #x0A00 #x0A7F)
53 ("Gujarati" #x0A80 #x0AFF)
54 ("Oriya" #x0B00 #x0B7F)
55 ("Tamil" #x0B80 #x0BFF)
56 ("Telugu" #x0C00 #x0C7F)
57 ("Kannada" #x0C80 #x0CFF)
58 ("Malayalam" #x0D00 #x0D7F)
59 ("Sinhala" #x0D80 #x0DFF)
60 ("Thai" #x0E00 #x0E7F)
61 ("Lao" #x0E80 #x0EFF)
62 ("Tibetan" #x0F00 #x0FFF)
63 ("Myanmar" #x1000 #x109F)
64 ("Georgian" #x10A0 #x10FF)
65 ("Hangul Jamo" #x1100 #x11FF)
66 ("Ethiopic" #x1200 #x137F)
67 ("Cherokee" #x13A0 #x13FF)
68 ("Unified Canadian Aboriginal Syllabics" #x1400 #x167F)
69 ("Ogham" #x1680 #x169F)
70 ("Runic" #x16A0 #x16FF)
71 ("Tagalog" #x1700 #x171F)
72 ("Hanunoo" #x1720 #x173F)
73 ("Buhid" #x1740 #x175F)
74 ("Tagbanwa" #x1760 #x177F)
75 ("Khmer" #x1780 #x17FF)
76 ("Mongolian" #x1800 #x18AF)
77 ("Latin Extended Additional" #x1E00 #x1EFF)
78 ("Greek Extended" #x1F00 #x1FFF)
79 ("General Punctuation" #x2000 #x206F)
80 ("Superscripts and Subscripts" #x2070 #x209F)
81 ("Currency Symbols" #x20A0 #x20CF)
82 ("Combining Diacritical Marks for Symbols" #x20D0 #x20FF)
83 ("Letterlike Symbols" #x2100 #x214F)
84 ("Number Forms" #x2150 #x218F)
85 ("Arrows" #x2190 #x21FF)
86 ("Mathematical Operators" #x2200 #x22FF)
87 ("Miscellaneous Technical" #x2300 #x23FF)
88 ("Control Pictures" #x2400 #x243F)
89 ("Optical Character Recognition" #x2440 #x245F)
90 ("Enclosed Alphanumerics" #x2460 #x24FF)
91 ("Box Drawing" #x2500 #x257F)
92 ("Block Elements" #x2580 #x259F)
93 ("Geometric Shapes" #x25A0 #x25FF)
94 ("Miscellaneous Symbols" #x2600 #x26FF)
95 ("Dingbats" #x2700 #x27BF)
96 ("Miscellaneous Mathematical Symbols-A" #x27C0 #x27EF)
97 ("Supplemental Arrows-A" #x27F0 #x27FF)
98 ("Braille Patterns" #x2800 #x28FF)
99 ("Supplemental Arrows-B" #x2900 #x297F)
100 ("Miscellaneous Mathematical Symbols-B" #x2980 #x29FF)
101 ("Supplemental Mathematical Operators" #x2A00 #x2AFF)
102 ("CJK Radicals Supplement" #x2E80 #x2EFF)
103 ("Kangxi Radicals" #x2F00 #x2FDF)
104 ("Ideographic Description Characters" #x2FF0 #x2FFF)
105 ("CJK Symbols and Punctuation" #x3000 #x303F)
106 ("Hiragana" #x3040 #x309F)
107 ("Katakana" #x30A0 #x30FF)
108 ("Bopomofo" #x3100 #x312F)
109 ("Hangul Compatibility Jamo" #x3130 #x318F)
110 ("Kanbun" #x3190 #x319F)
111 ("Bopomofo Extended" #x31A0 #x31BF)
112 ("Katakana Phonetic Extensions" #x31F0 #x31FF)
113 ("Enclosed CJK Letters and Months" #x3200 #x32FF)
114 ("CJK Compatibility" #x3300 #x33FF)
115 ("CJK Unified Ideographs Extension A" #x3400 #x4DBF)
116 ;;("CJK Unified Ideographs" #x4E00 #x9FFF)
117 ("Yi Syllables" #xA000 #xA48F)
118 ("Yi Radicals" #xA490 #xA4CF)
119 ;;("Hangul Syllables" #xAC00 #xD7AF)
120 ;;("High Surrogates" #xD800 #xDB7F)
121 ;;("High Private Use Surrogates" #xDB80 #xDBFF)
122 ;;("Low Surrogates" #xDC00 #xDFFF)
123 ;;("Private Use Area" #xE000 #xF8FF)
124 ;;("CJK Compatibility Ideographs" #xF900 #xFAFF)
125 ("Alphabetic Presentation Forms" #xFB00 #xFB4F)
126 ("Arabic Presentation Forms-A" #xFB50 #xFDFF)
127 ("Variation Selectors" #xFE00 #xFE0F)
128 ("Combining Half Marks" #xFE20 #xFE2F)
129 ("CJK Compatibility Forms" #xFE30 #xFE4F)
130 ("Small Form Variants" #xFE50 #xFE6F)
131 ("Arabic Presentation Forms-B" #xFE70 #xFEFF)
132 ("Halfwidth and Fullwidth Forms" #xFF00 #xFFEF)
133 ("Specials" #xFFF0 #xFFFF)
134 ("Old Italic" #x10300 #x1032F)
135 ("Gothic" #x10330 #x1034F)
136 ("Deseret" #x10400 #x1044F)
137 ("Byzantine Musical Symbols" #x1D000 #x1D0FF)
138 ("Musical Symbols" #x1D100 #x1D1FF)
139 ("Mathematical Alphanumeric Symbols" #x1D400 #x1D7FF)
140 ;;("CJK Unified Ideographs Extension B" #x20000 #x2A6DF)
141 ;;("CJK Compatibility Ideographs Supplement" #x2F800 #x2FA1F)
142 ("Tags" #xE0000 #xE007F)
143 ;;("Supplementary Private Use Area-A" #xF0000 #xFFFFF)
144 ;;("Supplementary Private Use Area-B" #x100000 #x10FFFF)
145 )
146 "List of Unicode blocks.
147For each block there is a list (NAME FIRST LAST), where
148NAME is a string giving the official name of the block,
149FIRST is the first code-point and LAST is the last code-point.
150Blocks containing only characters with algorithmic names or no names
151are omitted.")
152
153(defun nxml-unicode-block-char-name-set (name)
154 "Return a symbol for a block whose official Unicode name is NAME.
155The symbol is generated by downcasing and replacing each space
156by a hyphen."
157 (intern (replace-regexp-in-string " " "-" (downcase name))))
158
159;; This is intended to be a superset of the coverage
160;; of existing standard entity sets.
161(defvar nxml-enabled-unicode-blocks-default
162 '(basic-latin
163 latin-1-supplement
164 latin-extended-a
165 latin-extended-b
166 ipa-extensions
167 spacing-modifier-letters
168 combining-diacritical-marks
169 greek-and-coptic
170 cyrillic
171 general-punctuation
172 superscripts-and-subscripts
173 currency-symbols
174 combining-diacritical-marks-for-symbols
175 letterlike-symbols
176 number-forms
177 arrows
178 mathematical-operators
179 miscellaneous-technical
180 control-pictures
181 optical-character-recognition
182 enclosed-alphanumerics
183 box-drawing
184 block-elements
185 geometric-shapes
186 miscellaneous-symbols
187 dingbats
188 miscellaneous-mathematical-symbols-a
189 supplemental-arrows-a
190 supplemental-arrows-b
191 miscellaneous-mathematical-symbols-b
192 supplemental-mathematical-operators
193 cjk-symbols-and-punctuation
194 alphabetic-presentation-forms
195 variation-selectors
196 small-form-variants
197 specials
198 mathematical-alphanumeric-symbols)
199 "Default value for `nxml-enabled-unicode-blocks'.")
200
201(mapc (lambda (block)
202 (nxml-autoload-char-name-set
203 (nxml-unicode-block-char-name-set (car block))
204 (expand-file-name
205 (format "nxml/%05X-%05X"
206 (nth 1 block)
207 (nth 2 block))
208 data-directory)))
209 nxml-unicode-blocks)
210
211;; Internal flag to control whether customize reloads the character tables.
212;; Should be set the first time the
213(defvar nxml-internal-unicode-char-name-sets-enabled nil)
214
215(defcustom nxml-enabled-unicode-blocks nxml-enabled-unicode-blocks-default
216 "List of Unicode blocks for which Unicode character names are enabled.
217Each block is identified by a symbol derived from the name
218of the block by downcasing and replacing each space by a hyphen."
219 :group 'nxml
220 :set (lambda (sym value)
221 (set-default 'nxml-enabled-unicode-blocks value)
222 (when nxml-internal-unicode-char-name-sets-enabled
223 (nxml-enable-unicode-char-name-sets)))
224 :type (cons 'set
225 (mapcar (lambda (block)
226 `(const :tag ,(format "%s (%04X-%04X)"
227 (nth 0 block)
228 (nth 1 block)
229 (nth 2 block))
230 ,(nxml-unicode-block-char-name-set
231 (nth 0 block))))
232 nxml-unicode-blocks)))
233
234;;;###autoload
235(defun nxml-enable-unicode-char-name-sets ()
236 "Enable the use of Unicode standard names for characters.
237The Unicode blocks for which names are enabled is controlled by
238the variable `nxml-enabled-unicode-blocks'."
239 (interactive)
240 (setq nxml-internal-unicode-char-name-sets-enabled t)
241 (mapc (lambda (block)
242 (nxml-disable-char-name-set
243 (nxml-unicode-block-char-name-set (car block))))
244 nxml-unicode-blocks)
245 (mapc (lambda (nameset)
246 (nxml-enable-char-name-set nameset))
247 nxml-enabled-unicode-blocks))
248
249(provide 'nxml-uchnm)
250
251;;; nxml-uchnm.el ends here
diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el
index 39aee9780ff..a699e9e3d96 100644
--- a/lisp/nxml/rng-cmpct.el
+++ b/lisp/nxml/rng-cmpct.el
@@ -1,4 +1,4 @@
1;;; rng-cmpct.el --- parsing of RELAX NG Compact Syntax schemas 1;;; rng-cmpct.el --- parsing of RELAX NG Compact Syntax schemas -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
diff --git a/lisp/nxml/rng-dt.el b/lisp/nxml/rng-dt.el
index 07166e38fea..a3cb8bc6aa5 100644
--- a/lisp/nxml/rng-dt.el
+++ b/lisp/nxml/rng-dt.el
@@ -1,4 +1,4 @@
1;;; rng-dt.el --- datatype library interface for RELAX NG 1;;; rng-dt.el --- datatype library interface for RELAX NG -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -57,7 +57,7 @@ a datatype library.")
57 (t 57 (t
58 (rng-dt-error "There is no built-in datatype %s" name)))) 58 (rng-dt-error "There is no built-in datatype %s" name))))
59 59
60(put (rng-make-datatypes-uri "") 'rng-dt-compile 'rng-dt-builtin-compile) 60(put (rng-make-datatypes-uri "") 'rng-dt-compile #'rng-dt-builtin-compile)
61 61
62(provide 'rng-dt) 62(provide 'rng-dt)
63 63
diff --git a/lisp/nxml/rng-loc.el b/lisp/nxml/rng-loc.el
index 553d8ca359d..376e9169d37 100644
--- a/lisp/nxml/rng-loc.el
+++ b/lisp/nxml/rng-loc.el
@@ -1,4 +1,4 @@
1;;; rng-loc.el --- locate the schema to use for validation 1;;; rng-loc.el --- Locate the schema to use for validation -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -31,10 +31,9 @@
31(require 'rng-util) 31(require 'rng-util)
32(require 'xmltok) 32(require 'xmltok)
33 33
34(defvar rng-current-schema-file-name nil 34(defvar-local rng-current-schema-file-name nil
35 "Filename of schema being used for current buffer. 35 "Filename of schema being used for current buffer.
36It is nil if using a vacuous schema.") 36It is nil if using a vacuous schema.")
37(make-variable-buffer-local 'rng-current-schema-file-name)
38 37
39(defvar rng-schema-locating-files-default 38(defvar rng-schema-locating-files-default
40 (list "schemas.xml" (expand-file-name "schema/schemas.xml" data-directory)) 39 (list "schemas.xml" (expand-file-name "schema/schemas.xml" data-directory))
@@ -233,11 +232,11 @@ or nil."
233 rules)))))))) 232 rules))))))))
234 best-so-far)) 233 best-so-far))
235 234
236(put 'documentElement 'rng-rule-matcher 'rng-match-document-element-rule) 235(put 'documentElement 'rng-rule-matcher #'rng-match-document-element-rule)
237(put 'namespace 'rng-rule-matcher 'rng-match-namespace-rule) 236(put 'namespace 'rng-rule-matcher #'rng-match-namespace-rule)
238(put 'uri 'rng-rule-matcher 'rng-match-uri-rule) 237(put 'uri 'rng-rule-matcher #'rng-match-uri-rule)
239(put 'transformURI 'rng-rule-matcher 'rng-match-transform-uri-rule) 238(put 'transformURI 'rng-rule-matcher #'rng-match-transform-uri-rule)
240(put 'default 'rng-rule-matcher 'rng-match-default-rule) 239(put 'default 'rng-rule-matcher #'rng-match-default-rule)
241 240
242(defun rng-match-document-element-rule (props) 241(defun rng-match-document-element-rule (props)
243 (let ((document-element (rng-document-element)) 242 (let ((document-element (rng-document-element))
diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el
index 165ca8930a4..32a041e0c17 100644
--- a/lisp/nxml/rng-maint.el
+++ b/lisp/nxml/rng-maint.el
@@ -1,4 +1,4 @@
1;;; rng-maint.el --- commands for RELAX NG maintainers 1;;; rng-maint.el --- commands for RELAX NG maintainers -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el
index df9c0192557..d2b629e8d83 100644
--- a/lisp/nxml/rng-match.el
+++ b/lisp/nxml/rng-match.el
@@ -56,9 +56,8 @@ Used to detect invalid recursive references.")
56;;; Inline functions 56;;; Inline functions
57 57
58(defsubst rng-update-match-state (new-state) 58(defsubst rng-update-match-state (new-state)
59 (if (and (eq new-state rng-not-allowed-ipattern) 59 (if (eq new-state rng-not-allowed-ipattern)
60 (not (eq rng-match-state rng-not-allowed-ipattern))) 60 (eq rng-match-state rng-not-allowed-ipattern)
61 nil
62 (setq rng-match-state new-state) 61 (setq rng-match-state new-state)
63 t)) 62 t))
64 63
diff --git a/lisp/nxml/rng-nxml.el b/lisp/nxml/rng-nxml.el
index fe90dffb555..85e4bf33ee0 100644
--- a/lisp/nxml/rng-nxml.el
+++ b/lisp/nxml/rng-nxml.el
@@ -1,4 +1,4 @@
1;;; rng-nxml.el --- make nxml-mode take advantage of rng-validate-mode 1;;; rng-nxml.el --- make nxml-mode take advantage of rng-validate-mode -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -349,7 +349,7 @@ Return non-nil if in a context it understands."
349 (recover-fun (funcall recover-fun prefix (cdr qname))))) 349 (recover-fun (funcall recover-fun prefix (cdr qname)))))
350 (cons (and defaultp (nxml-ns-get-default)) (cdr qname))))) 350 (cons (and defaultp (nxml-ns-get-default)) (cdr qname)))))
351 351
352(defun rng-start-tag-expand-recover (prefix local-name) 352(defun rng-start-tag-expand-recover (_prefix local-name)
353 (let ((ns (rng-match-infer-start-tag-namespace local-name))) 353 (let ((ns (rng-match-infer-start-tag-namespace local-name)))
354 (and ns 354 (and ns
355 (cons ns local-name)))) 355 (cons ns local-name))))
@@ -386,7 +386,7 @@ set `xmltok-dtd'. Returns the position of the end of the token."
386 (save-restriction 386 (save-restriction
387 (widen) 387 (widen)
388 (nxml-with-invisible-motion 388 (nxml-with-invisible-motion
389 (if (= pos 1) 389 (if (= pos (point-min))
390 (rng-set-initial-state) 390 (rng-set-initial-state)
391 (let ((state (get-text-property (1- pos) 'rng-state))) 391 (let ((state (get-text-property (1- pos) 'rng-state)))
392 (cond (state 392 (cond (state
diff --git a/lisp/nxml/rng-parse.el b/lisp/nxml/rng-parse.el
index cde749db672..3ae4b5cc9c4 100644
--- a/lisp/nxml/rng-parse.el
+++ b/lisp/nxml/rng-parse.el
@@ -1,4 +1,4 @@
1;;; rng-parse.el --- parse an XML file and validate it against a schema 1;;; rng-parse.el --- parse an XML file and validate it against a schema -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
diff --git a/lisp/nxml/rng-pttrn.el b/lisp/nxml/rng-pttrn.el
index f358d3c87d4..e847f5e02a8 100644
--- a/lisp/nxml/rng-pttrn.el
+++ b/lisp/nxml/rng-pttrn.el
@@ -1,4 +1,4 @@
1;;; rng-pttrn.el --- RELAX NG patterns 1;;; rng-pttrn.el --- RELAX NG patterns -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el
index 75cf23f888d..8fc0a01e293 100644
--- a/lisp/nxml/rng-uri.el
+++ b/lisp/nxml/rng-uri.el
@@ -1,4 +1,4 @@
1;;; rng-uri.el --- URI parsing and manipulation 1;;; rng-uri.el --- URI parsing and manipulation -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index 1020cad2089..9b0b4df67f8 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -1,4 +1,4 @@
1;;; rng-valid.el --- real-time validation of XML using RELAX NG 1;;; rng-valid.el --- real-time validation of XML using RELAX NG -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -430,13 +430,13 @@ The schema is set like `rng-auto-set-schema'."
430 (when (buffer-live-p buffer) ; bug#13999 430 (when (buffer-live-p buffer) ; bug#13999
431 (with-current-buffer buffer 431 (with-current-buffer buffer
432 (if rng-validate-mode 432 (if rng-validate-mode
433 (if (let ((rng-validate-display-point (point)) 433 (if (let ((rng-validate-display-point (point))
434 (rng-validate-display-modified-p (buffer-modified-p))) 434 (rng-validate-display-modified-p (buffer-modified-p)))
435 (rng-do-some-validation 'rng-validate-while-idle-continue-p)) 435 (rng-do-some-validation 'rng-validate-while-idle-continue-p))
436 (force-mode-line-update) 436 (force-mode-line-update)
437 (rng-validate-done)) 437 (rng-validate-done))
438 ;; must have done kill-all-local-variables 438 ;; Must have done kill-all-local-variables.
439 (rng-kill-timers))))) 439 (rng-kill-timers)))))
440 440
441(defun rng-validate-quick-while-idle (buffer) 441(defun rng-validate-quick-while-idle (buffer)
442 (when (buffer-live-p buffer) ; bug#13999 442 (when (buffer-live-p buffer) ; bug#13999
@@ -709,7 +709,7 @@ Return t if there is work to do, nil otherwise."
709 709
710;; If we don't do this, then the front delimiter can move 710;; If we don't do this, then the front delimiter can move
711;; past the end delimiter. 711;; past the end delimiter.
712(defun rng-error-modified (overlay after-p beg end &optional pre-change-len) 712(defun rng-error-modified (overlay after-p _beg _end &optional _pre-change-len)
713 (when (and after-p 713 (when (and after-p
714 (overlay-start overlay) ; check not deleted 714 (overlay-start overlay) ; check not deleted
715 (>= (overlay-start overlay) 715 (>= (overlay-start overlay)
diff --git a/lisp/nxml/rng-xsd.el b/lisp/nxml/rng-xsd.el
index 378319851a0..c0989ae1073 100644
--- a/lisp/nxml/rng-xsd.el
+++ b/lisp/nxml/rng-xsd.el
@@ -1,4 +1,4 @@
1;;; rng-xsd.el --- W3C XML Schema datatypes library for RELAX NG 1;;; rng-xsd.el --- W3C XML Schema datatypes library for RELAX NG -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -42,7 +42,7 @@
42;;;###autoload 42;;;###autoload
43(put 'http://www.w3.org/2001/XMLSchema-datatypes 43(put 'http://www.w3.org/2001/XMLSchema-datatypes
44 'rng-dt-compile 44 'rng-dt-compile
45 'rng-xsd-compile) 45 #'rng-xsd-compile)
46 46
47;;;###autoload 47;;;###autoload
48(defun rng-xsd-compile (name params) 48(defun rng-xsd-compile (name params)
@@ -50,9 +50,9 @@
50NAME is a symbol giving the local name of the datatype. PARAMS is a 50NAME is a symbol giving the local name of the datatype. PARAMS is a
51list of pairs (PARAM-NAME . PARAM-VALUE) where PARAM-NAME is a symbol 51list of pairs (PARAM-NAME . PARAM-VALUE) where PARAM-NAME is a symbol
52giving the name of the parameter and PARAM-VALUE is a string giving 52giving the name of the parameter and PARAM-VALUE is a string giving
53its value. If NAME or PARAMS are invalid, it calls rng-dt-error 53its value. If NAME or PARAMS are invalid, it calls `rng-dt-error'
54passing it arguments in the same style as format; the value from 54passing it arguments in the same style as format; the value from
55rng-dt-error will be returned. Otherwise, it returns a list. The 55`rng-dt-error' will be returned. Otherwise, it returns a list. The
56first member of the list is t if any string is a legal value for the 56first member of the list is t if any string is a legal value for the
57datatype and nil otherwise. The second argument is a symbol; this 57datatype and nil otherwise. The second argument is a symbol; this
58symbol will be called as a function passing it a string followed by 58symbol will be called as a function passing it a string followed by
diff --git a/lisp/nxml/xsd-regexp.el b/lisp/nxml/xsd-regexp.el
index e91e6b77a7d..a3f476d00be 100644
--- a/lisp/nxml/xsd-regexp.el
+++ b/lisp/nxml/xsd-regexp.el
@@ -1,4 +1,4 @@
1;;; xsd-regexp.el --- translate W3C XML Schema regexps to Emacs regexps 1;;; xsd-regexp.el --- translate W3C XML Schema regexps to Emacs regexps -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc. 3;; Copyright (C) 2003, 2007-2016 Free Software Foundation, Inc.
4 4
@@ -147,7 +147,7 @@ ranges are merged wherever possible."
147(defun xsdre-range-list-difference (orig subtract) 147(defun xsdre-range-list-difference (orig subtract)
148 "Return a range-list for the difference of two range-lists." 148 "Return a range-list for the difference of two range-lists."
149 (when orig 149 (when orig
150 (let (new head next first last) 150 (let (new head first last)
151 (while orig 151 (while orig
152 (setq head (car orig)) 152 (setq head (car orig))
153 (setq first (xsdre-range-first head)) 153 (setq first (xsdre-range-first head))
@@ -745,7 +745,7 @@ Code is inserted into the current buffer."
745 (save-excursion 745 (save-excursion
746 (goto-char start) 746 (goto-char start)
747 (down-list 2) 747 (down-list 2)
748 (while (condition-case err 748 (while (condition-case nil
749 (progn 749 (progn
750 (forward-sexp) 750 (forward-sexp)
751 t) 751 t)