Skip to content

Assignment arrow

6 messages · John Shonder, Duncan Murdoch, Simon Urbanek +3 more

#
To use R on my Mac, I had been running ESS in emacs
under X11. I found R.app, and much prefer it --
especially the quartz graphics -- but there's one
thing I miss about ESS: to get an assignment arrow
"<-" you just type shift underscore. In R.app, you
have to type the less than sign (shift-comma) followed
by the dash. Coming over from ESS, the extra keystroke
bothers me.

Is there an easier way to type an assignment arrow in
R.app? Some way to make a keyboard macro perhaps? I've
looked through the FAQ and can't find anything. I
appreciate any assistance.

John


 
____________________________________________________________________________________
Cheap talk?
#
On 2/10/2007 6:25 PM, John Shonder wrote:
You could switch to using "=" instead of "<-", but as a non-ESS user, I 
think just typing "<-" ends up being pretty quick after you get used to it.

Duncan Murdoch
17 days later
#
John,
On Feb 10, 2007, at 6:25 PM, John Shonder wrote:

            
To be honest IMHO it's one of the annoying "features" in ESS  
(configurable, though, I presume), because "_" is a valid character  
used in names, so you end up getting broken code like .Platform$r <-  
arch instead of the intended .Platform$r_arch when copy/pasting code.  
In old times it was legal to use _ instead of <-, so ESS was helping  
to make your code more legible without changing the syntax (a_10 was  
the same as a <- 10), but that is not true anymore.
= is probably the best one-key alternative in most cases.

Unfortunately adding a "macro"-type thing is not that easy in the  
current setup (e.g. I could imagine using something like <alt>+<=> or  
possibly better <alt>+<->), but I'll see if it is easier for the  
upcoming version 2 of the GUI.

Cheers,
Simon
#
I think adding the hooks shouldn't be too bad in v2. Personally I was
thinking more about TextMate style completions and macros because I'm
not a big fan of the _ "feature" either, though the rcompgen stuff I
added last night maybe makes that redundant.

Of course, v2 can simply be driven from ESS (I changed the detection
routine so it should be able to figure out it's running under Emacs
without any help).
On 2/28/07, Simon Urbanek <simon.urbanek at r-project.org> wrote:

  
    
#
Simon Urbanek <simon.urbanek at r-project.org> writes:
I agree about the default setting in ESS being annoying.  I have the
following in my .emacs:

    ;; leave my underscore key alone!
    (ess-toggle-underscore nil)
    (setq ess-S-assign-key [?\C-=])

This way, <_> is itself and <ctrl>+<=> gives <- and <=> gives =.

+ seth
#
On 2/28/07, Seth Falcon <sfalcon at fhcrc.org> wrote:
This isn't really an ESS discussion but I will point out that if you
want an underscore character in ESS you can get it by typing two
consecutive underscores.  The first one gets changed into ' <- ' and
the second reverts to '_'.