From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Schmitt Newsgroups: gmane.emacs.help Subject: Re: How can I debug a macro? Date: Wed, 16 Dec 2015 14:21:42 +0100 Message-ID: References: <87a8paloe5.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1450272155 5279 80.91.229.3 (16 Dec 2015 13:22:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Dec 2015 13:22:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 16 14:22:27 2015 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 1a9C2F-0001xb-Bq for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Dec 2015 14:22:27 +0100 Original-Received: from localhost ([::1]:47402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9C2E-0001Q9-Lb for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Dec 2015 08:22:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9C1z-0001Pt-Ls for help-gnu-emacs@gnu.org; Wed, 16 Dec 2015 08:22:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9C1w-0005Hs-EO for help-gnu-emacs@gnu.org; Wed, 16 Dec 2015 08:22:11 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:53902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9C1w-0005Ho-7S for help-gnu-emacs@gnu.org; Wed, 16 Dec 2015 08:22:08 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a9C1u-0001LS-FU for help-gnu-emacs@gnu.org; Wed, 16 Dec 2015 14:22:06 +0100 Original-Received: from charm-ecran.irisa.fr ([131.254.101.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Dec 2015 14:22:06 +0100 Original-Received: from alan.schmitt by charm-ecran.irisa.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Dec 2015 14:22:06 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 88 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: charm-ecran.irisa.fr User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:4pSFgm1je8TRorCWU15h3eyEczI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:108415 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2015-12-16 10:43, phillip.lord@russet.org.uk (Phillip Lord) writes: > If you want to debug a *usage* of the macro, then the macro itself needs > to declare to edebug how it should be evaled. In most cases this is > quite easy. For `org-babel-comint-with-output' it's slightly tricker > because AFAICT the `meta' argument is not evaluated. I want to debug the usage of the macro. It returns the wrong value and I want to understand why. > Consider these: > > (defmacro temp-m (one &rest body) > (declare (debug (form body))) > (let ((a one)) > `(progn ,@body))) > > (defun h () > (temp-m > '(1 2 3) > (message "hello"))) > > with the "declare" form in temp-m, calling "h" will step through the > code in "h" as you expect. The debug sexp means "first argument is a > form, the rest are body elements which need stepping through". > > So, I think evalling: > > (def-edebug-spec org-babel-comint-with-output > (form body)) > > should do the trick, although probably you want to send a patch in for > org-comint.el (using the declare version) so that it works for everyone. I'm trying this, but I'm confused at to what I need to do after I add the declare form. This is what I tried: =2D add the declare form to org-babel-comint-with-output =2D C-u C-M-x on org-babel-comint-with-output =2D evaluate a block in org-mode I then see a message: edebug: Symbol's value as variable is void: edebug-def-mark I then tried to debug the function calling the macro: =2D C-u C-M-x on org-babel-execute:ocaml =2D strangely, a debugging start even though I have not called the function yet (I have not evaluated the source block) =2D I try stepping through the macro, and it makes no sense (I see a lot of things like "Result: (edebug-after (edebug-before 17) 20 (session (edebug-after 0 18 org-babel-ocaml-eoe-output) t (edebug-after 0 19 full-body)))") =2D if I then try to run a code block, I can start to step through org-babel-execute:ocaml as expected, but as soon as I reach the point where the macro is to be evaluated, I get an error: "Symbol's value as variable is void: edebug-after" I feel like I'm missing something here. Am I using this correctly? Thanks, Alan =2D-=20 OpenPGP Key ID : 040D0A3B4ED2E5C7 Athmospheric CO=E2=82=82 (Updated December 13, 2015, Mauna Loa Obs.): 401.3= 1 ppm --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJWcWVnAAoJEAQNCjtO0uXHvzUIAL3tQPuTO0CaaYYcfzwcAKh2 reIrJeOY5pW7wLjRGm50VeMmP3uyioMdYp/KP9XEkXWW52m81QbDf2rC/LC5+k6N GcUrXiR/+0nsrQBg8qtDAbXVwnaZC3x7K+t6OySWj6BHdskvU5BFdMasBz/HQ2Fg GEUJ351h8aAIlUqIXttfcVa8r1AZ01Yzsomh4C5x8UHUwU302HkYj1yvctNwu9aa 1pCctduzyXoGX/u7af6n3Eylu0cAELcEOJQXKYqpAtRNpGxzKBKugjTapPnrJ15F UveZWqGqAWi7w3dEAbo52xlNIj47E4quAXvAH1VGh1R41On1FMIl/RQBEcrwHh0= =YMLG -----END PGP SIGNATURE----- --=-=-=--