[GRASS-user] GRASS in EMACS with ESS - how to send more than one line at a time

I use GRASS and R within a EMACS-ESS environment, which works quite well overall. I can keep a script that uses both GRASS and R in a single script file and bounce back and forth between them as I need for analysis (i.e. “system(“grass64 /media/Data/Work/grassdata/CFR/biomass”)” to go to GRASS from R, and “R” to go to R from GRASS). When within a R environment, I can send multiple lines from a buffer to the R proccess with a C-c C-r keystroke, which works brilliantly.

But when I am in the GRASS environment, I am only able to send one line at a time or it will hang until I hit C-g (which results in only the first line of the region being sent). I imagine that this is because ESS is waiting for the standard R prompt “>” before sending the next line, but while in GRASS the prompt is something more like "GRASS 6.4.0RC5 (CFR):/grassdata/map> " so ESS doesn’t know that the previous command is finished and just waits until I cancel it with C-g. Anyone found a solution to this problem?

Thanks,
Adam

Adam Wilson wrote:

I use GRASS and R within a EMACS-ESS environment, which works quite well
overall. I can keep a script that uses both GRASS and R in a single script
file and bounce back and forth between them as I need for analysis (i.e.
"system("grass64 /media/Data/Work/grassdata/CFR/biomass")" to go to GRASS
from R, and "R" to go to R from GRASS). When within a R environment, I can
send multiple lines from a buffer to the R proccess with a C-c C-r
keystroke, which works brilliantly.

But when I am in the GRASS environment, I am only able to send one line at a
time or it will hang until I hit C-g (which results in only the first line
of the region being sent). I imagine that this is because ESS is waiting
for the standard R prompt ">" before sending the next line, but while in
GRASS the prompt is something more like "GRASS 6.4.0RC5
(CFR):/grassdata/map> " so ESS doesn't know that the previous command is
finished and just waits until I cancel it with C-g. Anyone found a
solution to this problem?

Try adding:

  export PS1='> '

to ~/.grass.bashrc.

Beyond that, consider bypassing the grass64 script for any
"unconventional" use of GRASS. It really isn't suitable for anything
other than its intended usage (being run from a terminal to create an
interactive session).

--
Glynn Clements <glynn@gclements.plus.com>