1 ;;; nxml-maint.el --- commands for maintainers of nxml-*.el -*- lexical-binding:t -*-
3 ;; Copyright (C) 2003, 2007-2017 Free Software Foundation, Inc.
6 ;; Keywords: wp, hypermedia, languages, XML
8 ;; This file is part of GNU Emacs.
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.
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.
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/>.
27 ;;; Parsing target repertoire files from ucs-fonts.
28 ;; This is for converting the TARGET? files in
29 ;; http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz
32 (defun nxml-insert-target-repertoire-glyph-set (file var
)
33 (interactive "fTarget file: \nSVariable name: ")
35 (with-current-buffer (find-file-noselect file
)
36 (goto-char (point-min))
37 (while (re-search-forward "^ *\\([a-FA-F0-9]\\{2\\}\\)[ \t]+" nil t
)
38 (let ((row (match-string 1))
39 (eol (line-end-position)))
40 (while (re-search-forward "\\([a-FA-F0-9]\\{2\\}\\)-\\([a-FA-F0-9]\\{2\\}\\)\\|\\([a-FA-F0-9]\\{2\\}\\)" eol t
)
42 (cons (if (match-beginning 3)
43 (concat "#x" row
(match-string 3))
44 (concat "(#x" row
(match-string 1)
45 " . #x" row
(match-string 2) ")"))
47 (setq lst
(nreverse lst
))
48 (insert (format "(defconst %s\n [" var
))
53 (when (= (length head
) 6)
54 (while (and lst
(= (length (car lst
)) 6))
57 (setq lst
(cdr lst
))))
58 (when lst
(insert "\n ")))
63 ;;; nxml-maint.el ends here