Fork me on GitHub
Joseph Graham10:03:03

Good morning all! Does anybody know why I'm getting this indentation? Using clojure-mode, paredit rainbow delimiters.


If you can share the code then we can try replicate. Seems unusual indentation to me though.

Joseph Graham14:03:10

(defn render-due-tasks []
  (let [tasks (r/atom {:error nil :items []})
        fields (r/atom {:color "" :task_id #{}})
        pagename (.-value (.getElementById js/document "pagename"))]
    (update-tasks tasks pagename)
    (fn []
      ;; when it re-paints, we need to reset the checkboxes
      (swap! fields #(assoc % :task_id #{}))

         [:col {:style {:width "2em"}}]
         [:col {:style {:width "100%"}}]]
         (for [task (:items @tasks)]
           ^{:key task}
           [:tr (when
                    (:highlight task)
                  {:style {:background-color (:highlight task)}})
            [:td [:input {:type "checkbox"
                          :name "task_id"
                          :value (:task_id task)
                          :on-change #(toggle-checkbox fields %)}]]
            [:td (:task_name task)]])]]
       [:p {:style {:color "red"}} (:error @tasks)]

       ;; delete button
       [:button {:on-click #(delete-tasks fields tasks pagename)} "delete"] " "

       ;; highlight button
       [:select {:name "color"
                 :on-change #(handle-highlight fields % tasks pagename)}
        [:option {:value nil} "highlight"]
        (for [color (keys shared/colormap)]
          ^{:key color} [:option {:value color} color])]

       ;; defer button
       [:select {:name "defer" :on-change ()}
        [:option {:value nil} "defer"]


Curious. When I format the above code with cider-format-buffer (with the REPL started) then I get what I consider the correct indentation

[:tr (when
      (:highlight task)
       {:style {:background-color (:highlight task)}})
However, RTN after the when form positions the cursor further indented, exactly as your example To me this suggests either lsp (cljfmt) or clojure-mode is causing the different indentation (although I dont know why that would be the case) Personally I'd move the when condition to the same line and try forget about the unusual indent
(when (:highlight task)

Joseph Graham15:03:03

yep I guess that's nicer


whenever you get a unusual indent, it can be considered clojure-mode's way of telling you that the newline placement wasn't that idiomatic


@U45T93RA6 Is that a specific feature of clojure-mode (I couldnt find any docs) or a consequence of clojure-mode not having an applicable rule to apply? Or perhaps a general tip from experience? Thanks.


Has anyone played around with elpaca?


Hi, does anyone know why I don’t get Clojure documentation with Corfu (popupinfo)? I am running Eglot and Cider…


You're hovering over a snippet


@U043RSZ25HQ What do you mean? I am calling corfu-info-documentation which returns “No documentation available for …“.


The candidate you're selecting is a snippet, it doesn't have any docs


Ah, that’s just an example, it doesn’t work anywhere. (however, C-c C-d d works over snippets, so I wouldn’t mind if Corfu could do it too)


@U043RSZ25HQ If it works for you, could you share your configuration 🙏?


I don't use eglot but my doom config is here:


@UBRV1HXPD It's possible we haven't implemented something required in CIDER. This doc integration had a special API in Company mode, not sure how the situation looks in Corfu.


I've yet to try it.


@U051BLM8F To be honest, I don't care about Cider much. I'd prefer it to work with clojure-lsp and eglot. That is, to have documentation even when the repl isn't running.


Fair enough. I can't comment on the integration between elgot and corfu, though, as I've never used them.

👍 2

Seems to be an eglot problem, in a vanilla emacs with clojure-mode, lsp-mode & corfu everything works fine