[erlang-questions] erlang emacs mode question

Martin Bjorklund <>
Thu Dec 17 21:15:52 CET 2009


Joe Armstrong <> wrote:
> What I'd like is "org mode erlang editing"
> hit tab on the first line of a function definition hides or reveals
> the body of the function.
> hit meta-uparrow on the first line of a function move the function up
> in the file.

You can configure outline mode to do this, sort of.  Put this in
.emacs.  Instead of <tab> as you suggested, use C-left / C-right.

This way it shows / hides each function clause as a separate item, but
you probably want to treat the complete function as one entity.  I'm
sure it is doable...

(defun show-onelevel ()
  "show entry and children in outline mode"

(defun my-outline-bindings ()
  "sets shortcut bindings for outline minor mode"
  (local-set-key [C-up] 'outline-previous-visible-heading)
  (local-set-key [C-down] 'outline-next-visible-heading)
  (local-set-key [C-left] 'hide-subtree)
  (local-set-key [C-right] 'show-onelevel))


 '(lambda ()
    (setq outline-regexp 
	  (concat "^-?" erlang-atom-regexp "\\s *("))))

[ref: http://www.emacswiki.org/emacs/EasyCodeOutline]


More information about the erlang-questions mailing list