ambevar-dotfiles/.emacs.d/init.el

111 lines
4.2 KiB
EmacsLisp
Raw Normal View History

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Emacs config
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar my-keys-minor-mode-map (make-keymap)
"Keymap for my-keys-minor-mode. See its docstring for more
details.")
(define-minor-mode my-keys-minor-mode
"A minor mode so that all bindings assingned on the
my-keys-minor-mode-map override undesired major modes
bindings. We use a minor mode to override global keys. This is
also rather useful to list all personal global bindings: just
rgrep `my-keys-minor-mode-map' over `~/.emacs.d'.
Example: to assign some-function to C-i, use
(define-key my-keys-minor-mode-map (kbd \"C-i\") 'some-function)"
t " my-keys" 'my-keys-minor-mode-map)
(add-hook 'minibuffer-setup-hook (lambda () (my-keys-minor-mode 0) ) )
2013-07-03 14:04:51 +02:00
(defvar emacs-cache-folder "~/.cache/emacs/"
"Cache folder is everything we do not want to track along with
the configuration files.")
2013-06-16 14:27:14 +02:00
(if (not (file-directory-p emacs-cache-folder))
2013-06-12 22:56:30 +02:00
(make-directory emacs-cache-folder t))
2014-02-12 17:37:43 +01:00
;; Load config easily.
(add-to-list 'load-path "~/.emacs.d")
2013-06-12 23:40:20 +02:00
;; Local plugin folder for quick install. All files in this folder will be
;; accessible to Emacs config.
(add-to-list 'load-path "~/.emacs.d/plugins")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load main config
2014-02-13 17:22:52 +01:00
(load "functions" nil t)
(load "main" nil t)
(load "theme" nil t)
(load "personal" nil t)
2014-02-13 15:56:13 +01:00
;; (load "snippets" nil t)
2014-02-12 17:48:29 +01:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Modes config
2014-02-12 17:48:29 +01:00
(add-hook 'c-mode-hook (lambda () (require 'mode-cc)))
(add-hook 'c++-mode-hook (lambda () (require 'mode-cc)))
(add-hook 'perl-mode-hook (lambda () (require 'mode-perl)))
(add-hook 'python-mode-hook (lambda () (require 'mode-python)))
(add-hook 'shell-mode-hook (lambda () (require 'mode-shell)))
(add-hook 'tex-mode-hook (lambda () (require 'mode-tex)))
(add-hook 'texinfo-mode-hook (lambda () (require 'mode-texinfo)))
(add-hook 'org-mode-hook (lambda () (require 'mode-org)))
(add-hook 'ediff-mode-hook (lambda () (require 'mode-ediff)))
(add-hook 'octave-mode-hook (lambda () (require 'mode-octave)))
(add-hook 'dired-mode-hook (lambda () (require 'mode-dired)))
(add-hook 'gud-mode-hook (lambda () (require 'mode-gud)))
(add-hook 'eshell-mode-hook (lambda () (require 'eshell-markdown)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Extra modes
(when (require 'go-mode nil t)
(add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode)))
(when (require 'lua-mode nil t)
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode)))
(when (require 'markdown-mode nil t)
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
;; If we need more option, add it to dedicated file.
(set (make-local-variable 'paragraph-start) "
"))
;; .po support. This mode has no hooks.
(when (require 'po-mode nil t)
(add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode)))
(when (require 'po-find-file-coding-system nil t)
(modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\." 'po-find-file-coding-system))
(when (require 'bison-mode nil t)
(add-to-list 'auto-mode-alist '("\\.yy?\\'" . bison-mode)))
(when (require 'flex-mode nil t)
(add-to-list 'auto-mode-alist '("\\.l\\'" . flex-mode)))
(when (require 'glsl-mode nil t)
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.glsl\\'" . glsl-mode)))
;; This mode has no 'provide'.
(when (autoload 'graphviz-dot-mode "graphviz-dot-mode" "Dot mode." t)
(add-to-list 'auto-mode-alist '("\\.dot\\'" . graphviz-dot-mode))
(add-hook 'dot-mode-hook (lambda () (require 'mode-dot))))
(when (require 'mediawiki nil t)
(add-to-list 'auto-mode-alist '("\\.wiki\\'" . mediawiki-mode))
(add-hook 'mediawiki-mode-hook (lambda () (require 'mode-mediawiki))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; We need to put it at the end to make sure it doesn't get overriden by other
;; minor modes.
(my-keys-minor-mode 1)
;; End of file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;