summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Zheng <zcaudate@users.noreply.github.com>2018-06-08 18:52:22 +0800
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2018-06-08 13:52:22 +0300
commitd71342f413ffc9dee4cce533058e3fd123095a2e (patch)
tree9f0668abc3ae3707e834c90116157cd73081a1fe
parent4c593d099825a8e9f6319903fcbe5bcbc15662cf (diff)
[Fix #2310] Add cider-format-edn-last-sexp (#2311)
-rw-r--r--CHANGELOG.md1
-rw-r--r--cider-interaction.el5
-rw-r--r--cider-mode.el4
3 files changed, 10 insertions, 0 deletions
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])