Skip to content

Instantly share code, notes, and snippets.

@bryanhunter
Created June 7, 2014 18:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanhunter/6543a8e1874715de515d to your computer and use it in GitHub Desktop.
Save bryanhunter/6543a8e1874715de515d to your computer and use it in GitHub Desktop.
Emacs setup for Erlang developement
;; Where is Erlang on this machine?
(if (not (boundp 'erlang-root-dir))
(cond
((or (eq system-type 'windows-nt)(eq system-type 'ms-dos))
(setq erlang-root-dir "C:/bin/erlang/erl5.9")) ;; Windows
((eq system-type 'darwin)
(setq erlang-root-dir "/usr/local/lib/erlang")) ;; Mac
((eq system-type 'gnu/linux)
(setq erlang-root-dir "/usr/local/lib/erlang")) ;; Linux
)
)
(add-to-list 'load-path "~/.emacs.d")
(require 'my-config)
(if
(not (boundp 'erlang-root-dir))
(message "Skipping erlang-mode: erlang-root-dir not defined. To hook up erlang mode, set erlang-root-dir in your .emacs file before the call to 'require my-config'.")
(progn
(set 'erlang-bin (concat erlang-root-dir "/bin/"))
(set 'erlang-lib (concat erlang-root-dir "/lib/"))
(if
(not (boundp 'erlang-mode-path))
(set 'erlang-mode-path
(concat
erlang-lib
(file-name-completion "tools-" erlang-lib)
"emacs/erlang.el")))
(if
(and
(file-readable-p erlang-mode-path)
(file-readable-p erlang-bin))
(progn
(message "Setting up erlang-mode")
(set 'exec-path (cons erlang-bin exec-path))
(set 'load-path (cons
(concat
erlang-lib
(file-name-completion "tools-" erlang-lib)
"emacs")
load-path))
(set 'load-path (cons (file-name-directory erlang-mode-path) load-path))
(require 'erlang-start)
(require 'erlang-flymake)
(require 'erlang-eunit)
(add-hook 'erlang-mode-hook
(lambda ()
(setq inferior-erlang-machine-options
'(
"-sname" "emacs"
"-pz" "ebin deps/*/ebin apps/*/ebin"
"-boot" "start_sasl"
))
(imenu-add-to-menubar "imenu"))))
(message "Skipping erlang-mode: %s and/or %s not readable" erlang-bin erlang-mode-path)
)
)
)
(provide 'erlang)
;; Make copy mouse selection work in the usual Mac/Windows way
(cua-mode)
(setq cua-enable-cua-keys t)
(setq cua-mode-keep-region-after-copy t)
;; Don't tabify after rectangle commands
(setq cua-auto-tabify-rectangles nil)
;; Selection remains after C-c
(setq cua-keep-region-after-copy t)
;; No region when it is not highlighted
(transient-mark-mode 1)
;;Highlighting the selected line
(defface hl-line '((t (:background "gray10"))) "Face to use for `hl-line-face'." :group 'hl-line)
(setq hl-line-face 'hl-line)
(global-hl-line-mode t) ; turn it on for all modes by default
;; Select All
(global-set-key "\C-a" 'mark-whole-buffer)
(show-paren-mode t) ; light-up matching parens
(global-font-lock-mode t) ; turn on syntax highlight
(global-set-key [C-f4] (lambda () (interactive) (kill-buffer nil)))
(global-set-key "\C-w" 'kill-this-buffer)
;; Display the current row and column number at the bottom of the window
(line-number-mode 1)
(column-number-mode 1)
;; Hide the hideous Emacs splash screen
(setq inhibit-splash-screen t)
;; Hide the menu bar
(menu-bar-mode -1)
(require 'saveplace)
(setq-default save-place t)
;; Modes
(require 'erlang)
(provide 'my-config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment