From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Is there a way to instrument for edebug a form (say, a progn) given to `eval'? Date: Tue, 05 Jan 2016 10:16:50 +0100 Message-ID: <87io38s7wd.fsf@mbork.pl> References: <87k2nw866r.fsf@mbork.pl> <87wprv6e0f.fsf@web.de> <87mvslrn8q.fsf@mbork.pl> <87d1th9bac.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451985456 31179 80.91.229.3 (5 Jan 2016 09:17:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jan 2016 09:17:36 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 05 10:17:27 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aGNk6-0006zT-GJ for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 10:17:26 +0100 Original-Received: from localhost ([::1]:48702 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGNk5-0000xw-NU for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 04:17:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGNju-0000xm-KJ for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 04:17:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGNjr-0001zm-Dm for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 04:17:14 -0500 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:57098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGNjr-0001zi-6u for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 04:17:11 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 73D2F8F2016; Tue, 5 Jan 2016 10:16:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Eg1zSLx6Y32Z; Tue, 5 Jan 2016 10:16:54 +0100 (CET) Original-Received: from localhost (unknown [109.232.24.28]) by mail.mojserwer.eu (Postfix) with ESMTPSA id A2CBA8F200B; Tue, 5 Jan 2016 10:16:54 +0100 (CET) User-agent: mu4e 0.9.13; emacs 25.1.50.1 In-reply-to: <87d1th9bac.fsf@web.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 195.110.48.8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108612 Archived-At: On 2016-01-05, at 00:26, Michael Heerdegen wrote: > Marcin Borkowski writes: > >> (eval >> '(progn >> (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 > edebug. 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'." (if arg (save-excursion (eval form)) (eval form))) I was curious whether it is possible to step with edebug through `form'. 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)) (if arg `(save-excursion ,form) form)) (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;-).) > Michael. Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University