2012-06-15 16:54:02 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Emacs config
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-03-08 11:48:35 +01:00
|
|
|
;; Global variables.
|
2012-06-15 16:54:02 +02:00
|
|
|
|
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)
|
2015-04-26 17:17:08 +02:00
|
|
|
(add-hook 'minibuffer-setup-hook (lambda () (my-keys-minor-mode 0)))
|
2013-06-07 20:17:26 +02:00
|
|
|
|
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.
|
2014-11-25 08:44:22 +01:00
|
|
|
(add-to-list 'load-path "~/.emacs.d/lisp")
|
2014-02-12 17:37:43 +01:00
|
|
|
|
2013-06-12 23:40:20 +02:00
|
|
|
;; Local plugin folder for quick install. All files in this folder will be
|
2014-03-08 11:48:35 +01:00
|
|
|
;; accessible to Emacs config. This is done to separate the versioned config
|
|
|
|
;; files from the external packages. For instance you can put package.el in
|
|
|
|
;; there for Emacs <24.
|
|
|
|
(add-to-list 'load-path "~/.emacs.d/local")
|
2012-10-12 13:47:10 +02:00
|
|
|
|
2014-02-12 18:31:00 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Load main config
|
|
|
|
|
2014-03-08 11:48:35 +01:00
|
|
|
(require 'functions nil t)
|
|
|
|
(require 'main nil t)
|
|
|
|
(require 'theme nil t)
|
|
|
|
(require 'personal 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-03-20 13:53:57 +01:00
|
|
|
(add-hook 'awk-mode-hook (lambda () (require 'mode-awk)))
|
|
|
|
(add-hook 'c++-mode-hook (lambda () (require 'mode-cc)))
|
|
|
|
(add-hook 'c-mode-hook (lambda () (require 'mode-cc)))
|
2014-10-31 16:51:00 +01:00
|
|
|
(add-hook 'sgml-mode-hook (lambda () (require 'mode-sgml)))
|
2014-10-31 15:15:54 +01:00
|
|
|
(add-hook 'js-mode-hook (lambda () (require 'mode-js)))
|
2014-03-20 13:53:57 +01:00
|
|
|
(add-hook 'latex-mode-hook (lambda () (require 'mode-latex)))
|
|
|
|
(add-hook 'makefile-mode-hook (lambda () (require 'mode-makefile)))
|
2014-10-08 11:18:26 +02:00
|
|
|
(add-hook 'nroff-mode-hook (lambda () (require 'mode-nroff)))
|
2014-03-20 13:53:57 +01:00
|
|
|
(add-hook 'perl-mode-hook (lambda () (require 'mode-perl)))
|
|
|
|
(add-hook 'python-mode-hook (lambda () (require 'mode-python)))
|
|
|
|
(add-hook 'sh-mode-hook (lambda () (require 'mode-sh)))
|
|
|
|
(add-hook 'tex-mode-hook (lambda () (require 'mode-tex)))
|
|
|
|
(add-hook 'texinfo-mode-hook (lambda () (require 'mode-texinfo)))
|
2013-01-08 23:57:55 +01:00
|
|
|
|
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-03-08 11:48:35 +01:00
|
|
|
(when (require 'package nil t)
|
2014-11-06 10:02:35 +01:00
|
|
|
;; (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
|
2014-03-08 11:48:35 +01:00
|
|
|
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
|
2014-03-22 12:16:20 +01:00
|
|
|
(setq package-user-dir (concat emacs-cache-folder "elpa"))
|
2014-03-08 11:48:35 +01:00
|
|
|
(package-initialize))
|
|
|
|
|
2014-12-16 10:10:41 +01:00
|
|
|
(add-to-list 'load-path "/usr/share/asymptote")
|
|
|
|
(autoload 'asy-mode "asy-mode.el" "Asymptote major mode." t)
|
|
|
|
(autoload 'lasy-mode "asy-mode.el" "Hybrid Asymptote/Latex major mode." t)
|
|
|
|
(autoload 'asy-insinuate-latex "asy-mode.el" "Asymptote insinuate LaTeX." t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.asy$" . asy-mode))
|
|
|
|
|
2014-09-11 22:33:39 +02:00
|
|
|
(load-external "\\.bbcode\\'" 'bbcode-mode)
|
|
|
|
(add-hook 'bbcode-mode-hook (lambda () (require 'mode-bbcode)))
|
|
|
|
|
2014-03-08 15:58:29 +01:00
|
|
|
(load-external "\\.l\\'" 'flex-mode nil 'c-mode)
|
|
|
|
(load-external "\\.yy?\\'" 'bison-mode nil 'c-mode)
|
|
|
|
|
|
|
|
(load-external "\\.vert\\'\\|\\.frag\\'\\|\\.glsl\\'" 'glsl-mode nil 'c-mode)
|
|
|
|
|
|
|
|
(load-external "\\.go\\'" 'go-mode)
|
2014-10-23 16:44:23 +02:00
|
|
|
(add-hook 'go-mode-hook (lambda () (require 'mode-go)))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2014-03-10 11:03:48 +01:00
|
|
|
(load-external "\\.dot\\'" 'graphviz-dot-mode)
|
2014-02-23 10:50:56 +01:00
|
|
|
(add-hook 'graphviz-dot-mode-hook (lambda () (require 'mode-dot)))
|
2014-02-13 16:30:05 +01:00
|
|
|
|
2014-03-08 15:58:29 +01:00
|
|
|
(load-external "\\.lua\\'" 'lua-mode nil 'sh-mode)
|
2014-03-25 09:23:12 +01:00
|
|
|
(add-hook 'lua-mode-hook (lambda () (require 'mode-lua)))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
2014-03-08 15:58:29 +01:00
|
|
|
(load-external "\\.md\\'\\|\\.markdown\\'" 'markdown-mode)
|
2014-02-23 10:50:56 +01:00
|
|
|
;; 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-03-10 10:37:43 +01:00
|
|
|
(load-external "\\.wiki\\'" 'mediawiki 'mediawiki-mode)
|
2014-02-23 10:50:56 +01:00
|
|
|
(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-03-08 15:58:29 +01:00
|
|
|
(load-external "\\.po\\'\\|\\.po\\." 'po-mode)
|
2014-02-23 10:50:56 +01:00
|
|
|
(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-02-22 19:13:39 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-02-23 18:07:42 +01:00
|
|
|
;; Third-party tools
|
2014-09-16 09:02:33 +02:00
|
|
|
|
2014-10-24 14:58:38 +02:00
|
|
|
;; (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)
|
|
|
|
;; (add-hook 'prog-mode-hook (lambda () (ignore-errors (guess-style-guess-all))))
|
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-11-12 15:08:30 +01:00
|
|
|
(require 'smiext "tool-smiext")
|
|
|
|
|
2014-03-08 11:48:35 +01:00
|
|
|
(when (require 'multiple-cursors nil t)
|
|
|
|
(setq mc/list-file (concat emacs-cache-folder "mc-lists.el"))
|
|
|
|
;; Load the file at the new location.
|
|
|
|
(load mc/list-file t)
|
|
|
|
(global-unset-key (kbd "C-<down-mouse-1>"))
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-<mouse-1>") 'mc/add-cursor-on-click)
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-x M-r") 'mc/edit-lines)
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-x M-m") 'mc/mark-more-like-this-extended)
|
2015-10-12 12:06:14 +02:00
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-x M-l") 'mc/mark-all-like-this-dwim)
|
|
|
|
;; Search compatible with mc.
|
|
|
|
(when (require 'phi-search) nil t))
|
2014-03-08 11:48:35 +01:00
|
|
|
|
2015-05-11 19:38:16 +02:00
|
|
|
(when (require 'dired+ nil t)
|
|
|
|
(toggle-diredp-find-file-reuse-dir 1))
|
|
|
|
|
2015-06-02 17:20:12 +02:00
|
|
|
(when (require 'powerline nil t)
|
|
|
|
(powerline-default-theme))
|
|
|
|
|
2015-10-08 10:02:58 +02:00
|
|
|
(when (require 'sr-speedbar nil t)
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "M-S M-S") 'sr-speedbar-toggle))
|
|
|
|
|
2015-10-12 12:06:14 +02:00
|
|
|
(when (require 'helm-fuzzy-find nil t)
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-c C-/") 'helm-fuzzy-find))
|
|
|
|
|
|
|
|
(require 'swiper nil t)
|
|
|
|
|
|
|
|
(when (require 'find-things-fast nil t)
|
|
|
|
;; Make ftf work on every file.
|
2015-10-13 17:24:30 +02:00
|
|
|
(setq ftf-filetypes '("*")))
|
2015-10-12 12:06:14 +02: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)
|
|
|
|
|
2014-03-18 16:24:05 +01:00
|
|
|
;; Local hook. You can use it to set system specific variables, such as the
|
|
|
|
;; external web browser or pdf viewer. You can also backport feature for old
|
|
|
|
;; Emacs. For instance:
|
|
|
|
; (setq pdf-viewer "evince")
|
|
|
|
; (setq pdf-viewer-args nil)
|
|
|
|
; (mapcar
|
|
|
|
; (lambda (mode-hook)
|
|
|
|
; (add-hook mode-hook (lambda () (run-hooks 'prog-mode-hook))))
|
|
|
|
; '(asm-mode-hook awk-mode-hook c++-mode-hook c-mode-hook
|
|
|
|
; emacs-lisp-mode-hook lisp-mode-hook lua-mode-hook
|
|
|
|
; makefile-mode-hook octave-mode-hook perl-mode-hook
|
|
|
|
; python-mode-hook scheme-mode-hook sh-mode-hook))
|
2014-03-12 10:36:37 +01:00
|
|
|
(load "local" t t)
|
|
|
|
|
2013-01-08 23:57:55 +01:00
|
|
|
;; End of file
|
2013-03-02 19:34:12 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|