[ESS] ess-tracebug

Rainer M Krug r.m.krug at gmail.com
Thu Dec 9 11:05:41 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/08/2010 11:49 PM, Vitalie S. wrote:
> Rainer M Krug <r.m.krug at gmail.com> writes:
> 
>> On 12/03/2010 06:30 PM, Erik Iverson wrote:
>>> Hello,
>>>
>>> Norm's recent message to ESS-help about his edtdbg
>>> package made me recall an announcement [1] last month
>>> about the ess-tracebug project, found at:
>>>
>>> http://code.google.com/p/ess-tracebug/>
>>> I'm having trouble following exactly what this ess-tracebug
>>> code is supposed to do. I can install it and activate it just
>>> fine, but getting something like the screenshots show has
>>> been elusive.  Has anyone succeeded in this?
>>
>> Let's go through the screenshots:
>>
>> 1) (error_in_iess.png) :  no
>>
>> 2) (last_input_arrow.png) : no
>>
>> 3) (ess_traceback.png) : yes
>>
>> 4) (Debugging.png) : yes
>>
>> Vitalie: would it be possible to upload a short .R file, which can be
>> used to reproduce the screenshots? That would make understanding the
>> add-on much easier.
> 
> Hi everyone,
> Thanks for feedback and sorry for late response, steeped out for a week.
> 
> 
> I will illustrate the ess-tracebug functionality with the test file at
> http://ess-tracebug.googlecode.com/svn/trunk/test.R .  It contains one function
> lm_test with an erroneous "," at line 6.
> 
> For what follows, I will assume that all the key bindings are as suggested on
> the main page http://code.google.com/p/ess-tracebug/ .

There I hava a problem - I get the following error message:

Symbol's value as variable is void: inferior-ess-mode


> 
> Go to the file and press M-c s (or just source it), you should get an error:
> 
>> + Error in source(file = "/home/vitoshka/SVN/ess-tracebug/test.R") :
>   /home/vitoshka/SVN/ess-tracebug/test.R:6:15: unexpected ','
> 5: {
> 6:     ret.x <- x,
> 
> with the reference to the error position highlighted.
> 
> With M-] from test.R (next-error ) or from iESS buffer
> (next-error-no-select) you can jump directly to the error and the line will be
> highlighted for `next-error-highlight` (or `next-error-no-select`) seconds.
> Mouse-click on the highlighted reference in the process buffer will also do the
> job. This is the http://code.google.com/p/ess-tracebug/#ess-traceback screenshot.
> 
> 
> The above navigation functionality is based on next-error and
> next-error-no-select capabilities which you get in compilation, grep
> and occur modes, and should be familiar to many of ESS users.
> 
> It might happen that the error reference is not detected and is not
> highlighted as in the screenshot (1). It could only mean that the regular
> expressions I composed do not capture the error format.
> 
> In that case please send to me the exact error message, preserving the
> formatting.  R outputs errors differently depending on the OS, so it will
> probably take some time to record all the available error formats.
> 
> There is an at leas on error format which is not yet detected. I will attend to
> it asap.

Thanks - that works so far and is quite nice.

> 
> 
> Next step - the debugging.
> 
> Correct the  ","  error in the test.R and place the break-point (M-c b) at
> some arbitrary position. Source the file once again M-c s.
> 
> Create the "main.R" file (or download from
> http://ess-tracebug.googlecode.com/svn/trunk/main.R ) with the following code:
> 
> require(stats); require(graphics)
> lm_test(Fertility ~ . , data = swiss)
> 
> Now run the above code.
> If everything is ok you should be brought to the break-point
> in the test.R; fringe should display the small triangle and the current line is
> highlighted. Exactly as the last (4th) screenshot on the homepage illustrates
> (http://code.google.com/p/ess-tracebug/#ess-debug ).
> 
> At this point you start pressing n,n,n... to jump through you code. I call this
> easy-key-mode. In easy-key-mode n,q,c will do what usually n,Q,c will do in R
> buffer. Any other event will trigger the exit from easy-key-mode and will be
> passed down the emacs command loop. Obviously you can always use  M-c c , M-c n
> ,M-c q whenever you like (which also will bring you into the easy mode).
> 
> Easy key mode is entered automatically whenever the debugger starts from a
> non-iESS buffer.

OK - I got that now.

> 
> 
> Now the work-flow.
> 
> With a big projects I always want to jump quickly to the focal point of my
> analysis. This is where I source all the project files and execute
> short code. I our case the working file is "main.R" 
> 
> When debugger starts it stores the "last input" position in the "main.R". You
> can jump to that point with M-c i (ess-dbg-goto-input-point) which is
> also an easy command; by repeatedly pressing i,i,i... you will be taken through
> the ring of previous "input point" S-i will bring you backwards through that
> ring.
> 
> When you execute M-c i the current position is  inserted into the
> debug-ring. Usually it is the place when you correct the error. So it's a focal
> point in the source code. You can jump through the debug-ring with M-c d d d D D
> d....
> 
> I find this functionality extremely handy, it improves the navigation speed twofold.

OK - I got it. It sounds very nice.

I must say, very handy. I will definitely try it out.

Thanks a lot for this detailed description and ilustration of tracebug's
features - I would actually suggest to add it as a tutorial to the
tracebug website.

Is there a chance that this could become part of ess? It would make much
sense.

Thanks a lot,

Rainer


> 
> With hopes it was helpful,
> Vitalie.
> 
>>
>> By the way: just screenshot 4 is worth the extension.
>>
>> Cheers,
>>
>> Rainer
>>
>>>
>>> I have activated ess-traceback and submit code from an R
>>> file that produces errors, but all I see are the 'fringe
>>> arrow', but no error line numbers.
>>>
>>> This project looks interesting, but can anyone tell me how
>>> to get results like the ones in the screenshots?
>>>
>>> I must admit I do not understand the section "The Work-Flow",
>>> so perhaps what I'm missing is because of that.
>>>
>>> Thanks,
>>> --Erik
>>>
>>>
>>> [1] https://stat.ethz.ch/pipermail/ess-help/2010-November/006489.html>
>>> ______________________________________________
>>> ESS-help at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/ess-help


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer at krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0AqfUACgkQoYgNqgF2ego74gCggJLqCEnvnPNoPajL2rXNZXFX
jPkAn2x8G2VM/sdGfD1tp7evwVd0MAjA
=oma4
-----END PGP SIGNATURE-----



More information about the ESS-help mailing list