Fork me on GitHub
#emacs
<
2019-02-17
>
vemv20:02:37

Occasionally (and for reasons unknown) I break paredit's "jail", creating unbalanced/missing delimiters. Then determining where the error is can be hard... e.g. the function is 20 LOC long, is the missing parens at the end? in the middle? wondering if there's an emacs (or clojure) function that will tell me "things begin to be broken at line x, column y"

mathpunk20:02:41

@vemv Two hacks I've found helpful: - evaluating regions, so I can find where the problem isn't - using code-folding: folding a block that's malformed will often get a complaint from the editor about an unbalanced parenthesis

mathpunk20:02:18

but i don't know about an auto function --- it might even be a harder-than-you'd-think problem, since it's about trying to read data for structure but the data is incorrectly structured

👍 5
vemv20:02:10

hacks noted, thanks! what do you use for code folding? I have some code-folding setup, but I currently don't know how to fold an arbitrary sexp

mathpunk20:02:39

evil-fold or something. Came with spacemacs

mathpunk20:02:02

oh, and I use a LOT more do/comment blocks than I used to.... so it can be nice to make a do block for what you're working on, slurp things into it, and evaluate the toplevel

mathpunk20:02:08

if that all works great, slurp the next form in

dpsutton20:02:52

when this happens, i go to the top of the file and start hitting paredit-forward until i get a scan error

5
vemv20:02:22

tried out. doesn't appear to help me point out the exact location (example: place a stray ( in the middle of a defn)

vemv21:02:02

> it might even be a harder-than-you'd-think problem sounds spot on. For example if I insert a stray ( in L50, it might pair with the nearest ) in L51, but things don't start to break until L70. So how could an error reporter notice that something was off in L50 when in fact one can see a perfectly paired ( ...) there? Sounds pretty hard without heuristics that try to understand the meaning of the code

dpsutton21:02:01

@mathpunk are you familiar with (setq clojure-toplevel-inside-comment-form t)? It changes how top level works so the comment form isn't see as the top level but the forms one level underneath it are

mathpunk21:02:05

no! if i understand right from your description that is very useful