diff options
author | Oleg Pykhalov <go.wigust@gmail.com> | 2017-12-12 01:41:08 +0300 |
---|---|---|
committer | Oleg Pykhalov <go.wigust@gmail.com> | 2018-01-15 14:42:55 +0300 |
commit | b0912e9fdbffab15d9a754b2922778cfbd1fac2a (patch) | |
tree | 1fba2abcca4e81cc86dc21d6ae009d627518247c | |
parent | 15eef66e5d7e82a467dd7fbf2e72f7d1fcd6c26f (diff) | |
download | patches-b0912e9fdbffab15d9a754b2922778cfbd1fac2a.tar patches-b0912e9fdbffab15d9a754b2922778cfbd1fac2a.tar.gz |
gnu: Add emacs-json-reformat.
* gnu/packages/patches/emacs-json-reformat-fix-tests.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add this.
* gnu/packages/emacs.scm (emacs-json-reformat): New variable.
-rw-r--r-- | gnu/local.mk | 2 | ||||
-rw-r--r-- | gnu/packages/emacs.scm | 49 | ||||
-rw-r--r-- | gnu/packages/patches/emacs-json-reformat-fix-tests.patch | 32 |
3 files changed, 82 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 6af8bfc4bd..fb4babfdbc 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -17,6 +17,7 @@ # Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> # Copyright © 2017 Gábor Boskovits <boskovits@gmail.com> # Copyright © 2018 Amirouche Boubekki <amirouche@hypermove.net> +# Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> # # This file is part of GNU Guix. # @@ -615,6 +616,7 @@ dist_patch_DATA = \ %D%/packages/patches/einstein-build.patch \ %D%/packages/patches/emacs-exec-path.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \ + %D%/packages/patches/emacs-json-reformat-fix-tests.patch \ %D%/packages/patches/emacs-highlight-stages-add-gexp.patch \ %D%/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch \ %D%/packages/patches/emacs-source-date-epoch.patch \ diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index f83e2fb890..0ae44d52bc 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -26,7 +26,7 @@ ;;; Copyright © 2017 George Clemmer <myglc2@gmail.com> ;;; Copyright © 2017 Feng Shu <tumashu@163.com> ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org> -;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com> +;;; Copyright © 2017, 2018 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2017 Mekeor Melire <mekeor.melire@gmail.com> ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com> ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> @@ -5950,6 +5950,53 @@ pair of minor modes which suppress all mouse events by intercepting them and running a customisable handler command (@code{ignore} by default). ") (license license:gpl3+))) +(define-public emacs-json-reformat + (package + (name "emacs-json-reformat") + (version "0.0.6") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/gongo/json-reformat/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "11fbq4scrgr7m0iwnzcrn2g7xvqwm2gf82sa7zy1l0nil7265p28")) + (patches (search-patches "emacs-json-reformat-fix-tests.patch")))) + (build-system emacs-build-system) + (propagated-inputs `(("emacs-undercover" ,emacs-undercover))) + (inputs + `(("emacs-dash" ,emacs-dash) ; for tests + ("emacs-shut-up" ,emacs-shut-up))) ; for tests + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'install 'check + (lambda* (#:key inputs #:allow-other-keys) + (zero? (system* "emacs" "--batch" "-L" "." + "-L" (string-append + (assoc-ref inputs "emacs-undercover") + "/share/emacs/site-lisp/guix.d/undercover-" + ,(package-version emacs-undercover)) + "-L" (string-append + (assoc-ref inputs "emacs-dash") + "/share/emacs/site-lisp/guix.d/dash-" + ,(package-version emacs-dash)) + "-L" (string-append + (assoc-ref inputs "emacs-shut-up") + "/share/emacs/site-lisp/guix.d/shut-up-" + ,(package-version emacs-shut-up)) + "-l" "test/test-helper.el" + "-l" "test/json-reformat-test.el" + "-f" "ert-run-tests-batch-and-exit")) + #t))))) + (home-page "https://github.com/gongo/json-reformat") + (synopsis "Reformatting tool for JSON") + (description "@code{json-reformat} provides a reformatting tool for +@url{http://json.org/, JSON}.") + (license license:gpl3+))) + (define-public emacs-json-snatcher (package (name "emacs-json-snatcher") diff --git a/gnu/packages/patches/emacs-json-reformat-fix-tests.patch b/gnu/packages/patches/emacs-json-reformat-fix-tests.patch new file mode 100644 index 0000000000..977e50fc68 --- /dev/null +++ b/gnu/packages/patches/emacs-json-reformat-fix-tests.patch @@ -0,0 +1,32 @@ +Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com> + +This patch fixes tests for Emacs 25. + +Upstream bug URL: + +https://github.com/gongo/json-reformat/issues/33 + +diff --git a/test/json-reformat-test.el b/test/json-reformat-test.el +index 7de3be1..b4a4dde 100644 +--- a/test/json-reformat-test.el ++++ b/test/json-reformat-test.el +@@ -58,7 +58,7 @@ + (ert-deftest json-reformat-test:string-to-string () + (should (string= "\"foobar\"" (json-reformat:string-to-string "foobar"))) + (should (string= "\"fo\\\"o\\nbar\"" (json-reformat:string-to-string "fo\"o\nbar"))) +- (should (string= "\"\\u2661\"" (json-reformat:string-to-string "\u2661"))) ++ (should (string= "\"♡\"" (json-reformat:string-to-string "\u2661"))) + + (should (string= "\"^(amq\\\\.gen.*|amq\\\\.default)$\"" (json-reformat:string-to-string "^(amq\\.gen.*|amq\\.default)$"))) + ) +@@ -148,6 +148,6 @@ bar\"" (json-reformat:string-to-string "fo\"o\nbar"))) + [{ foo : \"bar\" }, { \"foo\" : \"baz\" }]") ;; At 3 (line) + (json-reformat-region (point-min) (point-max))) + (should (string= +- "JSON parse error [Reason] Bad string format: \"doesn't start with '\\\"'!\" [Position] In buffer, line 3 (char 6)" ++ "JSON parse error [Reason] Bad string format: \"doesn't start with \`\\\"'!\" [Position] In buffer, line 3 (char 6)" + message-string)) + ))) +-- +2.15.1 + |