legacy-dotfiles/dotemacs/.emacs

83 lines
3.2 KiB
Text
Raw Normal View History

(add-to-list 'load-path "~/.emacs.d")
;; Requires
(require 'paren)
(require 'uniquify)
(require 'autopair)
(require 'color-theme)
;; Autoloads
(autoload 'vala-mode
"vala-mode.el" "A Major mode for editing Vala files" t)
(autoload 'csharp-mode
"csharp-mode.el" "A Major mode for editing C# files" t)
(autoload 'javascript-mode
"javascript.el" "A Major mode for editing JavaScript files" t)
(autoload 'sqlplus-mode
"sqlplus,el" "A Major mode for communicating with Oracle" t)
(autoload 'batch-mode
"batch-mode.el" "A Major mode for editing Batch files" t)
(autoload 'rainbow-mode
"rainbow-mode.el" "A Minor mode for showing colors inline" t)
;; Functions
(defun what-face (pos)
"Find out which face the current position uses"
(interactive "d")
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
(defun my-comp-finish-function (buf str)
(if (string-match "exited abnormally" str)
;; there were errors
(message "compilation errors, press C-x ` to visit")
;; no errors, make the compilation window go away in 0.5 seconds
(run-at-time 0.5 nil 'delete-windwos-on buf)
(message "NO COMPILATION ERRORS!")))
;; Platform specifics
(if (eq system-type 'gnu/linux) ; if we're running linux
(set-default-font "-xos4-terminus-medium-*-*-*-14-*-*-*-*-*-*-*"))
;; Variables
(setq
inhibit-startup-message t ; don't show welcom screen
require-final-newline t ; always append a newline to a file, if it doesn't have one
font-lock-maximum-decoration t ; denotes my interest in maximum possible fontification
uniquify-buffer-name-style 'reverse ; reverse uniquify file names
backup-directory-alist `((".*" . ,temporary-file-directory)) ; backup filelocation
auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) ; autosave file location
compilation-finish-function 'my-comp-finish-function) ; show short message after compilation
(setq-default indent-tabs-mode nil) ; spaces, no tabs
(fset 'yes-or-no-p 'y-or-n-p) ; switch yes or no answers to y or n answers
;; Mode settings
( tool-bar-mode -1) ; no toolbar
( menu-bar-mode -1) ; no menu
( line-number-mode -1) ; don't show line numbers in splitter
( global-linum-mode t) ; show line numbers in gutter
( column-number-mode t) ; show column numbers in splitter
(global-font-lock-mode t) ; show syntax highlighting
( show-paren-mode t) ; show matching parens
( autopair-global-mode) ; enable autopair mode
(delete-selection-mode t) ; delete selection upon typing
;; Keybindings
(global-set-key "\C-m" 'newline-and-indent) ; Automatically indent on newline
;; File associations
(add-to-list 'auto-mode-alist '("\\.vala$" . vala-mode))
(add-to-list 'auto-mode-alist '("\\.vapi$" . vala-mode))
(add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
(add-to-list 'auto-mode-alist '("\\.bat$" . batch-mode))
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
;; Color theme
(require 'color-theme-weirdness)
(color-theme-weirdness)