(require 'cl) (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")) (package-initialize) ;; -- Tweaks for OS X ------------------------------------- ;; Tweak for problem on OS X where Emacs.app doesn't run the right ;; init scripts when invoking a sub-shell (cond ((eq window-system 'ns) ; macosx ;; Invoke login shells, so that .profile or .bash_profile is read (setq shell-command-switch "-lc"))) ;; mouse (require 'xt-mouse) (xterm-mouse-mode) (require 'mouse) (xterm-mouse-mode t) (defun track-mouse (e)) (global-set-key [mouse-4] (lambda () (interactive) (scroll-down 1))) (global-set-key [mouse-5] (lambda () (interactive) (scroll-up 1))) ;; disable splash screens (setq inhibit-splash-screen t) (setq inhibit-startup-message t) (setq inhibit-startup-echo-area-message t) (setq initial-scratch-message nil) (load "/Users/louyx/.opam/system/share/emacs/site-lisp/tuareg-site-file") ;; -- opam and utop setup -------------------------------- ;; update emacs PATH so it can find opam executable (add-to-list 'exec-path "/usr/local/bin/") (add-to-list 'exec-path "/usr/louyx/.opam/system/bin/") (add-to-list 'load-path (replace-regexp-in-string "\n" "/share/emacs/site-lisp" (shell-command-to-string "/usr/local/bin/opam config var prefix"))) ;; Automatically load utop.el (autoload 'utop-minor-mode "utop" "Minor mode for utop" t) (add-hook 'tuareg-mode-hook 'utop-minor-mode) (setq tuareg-indent-align-with-first-arg nil) (setq utop-command "/usr/local/bin/opam config exec -- utop -emacs") ;; auto complete (require 'auto-complete) (ac-config-default) (global-auto-complete-mode t) ;; -- merlin setup ----------------------------------------- (let ((opam-share (ignore-errors (car (process-lines "opam" "config" "var" "share"))))) (when (and opam-share (file-directory-p opam-share)) (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share)) (autoload 'merlin-mode "merlin" nil t nil) (add-hook 'tuareg-mode-hook 'merlin-mode t) (add-hook 'caml-mode-hook 'merlin-mode t))) (setq merlin-ac-setup t)