2012-06-15 16:54:02 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Emacs config
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2013-06-11 17:07:01 +02:00
|
|
|
(defvar my-keys-minor-mode-map (make-keymap)
|
|
|
|
"Keymap for my-keys-minor-mode. See its docstring for more
|
|
|
|
details.")
|
2013-06-07 20:17:26 +02:00
|
|
|
|
|
|
|
(define-minor-mode my-keys-minor-mode
|
2013-06-11 17:07:01 +02:00
|
|
|
"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
|
2013-06-07 20:17:26 +02:00
|
|
|
|
2013-06-11 17:07:01 +02:00
|
|
|
(define-key my-keys-minor-mode-map (kbd \"C-i\") 'some-function)"
|
|
|
|
t " my-keys" 'my-keys-minor-mode-map)
|
2013-06-07 20:17:26 +02:00
|
|
|
(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.
|
2013-02-27 18:44:46 +01:00
|
|
|
(add-to-list 'load-path "~/.emacs.d/plugins")
|
2012-10-12 13:47:10 +02:00
|
|
|
|
2014-02-12 18:31:00 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Load main config
|
|
|
|
|
2014-02-13 17:22:52 +01:00
|
|
|
(load "functions" nil t)
|
2014-02-12 18:31:00 +01:00
|
|
|
(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
|
|
|
|
2014-02-12 18:31:00 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-02-23 10:50:56 +01:00
|
|
|
;; Vanilla modes
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
;; Major modes
|
2014-02-21 15:23:25 +01:00
|
|
|
(add-hook 'c++-mode-hook (lambda () (require 'mode-cc)))
|
|
|
|
(add-hook 'c-mode-hook (lambda () (require 'mode-cc)))
|
|
|
|
(add-hook 'latex-mode-hook (lambda () (require 'mode-latex)))
|
|
|
|
(add-hook 'perl-mode-hook (lambda () (require 'mode-perl)))
|
|
|
|
(add-hook 'python-mode-hook (lambda () (require 'mode-python)))
|
2014-02-23 14:00:16 +01:00
|
|
|
(add-hook 'sh-mode-hook (lambda () (require 'mode-sh)))
|
2014-02-21 15:23:25 +01:00
|
|
|
(add-hook 'tex-mode-hook (lambda () (require 'mode-tex)))
|
2014-02-12 17:48:29 +01:00
|
|
|
(add-hook 'texinfo-mode-hook (lambda () (require 'mode-texinfo)))
|
2013-01-08 23:57:55 +01:00
|
|
|
|
2014-02-26 17:22:42 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Major modes pre-loading config.
|
|
|
|
|
|
|
|
;; sh-shell-file is initialized to the environment variable SHELL when sh-mode
|
|
|
|
;; is started with file without extension nor shabang. Since this the hook is
|
|
|
|
;; executed afterward, changing sh-shell-file in it will not alter the first
|
|
|
|
;; opened file.
|
|
|
|
(setq sh-shell-file "/bin/sh")
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-02-21 15:23:25 +01:00
|
|
|
;; Minor modes
|
|
|
|
(add-hook 'dired-mode-hook (lambda () (require 'mode-dired)))
|
|
|
|
(add-hook 'ediff-mode-hook (lambda () (require 'mode-ediff)))
|
|
|
|
(add-hook 'eshell-mode-hook (lambda () (require 'mode-eshell)))
|
|
|
|
(add-hook 'gud-mode-hook (lambda () (require 'mode-gud)))
|
2014-02-12 18:31:00 +01:00
|
|
|
(add-hook 'octave-mode-hook (lambda () (require 'mode-octave)))
|
2014-02-21 15:23:25 +01:00
|
|
|
(add-hook 'org-mode-hook (lambda () (require 'mode-org)))
|
2014-02-12 18:31:00 +01:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-02-23 10:50:56 +01:00
|
|
|
;; Third-party modes
|
2014-02-12 18:31:00 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
;; TODO: implement function for loading and add support for fallback mode.
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
(autoload 'bison-mode "bison-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.yy?\\'" . bison-mode))
|
|
|
|
(autoload 'flex-mode "flex-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.l\\'" . flex-mode))
|
2014-02-12 18:31:00 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
(autoload 'glsl-mode "glsl-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.vert\\'\\|\\.frag\\'\\|\\.glsl\\'" . glsl-mode))
|
2014-02-12 18:31:00 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
(autoload 'go-mode "go-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
;; Note that graphviz-mode has no 'provide'.
|
|
|
|
(autoload 'graphviz-dot-mode "graphviz-dot-mode" "Dot mode." t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.dot\\'" . graphviz-dot-mode))
|
|
|
|
(add-hook 'graphviz-dot-mode-hook (lambda () (require 'mode-dot)))
|
2014-02-13 16:30:05 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
(autoload 'lua-mode "lua-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
(autoload 'markdown-mode "markdown-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.md\\'\\|\\.markdown\\'" . markdown-mode))
|
|
|
|
;; If we need more option, add it to a dedicated file.
|
|
|
|
(add-hook 'markdown-mode-hook (lambda () (set (make-local-variable 'paragraph-start) "
|
|
|
|
")))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2014-02-23 10:50:56 +01:00
|
|
|
(autoload 'mediawiki-mode "mediawiki-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.wiki\\'" . mediawiki-mode))
|
|
|
|
(add-hook 'mediawiki-mode-hook (lambda () (require 'mode-mediawiki)))
|
2014-02-13 16:30:05 +01:00
|
|
|
|
2014-02-21 15:23:25 +01:00
|
|
|
;; .po support. This mode has no hooks.
|
2014-02-23 10:50:56 +01:00
|
|
|
(autoload 'po-mode "po-mode" nil t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode))
|
|
|
|
(when (fboundp 'po-find-file-coding-system)
|
2014-02-21 15:23:25 +01:00
|
|
|
(modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\." 'po-find-file-coding-system))
|
|
|
|
|
2014-03-05 10:58:42 +01:00
|
|
|
|
|
|
|
|
2014-02-22 19:13:39 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-02-23 18:07:42 +01:00
|
|
|
;; Third-party tools
|
|
|
|
(autoload 'guess-style-set-variable "guess-style" nil t)
|
|
|
|
(autoload 'guess-style-guess-variable "guess-style")
|
|
|
|
(autoload 'guess-style-guess-all "guess-style" nil t)
|
|
|
|
(setq guess-style-info-mode 1)
|
2014-02-22 19:13:39 +01:00
|
|
|
|
2014-02-22 19:18:13 +01:00
|
|
|
(autoload 'pdf-view "tool-pdf" nil t)
|
|
|
|
(autoload 'pdf-compress "tool-pdf" nil t)
|
|
|
|
|
2014-02-23 20:35:36 +01:00
|
|
|
(autoload 'itranslate "tool-itranslate" nil t)
|
|
|
|
(autoload 'itranslate-lines "tool-itranslate" nil t)
|
2014-02-24 14:28:05 +01:00
|
|
|
(autoload 'itranslate-region "tool-itranslate" nil t)
|
2014-02-23 18:07:42 +01:00
|
|
|
|
2014-02-12 18:31:00 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2013-06-11 17:07:01 +02:00
|
|
|
;; We need to put it at the end to make sure it doesn't get overriden by other
|
|
|
|
;; minor modes.
|
2013-02-04 21:32:40 +01:00
|
|
|
(my-keys-minor-mode 1)
|
|
|
|
|
2013-01-08 23:57:55 +01:00
|
|
|
;; End of file
|
2013-03-02 19:34:12 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|