Questions regarding R + Aquamacs + ESS

View: New views
7 Messages — Rating Filter:   Alert me  

Questions regarding R + Aquamacs + ESS

by johannes rara :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi (I did sent this post also to R-sig-mac, but I think this is the
right forum for this post),

I have few questions regarding R 2.9.2 + Aquamacs + ESS. I'm moving
from WinXP to Mac (Snow Leopard 10.6.1) and also from Tinn-R to
Aquamacs (1.8c).

1. Is there syntax highlighting in Aqaumacs? Now when I open .R file
only the lines starting with comment mark (#), quoted words etc. are
shown in color. What about R:s reserved words? In Tinn-R these words
where shown blue. Is there this kind of functionality in Aquamacs?

2. When I evaluate an area of R code (send it to R), I press C-c C-r.
If the area is e.g. 50 lines, I would like that the cursor in the ESS
windows goes into an end (like pressing C-c M-r) and I don't have to
jump back into the code window. How can I achieve this?

3. It seems to bit complicated to keep pressing C-c all the time, is
there a way to make a shortcut key (e.g when pressing Alt-S an area of
code is sent to ESS-window (into R)

4. Is there a way to split code window and ESS-window (R) vertically
(side to side)? The default split is horizontally.

Thanks!

-Johannes

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Questions regarding R + Aquamacs + ESS

by Stephen Eglen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hi (I did sent this post also to R-sig-mac, but I think this is the
> right forum for this post),
>
> I have few questions regarding R 2.9.2 + Aquamacs + ESS. I'm moving
> from WinXP to Mac (Snow Leopard 10.6.1) and also from Tinn-R to
> Aquamacs (1.8c).
>
> 1. Is there syntax highlighting in Aqaumacs? Now when I open .R file
> only the lines starting with comment mark (#), quoted words etc. are
> shown in color. What about R:s reserved words? In Tinn-R these words
> where shown blue. Is there this kind of functionality in Aquamacs?

ESS has more font-locking (syntax highlighting) than what you see;
unless you are wedded to Aquamacs, have you tried the version of Emacs
built by Vincent Goulet:
  http://vgoulet.act.ulaval.ca/en/ressources/emacs/mac 

this should work nicely.



> 3. It seems to bit complicated to keep pressing C-c all the time, is
> there a way to make a shortcut key (e.g when pressing Alt-S an area of
> code is sent to ESS-window (into R)

sure, this falls into the general issue of rebinding keys; e.g.

(defun my-ess-hook ()
  "Add my keybindings to ESS mode."
  (local-set-key (kbd "C-j") 'ess-eval-line-and-step)
  )
(add-hook 'ess-mode-hook 'my-ess-hook)

change C-j and the function you want to sit on there accordingly.
 


I'll leave others to fill in 2 and 4!

Stephen

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Questions regarding R + Aquamacs + ESS

by johannes rara :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks. Should this function to be included in customizations.el or which file?

I found an answer to my question number 2:

I included these lines of code to customizations.el

(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq comint-move-point-for-output t)

-Johannes


2009/9/20 Stephen Eglen <S.J.Eglen@...>:

>> Hi (I did sent this post also to R-sig-mac, but I think this is the
>> right forum for this post),
>>
>> I have few questions regarding R 2.9.2 + Aquamacs + ESS. I'm moving
>> from WinXP to Mac (Snow Leopard 10.6.1) and also from Tinn-R to
>> Aquamacs (1.8c).
>>
>> 1. Is there syntax highlighting in Aqaumacs? Now when I open .R file
>> only the lines starting with comment mark (#), quoted words etc. are
>> shown in color. What about R:s reserved words? In Tinn-R these words
>> where shown blue. Is there this kind of functionality in Aquamacs?
>
> ESS has more font-locking (syntax highlighting) than what you see;
> unless you are wedded to Aquamacs, have you tried the version of Emacs
> built by Vincent Goulet:
>  http://vgoulet.act.ulaval.ca/en/ressources/emacs/mac
>
> this should work nicely.
>
>
>
>> 3. It seems to bit complicated to keep pressing C-c all the time, is
>> there a way to make a shortcut key (e.g when pressing Alt-S an area of
>> code is sent to ESS-window (into R)
>
> sure, this falls into the general issue of rebinding keys; e.g.
>
> (defun my-ess-hook ()
>  "Add my keybindings to ESS mode."
>  (local-set-key (kbd "C-j") 'ess-eval-line-and-step)
>  )
> (add-hook 'ess-mode-hook 'my-ess-hook)
>
> change C-j and the function you want to sit on there accordingly.
>
>
>
> I'll leave others to fill in 2 and 4!
>
> Stephen
>

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Questions regarding R + Aquamacs + ESS

by Vinh Nguyen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 19, 2009 at 4:26 AM, johannes rara <johannesraja@...> wrote:
>
> 2. When I evaluate an area of R code (send it to R), I press C-c C-r.
> If the area is e.g. 50 lines, I would like that the cursor in the ESS
> windows goes into an end (like pressing C-c M-r) and I don't have to
> jump back into the code window. How can I achieve this?
>
don't know what u mean here.  marking (C-space) and going down or up
creates a block, and hitting C-c M-r should send the code and take you
to the R session window.

>
> 4. Is there a way to split code window and ESS-window (R) vertically
> (side to side)? The default split is horizontally.
this is one of the features of emacs.  try C-x 3.

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Questions regarding R + Aquamacs + ESS

by johannes rara :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/9/20 Vinh Nguyen <vqnguyen@...>:

> On Sat, Sep 19, 2009 at 4:26 AM, johannes rara <johannesraja@...> wrote:
>>
>> 2. When I evaluate an area of R code (send it to R), I press C-c C-r.
>> If the area is e.g. 50 lines, I would like that the cursor in the ESS
>> windows goes into an end (like pressing C-c M-r) and I don't have to
>> jump back into the code window. How can I achieve this?
>>
> don't know what u mean here.  marking (C-space) and going down or up
> creates a block, and hitting C-c M-r should send the code and take you
> to the R session window.
>
>>
>> 4. Is there a way to split code window and ESS-window (R) vertically
>> (side to side)? The default split is horizontally.
> this is one of the features of emacs.  try C-x 3.
>

Thanks!!! That was exactly what I was lookin for!

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Questions regarding R + Aquamacs + ESS

by Vinh Nguyen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hey johannes,

i guess i understand your question number 2.  when sending code via
C-c M-r, sometimes the cursor doesn't go to the end of R session
buffer.  i had the same problem since using emacs 23.  i placed those
comint variables in my .emacs file and the cursor is going to the
bottom now.  this works for me, thanks.

vinh

On Sun, Sep 20, 2009 at 8:08 AM, johannes rara <johannesraja@...> wrote:

> Thanks. Should this function to be included in customizations.el or which file?
>
> I found an answer to my question number 2:
>
> I included these lines of code to customizations.el
>
> (setq comint-scroll-to-bottom-on-input t)
> (setq comint-scroll-to-bottom-on-output t)
> (setq comint-move-point-for-output t)
>
> -Johannes
>
>
> 2009/9/20 Stephen Eglen <S.J.Eglen@...>:
>>> Hi (I did sent this post also to R-sig-mac, but I think this is the
>>> right forum for this post),
>>>
>>> I have few questions regarding R 2.9.2 + Aquamacs + ESS. I'm moving
>>> from WinXP to Mac (Snow Leopard 10.6.1) and also from Tinn-R to
>>> Aquamacs (1.8c).
>>>
>>> 1. Is there syntax highlighting in Aqaumacs? Now when I open .R file
>>> only the lines starting with comment mark (#), quoted words etc. are
>>> shown in color. What about R:s reserved words? In Tinn-R these words
>>> where shown blue. Is there this kind of functionality in Aquamacs?
>>
>> ESS has more font-locking (syntax highlighting) than what you see;
>> unless you are wedded to Aquamacs, have you tried the version of Emacs
>> built by Vincent Goulet:
>>  http://vgoulet.act.ulaval.ca/en/ressources/emacs/mac
>>
>> this should work nicely.
>>
>>
>>
>>> 3. It seems to bit complicated to keep pressing C-c all the time, is
>>> there a way to make a shortcut key (e.g when pressing Alt-S an area of
>>> code is sent to ESS-window (into R)
>>
>> sure, this falls into the general issue of rebinding keys; e.g.
>>
>> (defun my-ess-hook ()
>>  "Add my keybindings to ESS mode."
>>  (local-set-key (kbd "C-j") 'ess-eval-line-and-step)
>>  )
>> (add-hook 'ess-mode-hook 'my-ess-hook)
>>
>> change C-j and the function you want to sit on there accordingly.
>>
>>
>>
>> I'll leave others to fill in 2 and 4!
>>
>> Stephen
>>
>
> ______________________________________________
> ESS-help@... mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: Questions regarding R + Aquamacs + ESS

by Martin Maechler-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>>> "jr" == johannes rara <johannesraja@...>
>>>>>     on Sat, 19 Sep 2009 14:26:11 +0300 writes:

    jr> Hi (I did sent this post also to R-sig-mac, but I think
    jr> this is the right forum for this post),

    jr> I have few questions regarding R 2.9.2 + Aquamacs +
    jr> ESS. I'm moving from WinXP to Mac (Snow Leopard 10.6.1)
    jr> and also from Tinn-R to Aquamacs (1.8c).

    jr> 1. Is there syntax highlighting in Aqaumacs? Now when I
    jr> open .R file only the lines starting with comment mark
    jr> (#), quoted words etc. are shown in color. What about
    jr> R:s reserved words? In Tinn-R these words where shown
    jr> blue. Is there this kind of functionality in Aquamacs?

You may be used to it (Tinn-R's behavior) but note that R
has practically *NO* reserved words (*) and Tinn-R colorizes
(AFAIK, I'm not using it) several thousand of function names,
from 'base' and 'stats' .. packages.
These are not reserved in the strict sense, and with a
system as R and the 2000 CRAN+bioconductor packages, it's not
clear what names you should consider part of the language, and
which to be "user extentions", e.g., should 'lmer' be colorized
(Emacs language "fontified") or not?

Should the fontification happen for all standard + recommended
packages (but e.g., 'lme4' is not among those), or rather
for all objects that are currently visible in search() ?

In the end, I quite like the fact that ESS does not fontify too
many of these..

Martin

-----
(*)  The 'R Language Manual',  section 'Reserved Words'
     (currently 10.3.3) contains

 > The following identifiers have a special meaning and cannot be used for
 > object names
 >
 >      if else repeat while function for in next break
 >      TRUE FALSE NULL Inf NaN
 >      NA NA_integer_ NA_real_ NA_complex_ NA_character_
 >      ... ..1 ..2 etc.

______________________________________________
ESS-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help