Folding emacs

Mats Cronqvist etxmacr@REDACTED
Tue Jun 10 09:23:10 CEST 2003

  following the recent discussion about folding editors i found that putting 
this in the .emacs file will activate the emacs (21+) folding support 
(cleverly named hideshow).
  it will only fold erlang function clauses. M-h/M-u hides/unhides entire 
buffer, M-s toggles hiding of function clause at point. (bug: hiding doesn't 
work if point is on top of the function name...)


(add-hook 'erlang-mode-hook 'my-erlang-mode-hook)
(defun my-erlang-mode-hook ()
  (setq hs-special-modes-alist 
	(cons '(erlang-mode 
		"^\\([a-z][a-zA-Z0-9_]*\\|'[^\n']*[^\\]'\\)\\s *(" nil "%" 
		erlang-end-of-clause) hs-special-modes-alist))
  (hs-minor-mode 1)
  (local-set-key [?\M-s] 'hs-toggle-hiding)
  (local-set-key [?\M-h] 'hs-hide-all)
  (local-set-key [?\M-u] 'hs-show-all))

More information about the erlang-questions mailing list