From d71342f413ffc9dee4cce533058e3fd123095a2e Mon Sep 17 00:00:00 2001 From: Chris Zheng Date: Fri, 8 Jun 2018 18:52:22 +0800 Subject: [Fix #2310] Add cider-format-edn-last-sexp (#2311) --- CHANGELOG.md | 1 + cider-interaction.el | 5 +++++ cider-mode.el | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcc9b156..9aedfc17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bugs fixed +* [#2310](https://github.com/clojure-emacs/cider/issues/2310): `cider-format-edn-last-sexp` will format the last sexp. * [#2294](https://github.com/clojure-emacs/cider/issues/2294): Fix setting default stacktrace filters. * [#2286](https://github.com/clojure-emacs/cider/issues/2286): Fix eldoc issue with images in the REPL. * [#2307](https://github.com/clojure-emacs/cider/pull/2307): Use a better error when a cljs repl form cannot be found. diff --git a/cider-interaction.el b/cider-interaction.el index 962bcd1d..e0f3f1af 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -1981,6 +1981,11 @@ START and END represent the region's boundaries." (lambda (edn) (cider-sync-request:format-edn edn right-margin))))) +(defun cider-format-edn-last-sexp () + "Format the EDN data of the last sexp." + (interactive) + (apply 'cider-format-edn-region (cider-sexp-at-point 'bounds))) + ;;; Interrupt evaluation diff --git a/cider-mode.el b/cider-mode.el index 10471619..5c7407eb 100644 --- a/cider-mode.el +++ b/cider-mode.el @@ -290,6 +290,10 @@ Configure `cider-cljs-repl-types' to change the ClojureScript REPL to use for yo ["Browse REPL input history" cider-repl-history] ["Browse classpath" cider-classpath] ["Browse classpath entry" cider-open-classpath-entry]) + ("Format" + ["Format EDN last sexp" cider-format-edn-last-sexp] + ["Format EDN region" cider-format-edn-region] + ["Format EDN buffer" cider-format-edn-buffer]) ("Macroexpand" ["Macroexpand-1" cider-macroexpand-1] ["Macroexpand-all" cider-macroexpand-all]) -- cgit v1.2.3