From 09b0e594bcd48f8b1918bd848bddb3332832bcf7 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Sun, 25 Aug 2013 08:26:44 -0400 Subject: [PATCH] add json-mode --- emacs | 4 ++ .../json-mode-0.1.2/json-mode-autoloads.el | 29 ++++++++++++ emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.el | 1 + .../elpa/json-mode-0.1.2/json-mode-pkg.elc | Bin 0 -> 632 bytes emacs.d/elpa/json-mode-0.1.2/json-mode.el | 44 ++++++++++++++++++ emacs.d/elpa/json-mode-0.1.2/json-mode.elc | Bin 0 -> 3843 bytes 6 files changed, 78 insertions(+) create mode 100644 emacs.d/elpa/json-mode-0.1.2/json-mode-autoloads.el create mode 100644 emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.el create mode 100644 emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.elc create mode 100644 emacs.d/elpa/json-mode-0.1.2/json-mode.el create mode 100644 emacs.d/elpa/json-mode-0.1.2/json-mode.elc diff --git a/emacs b/emacs index daceb98..fcf4c23 100644 --- a/emacs +++ b/emacs @@ -52,6 +52,10 @@ '(lambda () (add-hook 'before-save-hook 'gofmt))) +;js-mode overwrites json-mode when loading .json files, so this is +; to force json-mode for .json files +(add-to-list 'auto-mode-alist '("\\.json$" . json-mode)) + ;solarize ALL the things (color-theme-initialize) (color-theme-clarity) diff --git a/emacs.d/elpa/json-mode-0.1.2/json-mode-autoloads.el b/emacs.d/elpa/json-mode-0.1.2/json-mode-autoloads.el new file mode 100644 index 0000000..f04c8a9 --- /dev/null +++ b/emacs.d/elpa/json-mode-0.1.2/json-mode-autoloads.el @@ -0,0 +1,29 @@ +;;; json-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads (json-mode) "json-mode" "json-mode.el" (21017 62178 +;;;;;; 0 0)) +;;; Generated autoloads from json-mode.el + +(autoload 'json-mode "json-mode" "\ +Major mode for editing JSON files + +\(fn)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("json-mode-pkg.el") (21017 62178 965022 +;;;;;; 0)) + +;;;*** + +(provide 'json-mode-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; json-mode-autoloads.el ends here diff --git a/emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.el b/emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.el new file mode 100644 index 0000000..c5e500b --- /dev/null +++ b/emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.el @@ -0,0 +1 @@ +(define-package "json-mode" "0.1.2" "Major mode for editing JSON files" (quote nil)) diff --git a/emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.elc b/emacs.d/elpa/json-mode-0.1.2/json-mode-pkg.elc new file mode 100644 index 0000000000000000000000000000000000000000..3e29f56bce8f6030bd169c98a25cb056be111a3d GIT binary patch literal 632 zcmbtRO>e?54CUNEu&dS6CeaiMNPJudhy&BuCb9hhlcXh(##NGTV!wWAnGn;C_>wrb z-+S?!t)7>6olYm3&1SHqvQk%~n#3g=@@9!?;;4ZPY-@2!;4Ag+vR!t8$6JO#zn}(MGED^a^Y$F`qFOS#bA_vh<*SEW4?R< literal 0 HcmV?d00001 diff --git a/emacs.d/elpa/json-mode-0.1.2/json-mode.el b/emacs.d/elpa/json-mode-0.1.2/json-mode.el new file mode 100644 index 0000000..f0a991d --- /dev/null +++ b/emacs.d/elpa/json-mode-0.1.2/json-mode.el @@ -0,0 +1,44 @@ +;;; json-mode.el --- Major mode for editing JSON files +;;; Author: Josh Johnston +;;; URL: https://github.com/joshwnj/json-mode +;;; Version: 0.1.2 + +;;;; +;; extend javascript-mode's syntax highlighting + +(defvar json-mode-hook nil) + +(defconst json-quoted-key-re "\\(\"[^\"]+?\"[ ]*:\\)") +(defconst json-quoted-string-re "\\(\".*?\"\\)") +(defconst json-number-re "[^\"]\\([0-9]+\\(\\.[0-9]+\\)?\\)[^\"]") +(defconst json-keyword-re "\\(true\\|false\\|null\\)") + +(defconst json-font-lock-keywords-1 + (list + (list json-quoted-key-re 1 font-lock-keyword-face) + (list json-quoted-string-re 1 font-lock-string-face) + (list json-keyword-re 1 font-lock-constant-face) + (list json-number-re 1 font-lock-constant-face) + ) + "Level one font lock.") + +(defun beautify-json () + (interactive) + (let ((b (if mark-active (min (point) (mark)) (point-min))) + (e (if mark-active (max (point) (mark)) (point-max)))) + ;; Beautify json with support for non-ascii characters. + ;; Thanks to https://github.com/jarl-dk for this improvement. + (shell-command-on-region b e + "python -c 'import sys,json; data=json.loads(sys.stdin.read()); print json.dumps(data,sort_keys=True,indent=4).decode(\"unicode_escape\").encode(\"utf8\",\"replace\")'" (current-buffer) t))) + +;;;###autoload +(define-derived-mode json-mode javascript-mode "JSON" + "Major mode for editing JSON files" + (set (make-local-variable 'font-lock-defaults) '(json-font-lock-keywords-1 t))) + +(add-to-list 'auto-mode-alist '("\\.json$" . json-mode)) + +(define-key json-mode-map (kbd "C-c C-f") 'beautify-json) + +(provide 'json-mode) +;;; json-mode.el ends here diff --git a/emacs.d/elpa/json-mode-0.1.2/json-mode.elc b/emacs.d/elpa/json-mode-0.1.2/json-mode.elc new file mode 100644 index 0000000000000000000000000000000000000000..a7ba3a263c85b19f0c306f78724e3063c6b49e32 GIT binary patch literal 3843 zcmcgv>u=md5I+eC=tYeLANoQqQ@1F0ZS44QxwH*cUkaj73Q`JR;u>QzSHS+x3{zp3chvaXPd+UxnxU)GR-}M5+aa5 zRiY;(QfO4_Bujo38U)Jen$2gEL^WE}N-Bz{xyX`;;v!PIO7cUsj@?RW5^;>%pUClU zJO1rAc*F&GQ+wH}2d@L%O`)Gndpgc+YW)G%-`ONOmb)jW! zAIYg*NwUJQ7g~GILu>!$J-pEVjXPo3x88QFamf6na|5SNJ&@PgNLGf@u!o>M*S@`f zlO={u``*8Y(}v(pnb7f7QN^t^UDYxSe;CxG_3% zK7al4yk+wi-=BFa+oRrSs-+zvvdQ{54BX+FoiOL;%1$`u=h>arkDBLKq3>>4w0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