indent a whole region

Rich Heiberger rmh at surfer.sbm.temple.edu
Wed Mar 20 18:38:32 CET 2002


There is a whole family of rectangle functions in emacs.
They are on the
    C-x r
family of keys
.  Use
    C-x b
to look at all the key bindings and then page down to C-x r t
which is the standard keybinding for string-rectangle.  If you use
it as often as Tim does, then it makes sense to bind it to something
shorter as he did.

For the indentation question that was originally asked the two answers
sent to the list give different appearances.  indent-region pays attention
to the formatting conventions of the language.  string-rectangle indents all
lines by the same amount.

##original
tmp <- function(x) {
y <- x^2 + 4
z <- x^2 - 4
mean(y/z,
trim=.1)
}

## standard S language indentation
## with M-x indent-region  ( C-M-\ )
tmp <- function(x) {
  y <- x^2 + 4
  z <- x^2 - 4
  mean(y/z,
       trim=.1)
}

## string-rectangle 3 spaces
   tmp <- function(x) {
   y <- x^2 + 4
   z <- x^2 - 4
   mean(y/z,
   trim=.1)
   }

tmp(10:20)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the ESS-help mailing list