branch: elpa/cider
commit 128bf920f0aa0b1edce9fdef39739a7b5ebaaf6e
Author: vemv <[email protected]>
Commit: vemv <[email protected]>

    Reformat some `thread-first`s
    
    This style is closer to Clojure's, and indents consistently across more 
Emacs versions.
---
 cider.el | 154 +++++++++++++++++++++++++++++----------------------------------
 1 file changed, 71 insertions(+), 83 deletions(-)

diff --git a/cider.el b/cider.el
index c980a1deac..10a3a93146 100644
--- a/cider.el
+++ b/cider.el
@@ -1344,11 +1344,10 @@ been determined."
   "Fill-in the passed in PARAMS plist needed to start an nREPL server.
 Updates :project-dir and :jack-in-cmd.
 Also checks whether a matching session already exists."
-  (thread-first
-   params
-   (cider--update-project-dir)
-   (cider--check-existing-session)
-   (cider--update-jack-in-cmd)))
+  (thread-first params
+                (cider--update-project-dir)
+                (cider--check-existing-session)
+                (cider--update-jack-in-cmd)))
 
 ;;;###autoload
 (defun cider-jack-in-clj (params)
@@ -1387,11 +1386,10 @@ these parameters."
         (cider-jack-in-nrepl-middlewares (append 
cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares))
         (orig-buffer (current-buffer)))
     ;; cider--update-jack-in-cmd relies indirectly on the above dynamic vars
-    (let ((params (thread-first
-                   params
-                   (cider--update-project-dir)
-                   (cider--check-existing-session)
-                   (cider--update-jack-in-cmd))))
+    (let ((params (thread-first params
+                                (cider--update-project-dir)
+                                (cider--check-existing-session)
+                                (cider--update-jack-in-cmd))))
       (nrepl-start-server-process
        (plist-get params :project-dir)
        (plist-get params :jack-in-cmd)
@@ -1417,14 +1415,13 @@ only when the ClojureScript dependencies are met."
         (cider-jack-in-nrepl-middlewares (append 
cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares))
         (orig-buffer (current-buffer)))
     ;; cider--update-jack-in-cmd relies indirectly on the above dynamic vars
-    (let ((params (thread-first
-                   params
-                   (cider--update-project-dir)
-                   (cider--check-existing-session)
-                   (cider--update-jack-in-cmd)
-                   (cider--update-cljs-type)
-                   ;; already asked, don't ask on sibling connect
-                   (plist-put :do-prompt nil))))
+    (let ((params (thread-first params
+                                (cider--update-project-dir)
+                                (cider--check-existing-session)
+                                (cider--update-jack-in-cmd)
+                                (cider--update-cljs-type)
+                                ;; already asked, don't ask on sibling connect
+                                (plist-put :do-prompt nil))))
       (nrepl-start-server-process
        (plist-get params :project-dir)
        (plist-get params :jack-in-cmd)
@@ -1449,13 +1446,12 @@ server is created."
           (other-params (cider--gather-connect-params nil other-repl))
           (ses-name (unless (nrepl-server-p other-repl)
                       (sesman-session-name-for-object 'CIDER other-repl))))
-     (thread-first
-      params
-      (cider--update-do-prompt)
-      (append other-params)
-      (plist-put :repl-init-function nil)
-      (plist-put :repl-type 'clj)
-      (plist-put :session-name ses-name)))))
+     (thread-first params
+                   (cider--update-do-prompt)
+                   (append other-params)
+                   (plist-put :repl-init-function nil)
+                   (plist-put :repl-type 'clj)
+                   (plist-put :session-name ses-name)))))
 
 ;;;###autoload
 (defun cider-connect-sibling-cljs (params &optional other-repl)
@@ -1474,14 +1470,13 @@ server buffer, in which case a new session for that 
server is created."
          (ses-name (unless (nrepl-server-p other-repl)
                      (sesman-session-name-for-object 'CIDER other-repl))))
     (cider-nrepl-connect
-     (thread-first
-      params
-      (cider--update-do-prompt)
-      (append other-params)
-      (cider--update-cljs-type)
-      (cider--update-cljs-init-function)
-      (plist-put :session-name ses-name)
-      (plist-put :repl-type 'cljs)))))
+     (thread-first params
+                   (cider--update-do-prompt)
+                   (append other-params)
+                   (cider--update-cljs-type)
+                   (cider--update-cljs-init-function)
+                   (plist-put :session-name ses-name)
+                   (plist-put :repl-type 'cljs)))))
 
 ;;;###autoload
 (defun cider-connect-clj (&optional params)
@@ -1490,14 +1485,13 @@ PARAMS is a plist optionally containing :host, :port 
and :project-dir.  On
 prefix argument, prompt for all the parameters."
   (interactive "P")
   (cider-nrepl-connect
-   (thread-first
-    params
-    (cider--update-project-dir)
-    (cider--update-host-port)
-    (cider--check-existing-session)
-    (plist-put :repl-init-function nil)
-    (plist-put :session-name nil)
-    (plist-put :repl-type 'clj))))
+   (thread-first params
+                 (cider--update-project-dir)
+                 (cider--update-host-port)
+                 (cider--check-existing-session)
+                 (plist-put :repl-init-function nil)
+                 (plist-put :session-name nil)
+                 (plist-put :repl-type 'clj))))
 
 ;;;###autoload
 (defun cider-connect-cljs (&optional params)
@@ -1509,15 +1503,14 @@ On prefix, prompt for all the
 parameters regardless of their supplied or default values."
   (interactive "P")
   (cider-nrepl-connect
-   (thread-first
-    params
-    (cider--update-project-dir)
-    (cider--update-host-port)
-    (cider--check-existing-session)
-    (cider--update-cljs-type)
-    (cider--update-cljs-init-function)
-    (plist-put :session-name nil)
-    (plist-put :repl-type 'cljs))))
+   (thread-first params
+                 (cider--update-project-dir)
+                 (cider--update-host-port)
+                 (cider--check-existing-session)
+                 (cider--update-cljs-type)
+                 (cider--update-cljs-init-function)
+                 (plist-put :session-name nil)
+                 (plist-put :repl-type 'cljs))))
 
 ;;;###autoload
 (defun cider-connect-clj&cljs (params &optional soft-cljs-start)
@@ -1526,16 +1519,14 @@ PARAMS is a plist optionally containing :host, :port, 
:project-dir and
 :cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc).  When SOFT-CLJS-START is
 non-nil, don't start if ClojureScript requirements are not met."
   (interactive "P")
-  (let* ((params (thread-first
-                  params
-                  (cider--update-project-dir)
-                  (cider--update-host-port)
-                  (cider--check-existing-session)
-                  (cider--update-cljs-type)))
-         (clj-params (thread-first
-                      params
-                      copy-sequence
-                      (map-delete :cljs-repl-type)))
+  (let* ((params (thread-first params
+                               (cider--update-project-dir)
+                               (cider--update-host-port)
+                               (cider--check-existing-session)
+                               (cider--update-cljs-type)))
+         (clj-params (thread-first params
+                                   copy-sequence
+                                   (map-delete :cljs-repl-type)))
          (clj-repl (cider-connect-clj clj-params)))
     (when (if soft-cljs-start
               (cider--check-cljs (plist-get params :cljs-repl-type) 'no-error)
@@ -1605,10 +1596,9 @@ Params is a plist with the following keys 
(non-exhaustive)
             (setq-local buffer-file-name nil))
           (let ((default-directory proj-dir))
             (hack-dir-local-variables-non-file-buffer)
-            (thread-first
-             params
-             (plist-put :project-dir proj-dir)
-             (plist-put :--context-buffer (current-buffer)))))))))
+            (thread-first params
+                          (plist-put :project-dir proj-dir)
+                          (plist-put :--context-buffer (current-buffer)))))))))
 
 (defun cider--update-cljs-type (params)
   "Update :cljs-repl-type in PARAMS."
@@ -1704,10 +1694,9 @@ PARAMS is a plist with the following keys 
(non-exhaustive list)
                          (cider-select-endpoint)))))
       (if (equal "local-unix-domain-socket" (car endpoint))
           (plist-put params :socket-file (cdr endpoint))
-        (thread-first
-         params
-         (plist-put :host (car endpoint))
-         (plist-put :port (cdr endpoint)))))))
+        (thread-first params
+                      (plist-put :host (car endpoint))
+                      (plist-put :port (cdr endpoint)))))))
 
 (defun cider--update-cljs-init-function (params)
   "Update repl type and any init PARAMS for cljs connections.
@@ -1728,21 +1717,20 @@ over to cljs.
       (if (null repl-init-form)
           (plist-put params :cider-repl-cljs-upgrade-pending nil)
 
-        (thread-first
-         params
-         (plist-put :cider-repl-cljs-upgrade-pending t)
-         (plist-put :repl-init-function
-                    (lambda ()
-                      (cider--check-cljs cljs-type)
-                      (cider-nrepl-send-request
-                       (list "op" "eval"
-                             "ns" (cider-current-ns)
-                             "code" repl-init-form)
-                       (cider-repl-handler (current-buffer)))
-                      (when (and (buffer-live-p nrepl-server-buffer)
-                                 cider-offer-to-open-cljs-app-in-browser)
-                        (cider--offer-to-open-app-in-browser 
nrepl-server-buffer))))
-         (plist-put :repl-init-form repl-init-form))))))
+        (thread-first params
+                      (plist-put :cider-repl-cljs-upgrade-pending t)
+                      (plist-put :repl-init-function
+                                 (lambda ()
+                                   (cider--check-cljs cljs-type)
+                                   (cider-nrepl-send-request
+                                    (list "op" "eval"
+                                          "ns" (cider-current-ns)
+                                          "code" repl-init-form)
+                                    (cider-repl-handler (current-buffer)))
+                                   (when (and (buffer-live-p 
nrepl-server-buffer)
+                                              
cider-offer-to-open-cljs-app-in-browser)
+                                     (cider--offer-to-open-app-in-browser 
nrepl-server-buffer))))
+                      (plist-put :repl-init-form repl-init-form))))))
 
 (defun cider--check-existing-session (params)
   "Ask for confirmation if a session with similar PARAMS already exists.

Reply via email to