I've been trying out several types of code folding in emacs, but I've never found a very good one. Folding mode seemed clunky and could sometimes break font locking it seemed. HideShow actually removes (doesn't delete of course) the lines, so the line numbers get screwed up and things like
goto-line get messed up.
This time I'm trying out
outline-minor-mode. I've tried it before and didn't really like it, but this time I've combined it with some, IMO, nice header comments.
I've written a simple skeleton to help me write these comment lines:
'(setq beginning-of-line-point (point))
'(setq beginning-of-indent-point (point))
comment-start "-----[ " str " ]"
(let ((len (- fill-column
(insert-char ?- len))
And then I add this hook:
(set (make-local-variable 'outline-regexp)
(concat "\\s *" (regexp-opt `(,comment-start)) "-----\\["))
(local-set-key [C-tab] 'outline-toggle-children)))
And whenever I load a file with these comments I get a nice and clean outline of my file.
Also, since it uses the variables
comment-endit works for multiple programming languages. I've tried it in both emacs-lisp and php.
;-----[ Prog mode ]---------------------------------------------------
What are some of the other options people use?