Subject: bug#21072: Brave new mark-defun (and a testing tool)

From: Stefan Monnier <[email-masked]>
Date: Sun, 30 Apr 2017 16:09:05 -0400

> I guess it's related to the fact that the first argument is evaluated by
> the macro itself at compile time, with (debug t) or (debug form body) I
> get an error when trying to instrument one of tests using that macro:

Yes, you can either use (debug (sexp body)) to avoid instrumenting the
first arg, or you might use (debug (def-form body)) so as to warn that
the first argument is not evaluated at the "normal" time.

        Stefan

> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p
> (edebug-after 0 3 mark-defun-test-buffer))
>   insert((edebug-after 0 3 mark-defun-test-buffer))
>   (progn (insert (cond ((symbolp contents) (symbol-value contents)) (t
> contents))) (goto-char (point-min)) [...])
>   (unwind-protect [...] (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
>   (save-current-buffer (set-buffer temp-buffer) [...])
>   (let ((temp-buffer (generate-new-buffer " *temp*"))) [...])
>   (let* ((var-pos nil) (text (let ((temp-buffer (generate-new-buffer " *temp*"))) [...]))) [...])
>   (closure (t) (contents &rest body) "Create an `emacs-lisp-mode' enabled
> temp buffer with CONTENTS[...]
>   macroexpand((elisp-tests-with-temp-buffer [...]
>   [...]
>   edebug-eval-defun((4))
>   apply(edebug-eval-defun (4))
>   eval-defun((4))
>   funcall-interactively(eval-defun (4))
>   call-interactively(eval-defun nil nil)
>   command-execute(eval-defun)