fmt icon indicating copy to clipboard operation
fmt copied to clipboard

Too much horizontal indentation

Open jackfirth opened this issue 1 year ago • 0 comments

fmt currently formats this code:

(void
 (thread
  (λ ()
    (let loop ()
      (define vec (sync evt))
      (define str (vector-ref vec 1))
      (when (regexp-match #rx"^cm: *compil(ing|ed)" str)
        (display str)
        (newline))
      (loop)))))

Into this:

(void (thread (λ ()
                (let loop ()
                  (define vec (sync evt))
                  (define str (vector-ref vec 1))
                  (when (regexp-match #rx"^cm: *compil(ing|ed)" str)
                    (display str)
                    (newline))
                  (loop)))))

The original is much more readable to me. This is related to the discussion in racket/drracket#678 about how fmt prioritizes minimizing vertical space over minimizing indentation. In the (void (thread ...)) case, things are a bit simpler because each of those forms has exactly one subform.

jackfirth avatar Sep 20 '24 05:09 jackfirth