From 49ad7bc9e6bb5c1a9ba1210959761b811efa0e1f Mon Sep 17 00:00:00 2001
From: aktersnurra <grydholm@kth.se>
Date: Sat, 23 Apr 2022 22:36:52 +0200
Subject: fix(comment): add new logic

---
 fnl/config/ncomment.fnl | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/fnl/config/ncomment.fnl b/fnl/config/ncomment.fnl
index 2da59c6..06e9de1 100644
--- a/fnl/config/ncomment.fnl
+++ b/fnl/config/ncomment.fnl
@@ -2,18 +2,22 @@
 (module config.ncomment {autoload {util util}})
 
 (defn- get-type [ctx U]
-  (or (and (= ctx.ctype U.ctype.line) :__default) :__multiline))
+  (if (= ctx.ctype U.ctype.line)
+    :__default
+    :__multiline))
 
 (defn- get-location [ctx U]
-  (if (= ctx.ctype U.ctype.block)
-    ((require :ts_context_commentstring.utils).get_cursor_location)
-    (or (= ctx.cmotion U.motion.v) (= ctx.cmotion U.cmotion.V))
-    ((require :ts_context_commentstring.utils).get_visual_start_location)
-    nil))
+  (let [utils (require :ts_context_commentstring.utils)]
+    (if (= ctx.ctype U.ctype.block)
+      (utils.get_cursor_location)
+      (or (= ctx.cmotion U.cmotion.v) (= ctx.cmotion U.cmotion.V))
+      (utils.get_visual_start_location)
+      nil)))
 
 (defn- pre-hook [ctx]
-  (let [U (require :Comment.utils)]
-    ((require :ts_context_commentstring.internal).calculate_commentstring
+  (let [U (require :Comment.utils)
+        internal (require :ts_context_commentstring.internal)]
+    (internal.calculate_commentstring
       {:key (get-type ctx U)
        :location (get-location ctx U)})))
 
-- 
cgit v1.2.3-70-g09d2