Skip to content

Instantly share code, notes, and snippets.

@twonds
Created October 13, 2015 04:02
Show Gist options
  • Save twonds/8894262a92a36cceb201 to your computer and use it in GitHub Desktop.
Save twonds/8894262a92a36cceb201 to your computer and use it in GitHub Desktop.
save my emacs file
;;Required plugins:
;Erlang OTP, color-theme, distel, auto-complete-distel
;
;; Erlang
(setq load-path (cons "/otp/17.4/lib/tools-2.7.1/emacs" load-path))
(setq erlang-root-dir "/otp/17.4/")
(setq inhibit-splash-screen t)
(setq exec-path (cons "/otp/R15B/lib/erlang/bin" exec-path))
(require 'erlang-start)
;;Indenting
(setq indent-tabs-mode nil)
(setq-default indent-tabs-mode nil)
(add-to-list 'load-path "~/.emacs.d/")
;;(require 'color-theme)
;;(load-file "~/.emacs.d/themes/color-theme-tangotango.el")
;;(color-theme-initialize)
;;(color-theme-tangotango)
;;Distel
;;(add-to-list 'load-path "/usr/local/share/distel/elisp")
;;(require 'distel)
;;(distel-setup)
(setq inferior-erlang-machine-options '("-sname" "emacs"))
(setq derl-cookie "ejabberd")
;;IDO
(require 'ido)
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1);;Various
;; Current row and column in statusbar
(column-number-mode t)
;; Matching parentheses
(show-paren-mode t)
;; Highlight current line
;;(global-hl-line-mode 1)
;;(set-face-background 'hl-line "#FFFFFFF")
;; Don't highlight selection
(setq-default transient-mark-mode nil)
;; Remove menu bar
(menu-bar-mode 0)
;; Do not break lines
(setq truncate-lines t)
(setq truncate-partial-width-windows t)
;; Line numbers
;;(require 'linum)
;;(global-linum-mode 1)
;;Show whitespaces
(require 'whitespace)
(setq whitespace-style '(face trailing))
(global-whitespace-mode t)
;;Autocomplete
;;(add-to-list 'load-path "~/.emacs.d/")
;;(require 'auto-complete-config)
;;(ac-config-default)
;;(add-to-list 'ac-modes 'erlang-mode)
;;(setq ac-auto-start nil)
;;(ac-set-trigger-key "TAB")
;;(add-to-list 'ac-dictionary-directories "~/.emacs.d/plugins/ac-dict")
;;Autocomplete shortcuts
;;(setq ac-use-menu-map t)
;;(define-key ac-menu-map "\C-n" 'ac-next)
;;(define-key ac-menu-map "\C-p" 'ac-previous)
;;Autocomplete-distel
;;(require 'auto-complete-distel)
;;(defun ac-distel-setup ()
;; (setq ac-sources '(ac-source-distel)))
;;(add-hook 'erlang-mode-hook 'ac-distel-setup)
;;(add-hook 'erlang-shell-mode-hook 'ac-distel-setup)
;;Flymake
;;(require 'flymake)
;;(defun flymake-erlang-init ()
;; (let* ((temp-file (flymake-init-create-temp-buffer-copy
;; 'flymake-create-temp-inplace))
;; (local-file (file-relative-name temp-file
;; (file-name-directory buffer-file-name))))
;; (list "/Users/bartek/dev/erlsom/flymake.escript" (list local-file))))
;;(add-to-list 'flymake-allowed-file-name-masks '("\\.erl\\'" flymake-erlang-init))
(require 'erlang-flymake)
(setq erlang-flymake-get-include-dirs-function
'includes-list)
;;(setq erlang-flymake-get-code-path-dirs-function
;; 'codepath-list)
(defun includes-list ()
'("include" "." "../include"))
;;Shortcuts
;;(global-set-key (kbd "C-z") 'undo)
;;(global-set-key (kbd "M-l") 'goto-line)
;;(global-set-key (kbd "M-k") 'kill-line)
;;(global-unset-key (kbd "C-j"))
;;(global-set-key (kbd "C-o") 'previous-line)
;;(global-set-key (kbd "C-j") 'backward-char)
;;(global-set-key (kbd "C-k") 'next-line)
;;(global-set-key (kbd "C-l") 'forward-char)
;;(global-set-key (kbd "C-M-o") 'backward-paragraph)
;;(global-set-key (kbd "C-M-k") 'forward-paragraph)
;;(global-set-key (kbd "C-M-l") 'forward-word)
;;(global-set-key (kbd "C-M-j") 'backward-word)
;;(global-set-key (kbd "C-p") 'delete-backward-char)
;;(global-set-key (kbd "C-M-p") 'delete-forward-char)
(global-set-key (kbd "C-x m") 'erlang-man-function)
(setq compilation-read-command nil)
(global-set-key (kbd "C-x C-k") 'compile)
(add-hook 'erlang-mode-hook
(lambda()
(set (make-local-variable 'compile-command)
(concat "/Users/bpuzon/extras/bp-compile-load " (buffer-file-name (current-buffer))))))
(winner-mode 1)
(defun compile-autoclose (buffer string)
(cond ((string-match "finished" string)
(bury-buffer "*compilation*")
(winner-undo)
(message "Build successful."))
(t
(message "Compilation exited abnormally: %s" string))))
(setq compilation-finish-functions 'compile-autoclose)
(setq undo-limit 300000)
(setq undo-strong-limit 500000)
;;(require 'php-mode)
;;Not under MAC
;; Dont show toolbar
;;(tool-bar-mode -1)
(set-foreground-color "white")
(set-background-color "black")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment