[ESS] hide function bodies

Sven Hartenstein lists at svenhartenstein.de
Fri Jun 22 14:02:49 CEST 2007


thank you all very much for your answers concerning my folding
question. (I'm glad to having learned about Emacs' occur function from
you though I'm not sure whether I will use it for finding R

I now have this in my ~/.emacs file to enable the standard outline
mode of Emacs for .R files:

  (add-hook 'ess-mode-hook
	    '(lambda ()
	       (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function(.*{\\)")
	       (defun outline-level
		 (lambda () (interactive) (cond ((looking-at "^##### ") 1)((looking-at "^#### ") 2)((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3) (t 1000)))


This can be seen as an adapted version of Heinz Tuechler's outline
suggestion he postet on 2007-05-11 (Thank you very much, Heinz!). The
above will define the following heading levels in .R files:

lines starting with #####  --> level 1
lines starting with ####   --> level 2
R functions                --> level 3

Although R functions are no "headings" really, I still imagine this
could be a nice way of getting an overview over a larger .R file.
However, since I just started with this, I can't yet say whether it
proves useful for me.


More information about the ESS-help mailing list