title: Clojure macro stack trace of exceptions
body: <p>Let us say that i have a macro that replaces all occurrences of 'transact' to '\', sth like this:</p>
  
  <pre><code>(defmacro transmuting-macro [&amp; body]
    (let [transmuted-body (clojure.walk/postwalk 
                           #(if (and (list? %) (= 'transact (first %))) 
                              (-&gt; % rest (conj `/)) %) body)]
      transmuted-body)) 
  </code></pre>
  
  <p>Now i can do this:</p>
  
  <pre><code>(defn generate-error []
    (transmuting-macro (let [x 1
                 b (transact 1 3)]
             (transact 3 0))))
  </code></pre>
  
  <p>But exception's stacktrace cannot track what is inside, it stops at the macro invocation (line 2) and then immediately jumps to divide without providing any meaningful line number (in this case line 4).</p>
  
  <p>If i put just <code>body</code> instead of <code>transmuted-body</code> in macro definition's last line the stack is preserved. So, I reckon, there is some hidden info somewhere that allows the compiler to introspect some macros but not others.
  I have tried to look at meta as well as special &amp;form and &amp;env variables but to no avail.
  Since my transmutation doesnt change anything about line numbers, just copying this information would suffice. How to make it work?</p>