branch: elpa/clojure-mode
commit cfb875ca3dc6de03a31a7780b109a7fc0e77f53c
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Add edn-mode derived from clojure-mode
    
    EDN is a pure data format (subset of Clojure) that doesn't need
    code-oriented indentation. This new mode uses always-align indent
    style and disables indent specs so all forms are indented uniformly
    as data rather than as function calls.
    
    Closes #650
---
 CHANGELOG.md    |  1 +
 clojure-mode.el | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec348dd604..a087dbc121 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
 
 ### New features
 
+* [#650](https://github.com/clojure-emacs/clojure-mode/issues/650): Add 
`edn-mode`, a lightweight mode derived from `clojure-mode` with 
data-appropriate indentation for `.edn` files.
 * [#439](https://github.com/clojure-emacs/clojure-mode/issues/439): Add 
`interpreter-mode-alist` entries for `clojure`, `clj`, `planck`, `joker`, and 
`jank`, so that scripts with shebang lines are recognized automatically.
 
 ### Changes
diff --git a/clojure-mode.el b/clojure-mode.el
index d531b6ffdc..f2b3e50580 100644
--- a/clojure-mode.el
+++ b/clojure-mode.el
@@ -3325,10 +3325,23 @@ With universal argument \\[universal-argument], act on 
the \"top-level\" form."
 
 \\{joker-mode-map}")
 
+;;;###autoload
+(define-derived-mode edn-mode clojure-mode "EDN"
+  "Major mode for editing EDN data files.
+
+EDN (Extensible Data Notation) is a subset of Clojure used as a data format.
+This mode inherits Clojure syntax and navigation but uses simplified
+indentation appropriate for data structures rather than code.
+
+\\{edn-mode-map}"
+  (setq-local clojure-indent-style 'always-align)
+  (setq-local clojure-enable-indent-specs nil))
+
 ;;;###autoload
 (progn
   (add-to-list 'auto-mode-alist
-               '("\\.\\(clj\\|cljd\\|dtm\\|edn\\|lpy\\)\\'" . clojure-mode))
+               '("\\.\\(clj\\|cljd\\|dtm\\|lpy\\)\\'" . clojure-mode))
+  (add-to-list 'auto-mode-alist '("\\.edn\\'" . edn-mode))
   (add-to-list 'auto-mode-alist '("\\.cljc\\'" . clojurec-mode))
   (add-to-list 'auto-mode-alist '("\\.cljs\\'" . clojurescript-mode))
   (add-to-list 'auto-mode-alist '("\\.cljd\\'" . clojuredart-mode))

Reply via email to