Sample emacs init file to have scala support
;;; Fawzi's setup
;; global variables
(setq
inhibit-startup-screen t
column-number-mode t
scroll-error-top-bottom t
use-package-always-ensure t)
(set-language-environment "UTF-8")
; work around for bug that made accented characters not typeable
(require 'iso-transl)
; mac fixes
(when (eq system-type 'darwin)
(setq mac-right-option-modifier 'none) ; use right alt as alt on mac
(add-to-list 'exec-path "/usr/local/bin") ; add brew stuff to the exec path
)
(setq user-mail-address "fawzi.mohamed@fhi-berlin.mpg.de")
;; use only spaces, no tabs to indent
(setq-default indent-tabs-mode nil)
;; Melpa
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
;; ensime
;(add-to-list 'package-archives
; '("melpa" . "http://melpa.milkbox.net/packages/") t)
;(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(package-initialize)
;(dolist (el '(json-mode scala-mode whitespace-cleanup-mode flx-ido ido-vertical-mode projectile sbt-mode flycheck ensime) nil)
; (unless (package-installed-p el)
; (package-refresh-contents) (package-install el))
; )
(unless (package-installed-p 'use-package)
(package-refresh-contents) (package-install 'use-package))
(require 'use-package)
(use-package json-mode :pin melpa-stable)
(use-package scala-mode
:pin melpa-stable)
(use-package whitespace-cleanup-mode
:pin melpa-stable
:config
(global-whitespace-cleanup-mode)
)
;(use-package flx-ido :pin melpa-stable)
(use-package ido-vertical-mode
:pin melpa-stable
:config
(ido-mode 1)
(ido-vertical-mode 1)
(setq ido-vertical-define-keys 'C-n-C-p-up-and-down)
)
(use-package projectile
:pin melpa-stable
:config
(projectile-global-mode)
)
(use-package sbt-mode :pin melpa-stable)
(use-package flycheck
:pin melpa-stable
:config
;(add-hook 'scala-mode-hook 'flycheck-mode)
(add-hook 'python-mode-hook 'flycheck-mode)
)
(use-package ensime
:pin melpa-stable
:config
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
)
;(use-package flx-ido
; :config (flx-ido-mode 1)
; ;; disable ido faces to see flx highlights.
; (setq ido-enable-flex-matching t)
; (setq ido-use-faces nil))
(global-set-key (kbd "M-g") 'goto-line)
;; cleanup whitespace of edited pieces of a file
;; spelling
(use-package ispell
:config
(add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
"[[:alpha:]]"
"[^[:alpha:]]"
"[']"
t
("-d" "de_DE"); Dictionary file name
nil
iso-8859-1))
(add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
"[[:alpha:]]"
"[^[:alpha:]]"
"[']"
t
("-d" "en_US")
nil
iso-8859-1))
(setq ispell-program-name "hunspell" ; Use hunspell to correct mistakes
ispell-dictionary "english-hunspell") ; Default dictionary to use
(add-hook 'scala-mode-hook 'flyspell-prog-mode)
(add-hook 'fundamental-mode-hook 'flyspell-mode)
(add-hook 'latex-mode-hook 'flyspell-mode)
(add-hook 'markdown-mode-hook 'flyspell-mode)
(add-hook 'python-mode-hook 'flyspell-prog-mode)
)
;; setup files ending in “.md” to open in markdown-mode
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))