[ESS] Debug mode puts point in the wrong buffer

Marius Hofert marius.hofert at math.ethz.ch
Wed Jun 19 22:25:38 CEST 2013


On Wed, Jun 19, 2013 at 1:01 AM, Vitalie Spinu <spinuvit at gmail.com> wrote:
>
> I think you just have to get used to new debugger functionality. See the
> docs.
>
>  >> Marius Hofert <marius.hofert at math.ethz.ch>
>  >> on Wed, 19 Jun 2013 00:40:15 +0200 wrote:
>
>  > myfun <- function(x, y, z)
>  > {
>  >     x2 <- 2*x
>  >     y2 <- 2*y
>  >     z2 <- 2*z
>  > }
>  > debug(myfun)
>  > myfun(1,2,3)
>
>  > Version 1: myfun is defined in the current working script foo.R which
>  > is currently opened in Emacs.
>
>  > what happens:
>  > 1) execute the above code (C-c C-n)
>
> C-c C-n? C-RET for lines.
>
> C-c C-c is for executing blocks. It also automatically inserts source
> references into the function.
>
>  > 2) when executing myfun(1,2,3), foo.R is split into two buffers: foo.R
>  > and *R*. However, the point remains in foo.R instead of going to *R*
>  > (the latter would be more convenient to further hit RET and debug).
>
> RET?

for advancing from "Browse[1]>"...

> No, M-N, M-C, M-Q directly from the script buffer. This what the
> visual debugger is for. Don't you see the mini-buffer message when debug
> mode is started?

Okay, I just saw M-N, M-C etc. However, this time I don't understand your story.

M-C stands for Meta + the letter 'C', right? Well, with the point in
the script is in column 1 of the row containing the function
definition. If I press M-C, the function name is capitalized.

Similarly, M-n / M-N (Meta + Shift + n) give me 'M-N is undefined'.
What am I doing wrong?

[I'm working with ess-version : 13.05-1 [rev. 5621 (2013-06-11)]]

>
>  > Version 2: myfun is defined in ./R/bar.R of some package, the point
>  > being in the current working script foo.R.
>
> If R shows reference for bar.R that means you are debugging myfun from
> bar.R, and not from foo.R. Nobody is to blame here, unless of course
> there is some R bug (which I doubt).
>
> [...]
>
>  >> You are never thrown to another buffer if you are in *R* buffer.
>
>  > but one is typically not in *R* but in a buffer showing an R
>  > script. Debugging typically starts from there (by writing
>  > 'debug(myfun)' before calling myfun()).
>
> C-c C-t C-d for debuging a function. Or C-c C-t C-b for breakpoint.
>
> I don't have much to add. This is how visual debugger works, in ESS or
> elsewhere - it jumps to the current code line. You have to get used to
> the shortcuts, or just deactivate ess-tracebug and live with plain R
> command line debugger.
>
> As I said in other mail, ess-debug-goto-input-event-marker should do the
> "coming back" trick.

yes, thanks.

Marius


>
>     Vitalie



More information about the ESS-help mailing list