72 lines
3.3 KiB
EmacsLisp
72 lines
3.3 KiB
EmacsLisp
;; (C) Copyright Collin J. Doering 2014
|
|
;;
|
|
;; This program is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
;;
|
|
;; This program is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
;;
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
;; File: init.el
|
|
;; Author: Collin J. Doering <collin.doering@rekahsoft.ca>
|
|
;; Date: Oct 21, 2014
|
|
|
|
(defun load-directory (directory)
|
|
"Load recursively all `.el' files in DIRECTORY."
|
|
(dolist (element (directory-files-and-attributes directory nil nil nil))
|
|
(let* ((path (car element))
|
|
(fullpath (concat directory "/" path))
|
|
(isdir (car (cdr element)))
|
|
(ignore-dir (or (string= path ".") (string= path ".."))))
|
|
(cond
|
|
((and (eq isdir t) (not ignore-dir))
|
|
(load-directory fullpath))
|
|
((and (eq isdir nil) (string= (substring path -3) ".el"))
|
|
(load (file-name-sans-extension fullpath)))))))
|
|
|
|
;; Set repos for package.el
|
|
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
|
|
("marmalade" . "http://marmalade-repo.org/packages/")
|
|
("melpa" . "http://melpa.milkbox.net/packages/")
|
|
("ELPA" . "http://tromey.com/elpa/")))
|
|
|
|
;; This needs to be a the start of ~/.emacs since package-initialize is run after the user
|
|
;; init file is read but before after-init-hook. It autoloads packages installed by
|
|
;; package.el including updating the load-path and running/loading/requiring
|
|
;; pkgname-autoload.el for all packages (where pkgname is replaced with the appropriate
|
|
;; package name). To disable package.el's autoloading functionality use:
|
|
;; (setq package-enabled-at-startup nil)
|
|
;; The reason to use package-initialize here is so one can modify the installed modules
|
|
;; later in this .emacs file but still retain the autoloading functionality of package.el
|
|
(package-initialize)
|
|
|
|
;; Variables and functions that will be used in files in config folder
|
|
;; Note: This should be put into another file (eg. lib.el) that could be loaded from here
|
|
;; adds the given function mode to each element of the given-hooks
|
|
|
|
(defun activate-mode-with-hooks (mode given-hooks)
|
|
(while given-hooks
|
|
(add-hook (car given-hooks)
|
|
mode)
|
|
(setq given-hooks (cdr given-hooks))))
|
|
|
|
;; code-modes is a list of mode hooks (for programming langs only)
|
|
(defvar code-modes '(sml-mode-hook scheme-mode-hook emacs-lisp-mode-hook c-mode-hook c++-mode-hook python-mode-hook lua-mode-hook python-mode-hook haskell-mode-hook php-mode-hook perl-mode-hook lisp-mode-hook clojure-mode-hook ruby-mode-hook erlang-mode-hook sh-mode-hook java-mode-hook scala-mode-hook js-mode-hook))
|
|
|
|
;; Load ~/.emacs.d/site-list-extra which contains various .el files
|
|
;; that aren't (yet) available through packages
|
|
(add-to-list 'load-path "~/.emacs.d/site-lisp-extra")
|
|
|
|
;; Load all .el config files
|
|
(load-directory "~/.emacs.d/config")
|
|
|
|
;; Load customization's made by customize
|
|
(setq custom-file "~/.emacs.d/custom.el")
|
|
(load custom-file)
|