[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a way to instrument for edebug a form (say, a progn) given
Re: Is there a way to instrument for edebug a form (say, a progn) given to `eval'?
Tue, 05 Jan 2016 10:16:50 +0100
mu4e 0.9.13; emacs 22.214.171.124
On 2016-01-05, at 00:26, Michael Heerdegen <address@hidden> wrote:
> Marcin Borkowski <address@hidden> writes:
>> (message "foo")
>> (message "bar")))
>> and see how Edebug doesn't step into the progn.
> That's expected, the argument to eval can be anything, in particular,
> something that is not written down in some buffer. In the above case,
> you call eval on a constant, and edebug can't know where this constant
> comes from.
> Paste the progn form somewhere and hit C-u C-M-x if you want to use
I guess you misunderstood me. It's not that I have this in actual code,
or that I really want to edebug _this_ progn. I have (more or less)
this in actual code:
(defun conditional-save-excursion-1-function (arg form)
"If ARG is non-nil, eval FORM inside a `save-excursion'."
I was curious whether it is possible to step with edebug through
Also, this is not "actual code" in a sense that I want to actually use
it anywhere. Disclosure: it comes from the draft of my Emacs book,
chapter on macros, where I try to explain why a macro is better than
a function in such a case. One of the reasons is that you can't use
edebug if you use a function and not a macro like this:
(defmacro conditional-save-excursion-1 (arg form)
"If ARG is non-nil, wrap FORM in `save-excursion'."
(declare (indent 1) (debug t))
(BTW, this macro is inspired by a real use-case.)
My question was because I do not want to write it in the book if I'm not
100% sure I'm right, and I wasn't sure. (Though it seems that I was
right after all - Stefan's trick with replacing the backquote with its
edebug-compliant variant doesn't count, I guess;-).)
Faculty of Mathematics and Computer Science
Adam Mickiewicz University