[ESS] R code folding with hideshow-org.el

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Thu Apr 2 17:55:14 CEST 2009


hi Tom,
thanks for mentioning hideshow and org, I'd not really used either of
these packages before.  Does it work for you okay in R functions?  

Shift-tab works okay to hide all the function  definitions, but if I am
on the top line of a function TAB works only if I'm near the brace:

e.g. in

small <- function(x, y) {
  x +y
}

If I hit TAB, it works only if my cursor is near {, rather than at the
start of the line.

> (add-hook 'ess-mode-hook 'hs-org/minor-mode) ;; starts for ESS files
> 
> The last line doesn't work initially for me (no autostart), but if I
> start it manually once, then it seems to work fine. I don't know why.

To help with your set up issue, perhaps the following is better:

(add-hook 'ess-mode-hook '(lambda ()
			    (hs-org/minor-mode 1)))

Also, in the following, should the comment regexp be a hash, rather than
C's standard /*  ... */ notation?

(add-to-list 'hs-special-modes-alist
             '(ess-mode "{" "}" "/[*/]" nil
               hs-c-like-adjust-block-beginning))

Thanks again,
Stephen




More information about the ESS-help mailing list