File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 5
5
; ; Author: Josh Johnston
6
6
; ; URL: https://github.com/joshwnj/json-mode
7
7
; ; Version: 1.6.0
8
- ; ; Package-Requires: ((json-reformat "0 .0.5 ") (json-snatcher "1.0.0 "))
8
+ ; ; Package-Requires: ((json-snatcher "1 .0.0 ") (emacs "24.4 "))
9
9
10
10
; ; This program is free software; you can redistribute it and/or modify
11
11
; ; it under the terms of the GNU General Public License as published by
29
29
(require 'js )
30
30
(require 'rx )
31
31
(require 'json-snatcher )
32
- (require 'json-reformat )
33
32
34
33
(defgroup json-mode '()
35
34
" Major mode for editing JSON files."
@@ -184,14 +183,13 @@ json font lock syntactic face function."
184
183
(define-key json-mode-map (kbd " C-c P" ) 'json-mode-kill-path )
185
184
186
185
;;;### autoload
187
- (defun json-mode-beautify ()
186
+ (defun json-mode-beautify (begin end )
188
187
" Beautify / pretty-print the active region (or the entire buffer if no active region)."
189
- (interactive )
190
- (let ((json-reformat:indent-width js-indent-level)
191
- (json-reformat:pretty-string? t ))
192
- (if (use-region-p )
193
- (json-reformat-region (region-beginning ) (region-end ))
194
- (json-reformat-region (buffer-end -1 ) (buffer-end 1 )))))
188
+ (interactive " r" )
189
+ (unless (use-region-p )
190
+ (setq begin (point-min )
191
+ end (point-max )))
192
+ (json-pretty-print begin end))
195
193
196
194
(define-key json-mode-map (kbd " C-c C-f" ) 'json-mode-beautify )
197
195
You can’t perform that action at this time.
0 commit comments