Hi all --

Is there a way to add specific hooks to different ESS modes -- ie.
SAS/Stata/S? there is ess-mode-hook, but I think that applies to all?

Basically I am looking at the outline-minor-mode, for which there was a nice
piece of code on the wiki and in archives here (I had to modify it though,
b/o for some reason it did not work for me, for the reference my modified
piece is below), it defines the level 1 heading as starting from "#####",
level 2 as "####", and level 3 as user function, and is actually quite neat
and handy. Then it could look somewhat like this when collapsed:
##### SOME BIG SECTION ################### ...
#### small section ...
f1 <- function(x) { ...
f2 <- function(x,y) { ...
#### another small section ...
##### SECOND BIG SECTION ################# ...
etc. The tab cycle visibility from org-mode is sorely missed, but it's still
a big help with longish programs.

Now, it would be nice to have that for SAS and Stata too; I guess perhaps
smth like "*****"=1, "****"=2, "\W*%macro"=3, "\W*(whatever is the Stata
function syntax)"=3  maybe? Perhaps also "\W*data" and \W*proc =4...

But I'm not sure how to add specific hooks for those modes :(

--aj

PS. this is what I have in my .emacs right now -- the original version
complained saying something about the number of arguments...

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

;; Simpler keybindings with the win key: (global for now, FIXME!!)
;; probably some might not work right on actual windows...

(global-set-key (kbd "s-a") 'show-all)

(global-set-key (kbd "s-T") 'hide-body)     ;; Hide all body but not subh.
(global-set-key (kbd "s-t") 'hide-other)    ;; Hide all but current+top

(global-set-key (kbd "s-d") 'hide-subtree)  ;; hide body and subh.
(global-set-key (kbd "s-s") 'show-subtree)  ;; show body and subheadings
(global-set-key (kbd "s-D") 'hide-leaves)   ;; hide body from subheadings
(global-set-key (kbd "s-S") 'show-branches) ;; show subheadings w/o body

(global-set-key (kbd "s-b") 'outline-backward-same-level)
(global-set-key (kbd "s-f") 'outline-forward-same-level)
(global-set-key (kbd "s-B") 'outline-up-heading)

(global-set-key (kbd "s-p") 'outline-previous-visible-heading)
(global-set-key (kbd "s-n") 'outline-next-visible-heading)
(global-set-key (kbd "s-P") 'outline-previous-heading)
(global-set-key (kbd "s-N") 'outline-next-heading)

	[[alternative HTML version deleted]]

