1- ; ;; json-mode.el --- Major mode for editing JSON files.
1+ ; ;; json-mode.el --- Major mode for editing JSON files
22
33; ; Copyright (C) 2011-2014 Josh Johnston
44
3030(require 'rx )
3131(require 'json-snatcher )
3232
33- (defgroup json-mode '()
33+ (defgroup json '()
3434 " Major mode for editing JSON files."
3535 :group 'js )
3636
@@ -63,16 +63,14 @@ Return the new `auto-mode-alist' entry"
6363(defvar json-mode--auto-mode-entry )
6464
6565;;;### autoload
66- (defcustom json-mode-auto-mode-list '(
67- " .babelrc"
66+ (defcustom json-mode-auto-mode-list '(" .babelrc"
6867 " .bowerrc"
69- " composer.lock"
70- )
68+ " composer.lock" )
7169 " List of filenames for the JSON entry of `auto-mode-alist' .
7270
7371Note however that custom `json-mode' entries in `auto-mode-alist'
7472won’t be affected."
75- :group 'json-mode
73+ :group 'json
7674 :type '(repeat string)
7775 :set (lambda (symbol value )
7876 " Update SYMBOL with a new regexp made from VALUE.
@@ -153,17 +151,18 @@ json font lock syntactic face function."
153151
154152;;;### autoload
155153(define-derived-mode json-mode javascript-mode " JSON"
156- " Major mode for editing JSON files"
154+ " Major mode for editing JSON files. "
157155 :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))))
162160
163161;;;### autoload
164162(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. "
166164 :syntax-table jsonc-mode-syntax-table)
165+ (setq font-lock-defaults '(json-font-lock-keywords-1 t ))
167166
168167; ; Well formatted JSON files almost always begin with “{” or “[”.
169168;;;### autoload
@@ -181,13 +180,13 @@ json font lock syntactic face function."
181180(defun json-mode-kill-path ()
182181 " Save JSON path to object at point to kill ring."
183182 (interactive )
184- (kill-new (jsons-print-path)))
183+ (kill-new (jsons-print-path)))
185184
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 )
187186
188187;;;### autoload
189188(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)."
191190 (interactive " r" )
192191 (unless (use-region-p )
193192 (setq begin (point-min )
0 commit comments