|
1 | 1 | ;;; json-mode.el --- Major mode for editing JSON files |
2 | 2 | ;;; Author: Josh Johnston |
3 | 3 | ;;; URL: https://github.com/joshwnj/json-mode |
4 | | -;;; Version: 0.1.2 |
| 4 | +;;; Version: 1.0.0 |
5 | 5 |
|
6 | 6 | ;;;; |
7 | 7 | ;; extend javascript-mode's syntax highlighting |
8 | 8 |
|
9 | 9 | (defvar json-mode-hook nil) |
10 | 10 |
|
11 | 11 | (defconst json-quoted-key-re "\\(\"[^\"]+?\"[ ]*:\\)") |
12 | | -(defconst json-quoted-string-re "\\(\".*?\"\\)") |
| 12 | +(defconst json-quoted-string-re "\\(\".*?\"\\)") |
13 | 13 | (defconst json-number-re "[^\"]\\([0-9]+\\(\\.[0-9]+\\)?\\)[^\"]") |
14 | 14 | (defconst json-keyword-re "\\(true\\|false\\|null\\)") |
15 | 15 |
|
16 | 16 | (defconst json-font-lock-keywords-1 |
17 | | - (list |
| 17 | + (list |
18 | 18 | (list json-quoted-key-re 1 font-lock-keyword-face) |
19 | 19 | (list json-quoted-string-re 1 font-lock-string-face) |
20 | 20 | (list json-keyword-re 1 font-lock-constant-face) |
|
29 | 29 | ;; Beautify json with support for non-ascii characters. |
30 | 30 | ;; Thanks to https://github.com/jarl-dk for this improvement. |
31 | 31 | (shell-command-on-region b e |
32 | | - (concat (if (executable-find "env") "env " "") |
33 | | - (concat (if (executable-find "python2") "python2" "python") |
34 | | - " -c 'import sys,json; data=json.loads(sys.stdin.read()); print json.dumps(data,sort_keys=True,indent=4).decode(\"unicode_escape\").encode(\"utf8\",\"replace\")'")) |
35 | | - (current-buffer) t))) |
| 32 | + (concat (if (executable-find "env") "env " "") |
| 33 | + (concat (if (executable-find "python2") "python2" "python") |
| 34 | + " -c 'import sys,json; data=json.loads(sys.stdin.read()); print json.dumps(data,sort_keys=True,indent=4).decode(\"unicode_escape\").encode(\"utf8\",\"replace\")'")) |
| 35 | + (current-buffer) t))) |
36 | 36 |
|
37 | 37 | ;;;###autoload |
38 | 38 | (define-derived-mode json-mode javascript-mode "JSON" |
|
0 commit comments