1
- ; ;; json-mode.el --- Major mode for editing JSON files.
1
+ ; ;; json-mode.el --- Major mode for editing JSON files
2
2
3
3
; ; Copyright (C) 2011-2014 Josh Johnston
4
4
30
30
(require 'rx )
31
31
(require 'json-snatcher )
32
32
33
- (defgroup json-mode '()
33
+ (defgroup json '()
34
34
" Major mode for editing JSON files."
35
35
:group 'js )
36
36
@@ -63,16 +63,14 @@ Return the new `auto-mode-alist' entry"
63
63
(defvar json-mode--auto-mode-entry )
64
64
65
65
;;;### autoload
66
- (defcustom json-mode-auto-mode-list '(
67
- " .babelrc"
66
+ (defcustom json-mode-auto-mode-list '(" .babelrc"
68
67
" .bowerrc"
69
- " composer.lock"
70
- )
68
+ " composer.lock" )
71
69
" List of filenames for the JSON entry of `auto-mode-alist' .
72
70
73
71
Note however that custom `json-mode' entries in `auto-mode-alist'
74
72
won’t be affected."
75
- :group 'json-mode
73
+ :group 'json
76
74
:type '(repeat string)
77
75
:set (lambda (symbol value )
78
76
" Update SYMBOL with a new regexp made from VALUE.
@@ -153,17 +151,18 @@ json font lock syntactic face function."
153
151
154
152
;;;### autoload
155
153
(define-derived-mode json-mode javascript-mode " JSON"
156
- " Major mode for editing JSON files"
154
+ " Major mode for editing JSON files. "
157
155
:syntax-table json-mode-syntax-table
158
- (set ( make-local-variable ' font-lock-defaults)
159
- '(json-font-lock-keywords-1
160
- nil nil nil nil
161
- (font-lock-syntactic-face-function . json-mode--syntactic-face))))
156
+ (setq font-lock-defaults
157
+ '(json-font-lock-keywords-1
158
+ nil nil nil nil
159
+ (font-lock-syntactic-face-function . json-mode--syntactic-face))))
162
160
163
161
;;;### autoload
164
162
(define-derived-mode jsonc-mode json-mode " JSONC"
165
- " Major mode for editing JSON files with comments"
163
+ " Major mode for editing JSON files with comments. "
166
164
:syntax-table jsonc-mode-syntax-table)
165
+ (setq font-lock-defaults '(json-font-lock-keywords-1 t ))
167
166
168
167
; ; Well formatted JSON files almost always begin with “{” or “[”.
169
168
;;;### autoload
@@ -181,13 +180,13 @@ json font lock syntactic face function."
181
180
(defun json-mode-kill-path ()
182
181
" Save JSON path to object at point to kill ring."
183
182
(interactive )
184
- (kill-new (jsons-print-path)))
183
+ (kill-new (jsons-print-path)))
185
184
186
- (define-key json-mode-map (kbd " C-c P " ) 'json-mode-kill-path )
185
+ (define-key json-mode-map (kbd " C-c C-k " ) 'json-mode-kill-path )
187
186
188
187
;;;### autoload
189
188
(defun json-mode-beautify (begin end )
190
- " Beautify / pretty-print the active region (or the entire buffer if no active region)."
189
+ " Beautify/ pretty-print from BEGIN to END (or the entire buffer if no active region)."
191
190
(interactive " r" )
192
191
(unless (use-region-p )
193
192
(setq begin (point-min )
0 commit comments