diff --git a/emacs/init.org b/emacs/init.org index 6c1ffbc..3e6bcab 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1469,13 +1469,15 @@ Some aliases: json-navigator-navigate-after-point json-navigator-navigate-region)) - (defun jq-pretty-print () + (defun json-pprint () (interactive) (let ((begin (if (region-active-p) (region-beginning) (point-min))) (end (if (region-active-p) (region-end) (point-max)))) - (shell-command-on-region begin end "jq ." nil t))) + (if (executable-find "jq") + (shell-command-on-region begin end "jq ." nil t) + (json-pretty-print begin end)))) - (general-def json-mode-map "C-M-\\" 'jq-pretty-print) + (general-def json-mode-map "C-M-\\" 'json-pprint) #+END_SRC * JavaScript