Skip to content

Instantly share code, notes, and snippets.

@ieure
Created November 2, 2011 18:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ieure/1334458 to your computer and use it in GitHub Desktop.
Save ieure/1334458 to your computer and use it in GitHub Desktop.
scala-defuns.el
(defun scala-beginning-of-defun (&optional arg)
(re-search-backward "\\(\\(case\\s*\\)?class\\|def\\)" nil t arg))
(defun scala-end-of-defun (&optional arg)
(scala-beginning-of-defun)
(goto-char (- (search-forward "{") 1))
(forward-sexp))
(eval-after-load "scala-mode"
(add-hook 'scala-mode-hook
(lambda ()
(set (make-local-variable 'beginning-of-defun-function) 'scala-beginning-of-defun)
(set (make-local-variable 'end-of-defun-function) 'scala-end-of-defun))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment