Newer
Older
server-setup / init.el
;;; My Emacs configuration file
;;; Yeah, I have to write elisp for this! :D :-/

;; Main source for these adaptions: david.rothlis.net/emacs/customize_general.html
;; and the emacs wiki @ www.emacswiki.org


; Some sane miscellaneous settings
(ido-mode 1)
(show-paren-mode 1)
(setq make-backup-files nil)
(setenv "PAGER" "/bin/cat")

(setq line-number-mode t)
(setq column-number-mode t)
(setq linum-format "%d ")

; Tab settings
(setq-default indent-tabs-mode 0)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(setq tab-stop-list (number-sequence 4 120 4))

(setq lisp-indent-offset 4)
(setq lisp-body-indent 4)

(setq c-default-style "linux"
	c-basic-offset 4)

(setq java-default-style "linux")

(add-hook 'python-mode-hook 'guess-style-guess-tabs-mode)
(add-hook 'python-mode-hook 'linum-mode)
(add-hook 'python-mode-hook (lambda ()
			      (when indent-tabs-mode
				(guess-style-guess-tab-width))))

(add-hook 'c-mode-hook 'linum-mode)
(add-hook 'c++-mode-hook 'linum-mode)
(add-hook 'java-mode-hook 'linum-mode)
(add-hook 'lisp-mode-hook 'linum-mode)
(add-hook 'ess-mode-hook 'linum-mode)
(add-hook 'julia-mode-hook 'linum-mode)

(defun shutdown ()
	"Save buffers, Quit and Shutdown (kill) server"
	(interactive)
	(save-some-buffers)
	(kill-emacs))

; Add a command to launch a Python3 shell
(defun python-shell ()
	(interactive)
	(run-python "/usr/bin/python3 -i" t t))

; Integrate ESS
(require 'ess-site)
(setq inferior-julia-program-name "/usr/local/bin/julia")

; Redefine so I only have to type y instead of yes
(defun yes-or-no-p (prompt)
  (y-or-n-p prompt))

; Set up MELPA
(require 'package)
(add-to-list 'package-archives (cons "melpa-stable" "https://stable.melpa.org/packages/") t)
(package-initialize)

; Change the comment colour - brown is sooo ugly!
(set-face-attribute 'font-lock-comment-face nil :foreground "cyan")

; Just some fun stuff...
(setq initial-scratch-message
	";; Welcome Daniel!
;;
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; To use the latter, type a Lisp expression and the command C-j.
;; For a normal Lisp interpreter, use 'M-x ielm'.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
;;
;; Happy Hacking!

")

; GUI config
(when (display-graphic-p)
	(custom-set-variables
		;; custom-set-variables was added by Custom.
		;; If you edit it by hand, you could mess it up, so be careful.
		;; Your init file should contain only one such instance.
		;; If there is more than one, they won't work right.
		'(ansi-color-names-vector
			 ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
		'(custom-enabled-themes (quote (deeper-blue))))
	(custom-set-faces
		;; custom-set-faces was added by Custom.
		;; If you edit it by hand, you could mess it up, so be careful.
		;; Your init file should contain only one such instance.
		;; If there is more than one, they won't work right.
		))