-
Notifications
You must be signed in to change notification settings - Fork 1
/
fontfile-ufo-mode.el
62 lines (51 loc) · 1.23 KB
/
fontfile-ufo-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;;
;; fontfile-ufo-mode
;;
;; An Emacs major mode for editing UFO .glif files
;;
;; Author: Nathan Willis
;; nwillis@glyphography.com
;;
;; License: GNU GPL v3 or later
;;
;;
;; Notes:
;;
;; - Defined to follow the UFO spec from
;;
;;
;;
;; Top-level setup
;;
(require 'nxml-mode)
(push "~/.emacs.d/emacs-fontmodes/schemas/ufo-schemas.xml" rng-schema-locating-files)
(push (cons (concat "\\." (regexp-opt '("glif") t)
"\\'") 'nxml-mode) auto-mode-alist)
;;
;; Folding elements
;;
(require 'hideshow)
(require 'sgml-mode)
(require 'nxml-mode)
(add-to-list 'hs-special-modes-alist
'(nxml-mode
"<!--\\|<[^/>]*[^/]>"
"-->\\|</[^/>]*[^/]>"
"<!--"
sgml-skip-tag-forward
nil))
(add-hook 'nxml-mode-hook 'hs-minor-mode)
;; optional key bindings, easier than hs defaults
(define-key nxml-mode-map (kbd "C-c h") 'hs-toggle-hiding)
;;
;; Entry point
;;
(define-derived-mode fontfile-ufo-mode nxml-mode "UFO glyphs"
"Major mode for editing Unified Font Object glyph files."
:syntax-table fontfile-ufo-syntax-table
;; (setq font-lock-defaults fontfile-ufo-font-lock-defaults)
)
;;
;; Boom goes the dynamite
;;
(provide 'fontfile-ufo-mode)