New .emacs style
* .emacs only loops through .emacs.d and runs the *.el files there. * files are automatically compiled before loading. But only if it hasn't already been compiled. * all emacs el files, save for the startup scripts, have been moved to .emacs.d/elisp
This commit is contained in:
parent
294a0eef5d
commit
62f897fdf5
36 changed files with 163 additions and 149 deletions
149
emacs
149
emacs
|
@ -1,154 +1,23 @@
|
||||||
;; -*- mode: Emacs-Lisp; -*-
|
;; -*- mode: Emacs-Lisp; -*-
|
||||||
(add-to-list 'load-path "~/.emacs.d")
|
|
||||||
(add-to-list 'load-path "~/.emacs.d/naquadah-theme")
|
|
||||||
(add-to-list 'load-path "~/.emacs.d/auto-complete-clang")
|
|
||||||
|
|
||||||
;; Requires
|
(setq load-dir "~/.emacs.d/")
|
||||||
(require 'uniquify)
|
(setq myfiles (directory-files load-dir nil ".el$"))
|
||||||
(require 'autopair)
|
|
||||||
(require 'color-theme)
|
|
||||||
(require 'flymake)
|
|
||||||
(require 'color-theme-gruber-darker)
|
|
||||||
(require 'minimap)
|
|
||||||
(require 'column-marker)
|
|
||||||
(require 'color-theme-weirdness)
|
|
||||||
(require 'auto-complete-clang)
|
|
||||||
|
|
||||||
;; Auto complete
|
(while myfiles
|
||||||
(require 'auto-complete-config)
|
(let ((myfilename (concat load-dir (car myfiles))))
|
||||||
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
|
(if (not (file-exists-p (concat myfilename "c")))
|
||||||
(ac-config-default)
|
(byte-compile-file myfilename))
|
||||||
|
(load (substring myfilename 0 (- (length myfilename) 3)))
|
||||||
;; Autoloads
|
(setq myfiles (cdr myfiles))))
|
||||||
(autoload 'vala-mode
|
|
||||||
"vala-mode.elc" "A Major mode for editing Vala files" t)
|
|
||||||
(autoload 'csharp-mode
|
|
||||||
"csharp-mode.elc" "A Major mode for editing C# files" t)
|
|
||||||
(autoload 'javascript-mode
|
|
||||||
"javascript.elc" "A Major mode for editing JavaScript files" t)
|
|
||||||
(autoload 'sqlplus-mode
|
|
||||||
"sqlplus.elc" "A Major mode for communicating with Oracle" t)
|
|
||||||
(autoload 'batch-mode
|
|
||||||
"batch-mode.elc" "A Major mode for editing Batch files" t)
|
|
||||||
(autoload 'rainbow-mode
|
|
||||||
"rainbow-mode.elc" "A Minor mode for showing colors inline" t)
|
|
||||||
(autoload 'lua-mode
|
|
||||||
"lua-mode.elc" "A Major mode for editing Lua files" t)
|
|
||||||
|
|
||||||
;; Platform specifics
|
|
||||||
(if (eq system-type 'gnu/linux) ; if we're running linux
|
|
||||||
(set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))
|
|
||||||
|
|
||||||
;; 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 file location
|
|
||||||
auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
|
|
||||||
; autosave file location
|
|
||||||
inhibit-default-init t)
|
|
||||||
(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
|
|
||||||
(global-auto-complete-mode -1) ; don't enable autocomplete for
|
|
||||||
; everything
|
|
||||||
|
|
||||||
;; Keybindings
|
|
||||||
(global-set-key "\C-m" 'newline-and-indent) ; Automatically indent on newline
|
|
||||||
(global-set-key (kbd "C-x n r") 'narrow-to-region )
|
|
||||||
(global-set-key [C-tab] 'hs-toggle-hiding )
|
|
||||||
(global-set-key (kbd "<f9>") 'compile)
|
|
||||||
|
|
||||||
;; 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 'auto-mode-alist '("\\.lua$" . lua-mode))
|
|
||||||
|
|
||||||
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
|
|
||||||
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
|
|
||||||
|
|
||||||
(add-to-list 'compilation-finish-functions 'my-comp-finish-function)
|
(add-to-list 'compilation-finish-functions 'my-comp-finish-function)
|
||||||
|
|
||||||
;; Color theme
|
|
||||||
(require 'naquadah-theme)
|
|
||||||
|
|
||||||
;; Test for frame fonts
|
|
||||||
(defun setup-system-frame-colours (&rest frame)
|
|
||||||
(let ((f (if (car frame)
|
|
||||||
(car frame)
|
|
||||||
(selected-frame))))
|
|
||||||
(progn
|
|
||||||
(set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))))
|
|
||||||
(require 'server)
|
|
||||||
(defadvice server-create-window-system-frame
|
|
||||||
(after set-system-frame-colours ())
|
|
||||||
"Set custom frame colours when creating the first frame on a display"
|
|
||||||
(message "Running after frame-initialize")
|
|
||||||
(setup-system-frame-colours))
|
|
||||||
(ad-activate 'server-create-window-system-frame)
|
|
||||||
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
|
|
||||||
|
|
||||||
;; Hooks
|
|
||||||
(add-hook 'find-file-hook 'flymake-find-file-hook)
|
|
||||||
(add-hook 'after-save-hook
|
|
||||||
(lambda ()
|
|
||||||
(setq fname (buffer-file-name))
|
|
||||||
(setq suffix (file-name-extension fname))
|
|
||||||
|
|
||||||
(if (string-equal suffix "el")
|
|
||||||
(byte-compile-file fname))))
|
|
||||||
;;; C
|
|
||||||
(add-hook 'c-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(hs-minor-mode t)
|
|
||||||
(column-marker-1 80)
|
|
||||||
; (auto-complete-mode)
|
|
||||||
; (setq ac-sources '(ac-source-clang))
|
|
||||||
))
|
|
||||||
;;; CSS
|
|
||||||
(add-hook 'css-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(rainbow-mode)))
|
|
||||||
;;; Emacs Lisp
|
|
||||||
(add-hook 'emacs-lisp-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(auto-complete-mode t)))
|
|
||||||
;;; Interactive Lisp
|
|
||||||
(add-hook 'lisp-interaction-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(auto-complete-mode t)))
|
|
||||||
;;; Org
|
|
||||||
;(add-hook 'org-mode-hook
|
|
||||||
; (lambda ()
|
|
||||||
; (flyspell-mode 1)
|
|
||||||
; (auto-fill-mode 1)
|
|
||||||
; (message "org-mode started")))
|
|
||||||
|
|
||||||
(custom-set-variables
|
(custom-set-variables
|
||||||
;; custom-set-variables was added by Custom.
|
;; custom-set-variables was added by Custom.
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
;; Your init file should contain only one such instance.
|
;; Your init file should contain only one such instance.
|
||||||
;; If there is more than one, they won't work right.
|
;; If there is more than one, they won't work right.
|
||||||
)
|
'(org-agenda-files (quote ("~/Documents/main.org" "~/Documents/aethon/aethon.org"))))
|
||||||
(custom-set-faces
|
(custom-set-faces
|
||||||
;; custom-set-faces was added by Custom.
|
;; custom-set-faces was added by Custom.
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
|
3
emacs.d/00-paths.el
Normal file
3
emacs.d/00-paths.el
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/elisp")
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/naquadah-theme")
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/auto-complete-clang")
|
8
emacs.d/10-file-associations.el
Normal file
8
emacs.d/10-file-associations.el
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
(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 'auto-mode-alist '("\\.lua$" . lua-mode))
|
||||||
|
|
||||||
|
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
|
||||||
|
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
|
5
emacs.d/10-keys.el
Normal file
5
emacs.d/10-keys.el
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
(global-set-key "\C-m" 'newline-and-indent)
|
||||||
|
; Automatically indent on newline
|
||||||
|
(global-set-key (kbd "C-x n r") 'narrow-to-region)
|
||||||
|
(global-set-key [C-tab] 'hs-toggle-hiding)
|
||||||
|
(global-set-key (kbd "<f9>") 'compile)
|
16
emacs.d/10-modules.el
Normal file
16
emacs.d/10-modules.el
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
(require 'minimap)
|
||||||
|
(require 'naquadah-theme)
|
||||||
|
;(require 'auto-complete-clang)
|
||||||
|
|
||||||
|
(autoload 'vala-mode
|
||||||
|
"vala-mode" "A Major mode for editing Vala files" t)
|
||||||
|
(autoload 'csharp-mode
|
||||||
|
"csharp-mode" "A Major mode for editing C# files" t)
|
||||||
|
(autoload 'javascript-mode
|
||||||
|
"javascript" "A Major mode for editing JavaScript files" t)
|
||||||
|
(autoload 'sqlplus-mode
|
||||||
|
"sqlplus" "A Major mode for communicating with Oracle" t)
|
||||||
|
(autoload 'batch-mode
|
||||||
|
"batch-mode" "A Major mode for editing Batch files" t)
|
||||||
|
(autoload 'lua-mode
|
||||||
|
"lua-mode" "A Major mode for editing Lua files" t)
|
42
emacs.d/10-settings.el
Normal file
42
emacs.d/10-settings.el
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
(if (eq system-type 'gnu/linux) ; if we're running linux
|
||||||
|
(set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))
|
||||||
|
|
||||||
|
(setq inhibit-startup-message t) ; don't show welcome screen
|
||||||
|
(setq require-final-newline t) ; always append a newline to a file, if it doesn't have one
|
||||||
|
(setq font-lock-maximum-decoration t) ; denotes my interest in maximum possible fontification
|
||||||
|
(setq inhibit-default-init t) ; don't load default init
|
||||||
|
(setq indent-tabs-mode nil) ; spaces, no tabs
|
||||||
|
|
||||||
|
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
|
||||||
|
; backup file location
|
||||||
|
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
|
||||||
|
; autosave file location
|
||||||
|
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p) ; switch yes or no to y or n
|
||||||
|
|
||||||
|
(tool-bar-mode -1) ; no toolbar
|
||||||
|
(menu-bar-mode -1) ; no menubar
|
||||||
|
(line-number-mode -1) ; don't show line number in splitter
|
||||||
|
(global-linum-mode t) ; show them in the gutter
|
||||||
|
(column-number-mode t) ; show column number in splitter
|
||||||
|
(global-font-lock-mode t) ; show syntax highlighting, old
|
||||||
|
(show-paren-mode t) ; show matching parens
|
||||||
|
(delete-selection-mode t) ; delete selection upon typing
|
||||||
|
|
||||||
|
;; Byte-compile elisp files on save
|
||||||
|
(add-hook 'after-save-hook
|
||||||
|
(lambda ()
|
||||||
|
(let ((fname (buffer-file-name)))
|
||||||
|
(let ((suffix (file-name-extension fname)))
|
||||||
|
(if (string-equal suffix "el")
|
||||||
|
(byte-compile-file fname))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
12
emacs.d/20-auto-complete.el
Normal file
12
emacs.d/20-auto-complete.el
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
(require 'auto-complete-config)
|
||||||
|
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
|
||||||
|
(ac-config-default)
|
||||||
|
|
||||||
|
(global-auto-complete-mode -1)
|
||||||
|
|
||||||
|
(add-hook 'emacs-lisp-mode-hook
|
||||||
|
(lambda()
|
||||||
|
(auto-complete-mode t)))
|
||||||
|
(add-hook 'lisp-interaction-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(auto-complete-mode t)))
|
3
emacs.d/20-autopair.el
Normal file
3
emacs.d/20-autopair.el
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
(require 'autopair)
|
||||||
|
|
||||||
|
(autopair-global-mode)
|
5
emacs.d/20-column-marker.el
Normal file
5
emacs.d/20-column-marker.el
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
(require 'column-marker)
|
||||||
|
|
||||||
|
(add-hook 'c-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(column-marker-1 80)))
|
2
emacs.d/20-flymake.el
Normal file
2
emacs.d/20-flymake.el
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
(require 'flymake)
|
||||||
|
(add-hook 'find-file-hook 'flymake-find-file-hook)
|
21
emacs.d/20-org.el
Normal file
21
emacs.d/20-org.el
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
(require 'org-crypt)
|
||||||
|
|
||||||
|
(setq org-todo-keywords '((sequence "TODO" "IN PROGRESS" "|" "DONE")))
|
||||||
|
(setq org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_9.jar")
|
||||||
|
(setq org-babel-load-languages '((ditaa . t)))
|
||||||
|
(setq org-confirm-babel-evaluate nil)
|
||||||
|
(setq org-tags-exclude-from-inheritance '("crypt"))
|
||||||
|
(setq org-crypt-key "33E8CC1CC4")
|
||||||
|
; GPG key used for encryption
|
||||||
|
|
||||||
|
(global-set-key "\C-cl" 'org-store-link)
|
||||||
|
(global-set-key "\C-cc" 'org-capture)
|
||||||
|
(global-set-key "\C-ca" 'org-agenda)
|
||||||
|
|
||||||
|
;; Encrypt all entries before saving
|
||||||
|
(org-crypt-use-before-save-magic)
|
||||||
|
|
||||||
|
(add-hook 'org-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(flyspell-mode 1)
|
||||||
|
(auto-fill-mode 1)))
|
6
emacs.d/20-rainbow.el
Normal file
6
emacs.d/20-rainbow.el
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
(autoload 'rainbow-mode "rainbow-mode"
|
||||||
|
"A Minor mode for showing colors inline" t)
|
||||||
|
|
||||||
|
(add-hook 'css-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(rainbow-mode)))
|
4
emacs.d/20-uniquify.el
Normal file
4
emacs.d/20-uniquify.el
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
(require 'uniquify)
|
||||||
|
|
||||||
|
; reverse uniquify file names
|
||||||
|
(setq uniquify-buffer-name-style 'reverse)
|
15
emacs.d/30-frame-fonts.el
Normal file
15
emacs.d/30-frame-fonts.el
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
;; Test for frame fonts
|
||||||
|
(defun setup-system-frame-colours (&rest frame)
|
||||||
|
(let ((f (if (car frame)
|
||||||
|
(car frame)
|
||||||
|
(selected-frame))))
|
||||||
|
(progn
|
||||||
|
(set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))))
|
||||||
|
(require 'server)
|
||||||
|
(defadvice server-create-window-system-frame
|
||||||
|
(after set-system-frame-colours ())
|
||||||
|
"Set custom frame colours when creating the first frame on a display"
|
||||||
|
(message "Running after frame-initialize")
|
||||||
|
(setup-system-frame-colours))
|
||||||
|
(ad-activate 'server-create-window-system-frame)
|
||||||
|
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
|
3
emacs.d/40-c-mode.el
Normal file
3
emacs.d/40-c-mode.el
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
(add-hook 'c-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(hs-minor-mode t)))
|
Loading…
Reference in a new issue