1

Currently, edebug doesn't understand the ->> macro in dash.el.

(defun foo ()
  (->> (+ 1 1)
       (+ 2)
       (* 3)
       (format "%s")))

C-u M-x edebug-eval-defun followed by M-: (foo) does not step through the forms inside ->>. It just shows the value of the whole (->> ...) expression.

Looking at the docs for declare, I don't think I can teach edebug about all the arguments to ->>. However, the first argument is a form, so I would like to edebug to step through that. I tried this:

(defmacro ->> (x &optional form &rest more)
  "Thread the expr through the forms. ..."
  (declare (debug (form &rest 0)))
   ...)

However, this gives me "edebug-match-specs: Too deep - perhaps infinite loop in spec?" when I try to call edebug-eval-defun on foo afterwards.

Can I annotate a macro so that the first argument is a form, but edebug skips the rest?

Wilfred Hughes
  • 6,890
  • 2
  • 29
  • 59
  • 2
    Emacs 25 has a new [`thread-first` macro](http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/emacs-lisp/subr-x.el?id=emacs-25.0.95#n63) with an edebug spec, does that help? – npostavs Jul 02 '16 at 12:40
  • @npostavs that's perfect. Would you like to submit your comment as an answer? – Wilfred Hughes Jul 05 '16 at 08:57
  • You better make it a self-answer, I don't really understand how it works, I just recalled a relevant example. – npostavs Jul 05 '16 at 11:38

0 Answers0