                                         ; if we cannot require it, it does not exist, yet. So install it.
       (error (package-install package))))
 (package-initialize)
-(package-refresh-contents)
+(unless (file-exists-p "~/.emacs.d/elpa/archives/melpa")
+(package-refresh-contents))
 
 ;; define custom lisp directory and load all subdirectories too
 (let ((default-directory "~/.emacs.d/site-lisp/"))

;; (autoload 'python-mode "python-mode" "Python editing mode." t)
;; ;; jedi completion
;; (add-hook 'python-mode-hook 'jedi:setup)
(elpy-enable)
(elpy-use-ipython)

;; Sometimes you have to
(require 'php-mode)


(add-hook 'markdown-mode-hook 'turn-on-pandoc)

;; octave mode
;; (autoload 'octave-mode "octave-mod" nil t)
;; (setq auto-mode-alist
;;       (cons '("\\.m$" . octave-mode) auto-mode-alist))

(load-library "matlab-load")
(custom-set-variables
 '(matlab-shell-command-switches '("-nodesktop -nosplash")))
(add-hook 'matlab-mode
          (lambda ()
            (auto-complete-mode 1)
            ))
(setq auto-mode-alist
      (cons
       '("\\.m$" . matlab-mode)
            auto-mode-alist))

;; haskell mode
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
