emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/clojure-ts-mode 64d8fde253 04/14: Semantic indentation doc


From: ELPA Syncer
Subject: [nongnu] elpa/clojure-ts-mode 64d8fde253 04/14: Semantic indentation docs
Date: Fri, 8 Sep 2023 18:59:17 -0400 (EDT)

branch: elpa/clojure-ts-mode
commit 64d8fde253fd08cb510bd74557983bc1fd423ce3
Author: dannyfreeman <danny@dfreeman.email>
Commit: Danny Freeman <danny@dfreeman.email>

    Semantic indentation docs
    
    This style tries to emualte cljfmt's default settings. There are
    different styles of semantic formatting so this will be one option,
    maybe more in the future.
---
 clojure-ts-mode.el   | 16 ++++++++++------
 test/indentation.clj | 19 +++++++++++++++++--
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el
index 4b47f45af6..817e4721bb 100644
--- a/clojure-ts-mode.el
+++ b/clojure-ts-mode.el
@@ -499,11 +499,14 @@ By default `treesit-defun-name-function' is used to 
extract definition names.
 See `clojure-ts--standard-definition-node-name' for the implementation used.")
 
 (defcustom clojure-ts-indent-style 'semantic
-  "Automatic indentation style to use when mode clojure-ts-mode is run
+  "Automatic indentation style to use when mode `clojure-ts-mode' is run.
 
 The possible values for this variable are
-    `semantic' - Tries to follow the same rules as the clojure style guide.
-        See: https://guide.clojure.style/
+    `semantic' - Semantic indentation.
+        Tries to follow the same rules as cljfmt with default settings.
+        See:
+          - https://github.com/weavejester/cljfmt
+          - https://guide.clojure.style/
     `fixed' - A simpler set of indentation rules that can be summarized as
         1. Multi-line lists that start with a symbol are always indented with
            two spaces.
@@ -512,8 +515,8 @@ The possible values for this variable are
         See: https://tonsky.me/blog/clojurefmt/";
   :safe #'symbolp
   :type
-  '(choice (const :tag "Semantic indent rules, matching clojure style guide." 
semantic)
-           (const :tag "Simple fixed indent rules." fixed))
+  '(choice (const :tag "Semantic indentation rules." semantic)
+           (const :tag "Simple fixed indentation rules." fixed))
   :package-version '(clojure-ts-mode . "0.2.0"))
 
 (defvar clojure-ts--fixed-indent-rules
@@ -655,7 +658,8 @@ See `treesit-simple-indent-rules'."
    ((eq clojure-ts-indent-style 'fixed) clojure-ts--fixed-indent-rules)
    (t (error
        (format
-        "Invalid value for clojure-ts-indent-style. Valid values are 'semantic 
or 'fixed. Found %S"
+        "Invalid value for clojure-ts-indent-style. Expected one of '%S, but 
found '%S instead."
+        '(semantic fixed)
         clojure-ts-indent-style)))))
 
 (defvar clojure-ts-mode-map
diff --git a/test/indentation.clj b/test/indentation.clj
index 24399f6d96..4a1b7e5d37 100644
--- a/test/indentation.clj
+++ b/test/indentation.clj
@@ -1,10 +1,25 @@
+(ns indentation
+  (:require
+   [clojure.string :as str])
+  (:import
+   (java.util Date
+              UUID)))
+
 ; https://tonsky.me/blog/clojurefmt/#ok-what-do-we-do-then
 (when something
   body)
 
+(defmethod dispatch :on-me
+  [x]
+  (bar x))
+
 (defn f [x]
   body)
 
+(defn f
+  ([x] (f x nil))
+  ([x y] ))
+
 (defn f
   [x]
   body)
@@ -34,12 +49,12 @@
 
 ; second cond is not aligned
 (or (condition-a)
-  (condition-b))
+    (condition-b))
 
 ; or/and are the only forms where this looks not ideal
 ; other forms don’t win/lose much because of this change
 (filter even?
-  (range 1 10))
+        (range 1 10))
 
 ; my way is actually better if fn name is looooooooooong
 (clojure.core/filter even?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]