From: Andreas Gerler Date: Fri, 26 Feb 2016 13:06:38 +0000 (+0100) Subject: adding beautify-json X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=289babe14bacfda0a936cea711df9a86a7560ecc;p=emacsconfig.git adding beautify-json --- diff --git a/bba.org b/bba.org index 744e5f53..989fb692 100644 --- a/bba.org +++ b/bba.org @@ -2307,6 +2307,18 @@ we use that as default: (global-set-key (kbd "C-M-r") 'isearch-backward) #+END_SRC +* Beautifying JSON + +#+BEGIN_SRC emacs-lisp + (defun beautify-json () + "Use python to prettyprint JSON." + (interactive) + (let ((b (if mark-active (min (point) (mark)) (point-min))) + (e (if mark-active (max (point) (mark)) (point-max)))) + (shell-command-on-region b e + "python -mjson.tool" (current-buffer) t))) +#+END_SRC + * configure some default values [2014-10-02 Thu 00:27]