2011-06-11 19:51:08 +02:00
|
|
|
|
;; -*- mode: Emacs-Lisp; -*-
|
2011-09-14 16:16:16 +02:00
|
|
|
|
(let ((default-directory "~/.emacs.d/"))
|
|
|
|
|
(normal-top-level-add-subdirs-to-load-path))
|
2011-09-10 17:49:33 +02:00
|
|
|
|
|
|
|
|
|
;;-----[ Defun ]---------------------------------------------------------
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(defun ext/what-face (pos)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
"Find out which face the current position uses"
|
|
|
|
|
(interactive "d")
|
|
|
|
|
(let ((face (or (get-char-property (point) 'read-face-name)
|
|
|
|
|
(get-char-property (point) 'face))))
|
|
|
|
|
(if face
|
|
|
|
|
(message "Face: %s" face)
|
|
|
|
|
(message "No face at %d" pos))))
|
|
|
|
|
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(defun ext/what-major-mode (buffer-or-string)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
"Find out which major-mode is currently used"
|
|
|
|
|
(with-current-buffer buffer-or-string major-mode))
|
|
|
|
|
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(defun ext/my-comp-finish-function (buf str)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
"Don't show compilation window if everything went ok"
|
|
|
|
|
(if (string-match "exited abnormally" str)
|
|
|
|
|
;; there were errors
|
|
|
|
|
(message "compilation errors, press C-x ` to visit")
|
|
|
|
|
;; no errors, make the compilation window go away in 0.5 seconds
|
|
|
|
|
(run-at-time 0.5 nil 'delete-windows-on buf)
|
|
|
|
|
(message "NO COMPILATION ERRORS!")))
|
|
|
|
|
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(defun ext/pretty-lambdas ()
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil `(("(\\(lambda\\>\\)"
|
|
|
|
|
(0 (progn
|
|
|
|
|
(compose-region (match-beginning 1)
|
|
|
|
|
(match-end 1)
|
|
|
|
|
?λ)))))))
|
|
|
|
|
|
|
|
|
|
(defun ext/x-urgency-hint (frame arg &optional source)
|
|
|
|
|
(let* ((wm-hints (append (x-window-property
|
|
|
|
|
"WM_HINTS" frame "WM_HINTS"
|
|
|
|
|
(if source
|
|
|
|
|
source
|
|
|
|
|
(string-to-number
|
|
|
|
|
(frame-parameter frame 'outer-window-id)))
|
|
|
|
|
nil t) nil))
|
|
|
|
|
(flags (car wm-hints)))
|
|
|
|
|
(setcar wm-hints
|
|
|
|
|
(if arg
|
|
|
|
|
(logior flags #x00000100)
|
|
|
|
|
(logand flags #xFFFFFEFF)))
|
|
|
|
|
(x-change-window-property "WM_HINTS" wm-hints frame "WM_HINTS" 32 t)))
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(defun oni/c-toggle-header-source ()
|
|
|
|
|
"Toggle between a C source and header file"
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((ext (file-name-extension (buffer-file-name)))
|
|
|
|
|
(noext (file-name-sans-extension (buffer-file-name))))
|
|
|
|
|
(if (string= (substring ext 0 1) "c")
|
|
|
|
|
(find-file (concat noext ".h"))
|
|
|
|
|
(find-file (concat noext ".c")))))
|
|
|
|
|
|
|
|
|
|
(defun oni/init-show-outline ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(occur ";;-----\\[ .* \\]-+")
|
|
|
|
|
(other-window 1))
|
|
|
|
|
|
|
|
|
|
(defun oni/replace-occurrences (from to)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (search-forward from nil t)
|
|
|
|
|
(replace-match to))))
|
|
|
|
|
|
|
|
|
|
(defun oni/replace-html-special-chars ()
|
|
|
|
|
(oni/replace-occurrences "é" "é"))
|
|
|
|
|
|
|
|
|
|
(defun oni/before-save-hook ()
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(if (eq (ext/what-major-mode (current-buffer)) 'html-mode)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(oni/replace-html-special-chars))
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(if (not (eq (ext/what-major-mode (current-buffer)) 'markdown-mode))
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(delete-trailing-whitespace)))
|
|
|
|
|
|
|
|
|
|
(defun oni/after-save-hook ()
|
2011-09-14 20:15:49 +02:00
|
|
|
|
(let* ((fname (buffer-file-name))
|
|
|
|
|
(suffix (file-name-extension fname)))
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(if (string-equal suffix "el")
|
2011-09-14 20:15:49 +02:00
|
|
|
|
(byte-compile-file fname))))
|
2011-09-10 17:49:33 +02:00
|
|
|
|
|
|
|
|
|
;;-----[ Theme ]---------------------------------------------------------
|
2011-08-30 00:02:28 +02:00
|
|
|
|
(require 'naquadah-theme)
|
|
|
|
|
(eval-after-load 'naquadah-theme
|
|
|
|
|
(naquadah-theme-set-faces
|
|
|
|
|
'naquadah
|
|
|
|
|
|
|
|
|
|
;; markdown-mode
|
|
|
|
|
'(markdown-link-face (:inherit 'link))
|
|
|
|
|
'(markdown-header-face-1 (:inherit 'org-level-1))
|
|
|
|
|
'(markdown-header-face-2 (:inherit 'org-level-2))
|
|
|
|
|
'(markdown-header-face-3 (:inherit 'org-level-3))
|
|
|
|
|
'(markdown-header-face-4 (:inherit 'org-level-4))
|
|
|
|
|
'(markdown-header-face-5 (:inherit 'org-level-5))
|
2011-09-14 20:43:49 +02:00
|
|
|
|
'(markdown-header-face-6 (:inherit 'org-level-6))
|
|
|
|
|
|
|
|
|
|
'(ac-candidate-face (:inherit 'header-line :box nil))
|
|
|
|
|
'(ac-selection-face (:inherit 'hl-line :box nil))))
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Autopair ]------------------------------------------------------
|
2011-07-26 01:09:59 +02:00
|
|
|
|
(require 'autopair)
|
|
|
|
|
(autopair-global-mode t) ; automatically add the other delimiter
|
2011-07-26 14:39:03 +02:00
|
|
|
|
(setq autopair-skip-criteria 'always
|
|
|
|
|
autopair-autowrap t
|
|
|
|
|
autopair-blink nil)
|
|
|
|
|
(setq-default autopair-dont-pair '(:string (?\' ?\") :comment (?\')))
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Column marker ]-------------------------------------------------
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(require 'column-marker)
|
|
|
|
|
|
2011-07-26 01:09:59 +02:00
|
|
|
|
(defun set-column-markers (cm1 cm2)
|
|
|
|
|
(column-marker-1 cm1)
|
|
|
|
|
(column-marker-2 cm2))
|
2011-09-06 10:28:41 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Prog mode ]-----------------------------------------------------
|
|
|
|
|
(defconst integer-regex-1
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(concat "\\b\\(0[xX][0-9a-fA-F]+[lL]?\\|[0-9]+\\.?[0-9]*\\([eE][-+]?"
|
|
|
|
|
"[0-9]+\\)?\\([lL]\\|[fF]\\|[dD]\\)?\\)\\b")))
|
|
|
|
|
|
|
|
|
|
(defconst integer-regex-2
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(concat "\\b\\(\\.[0-9]+\\([eE][-+]?[0-9]+\\)?\\([lL]\\|[fF]\\|[dD]"
|
|
|
|
|
"\\)?\\)\\b")))
|
|
|
|
|
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(defun oni/prog-mode-hook ()
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
nil
|
2011-09-10 17:49:33 +02:00
|
|
|
|
`((,integer-regex-1 0 font-lock-constant-face)
|
|
|
|
|
(,integer-regex-2 0 font-lock-constant-face)))
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(ext/pretty-lambdas)
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(set-column-markers 73 81))
|
2011-07-26 01:09:59 +02:00
|
|
|
|
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(if (>= emacs-major-version 24)
|
|
|
|
|
(add-hook 'prog-mode-hook 'oni/prog-mode-hook)
|
|
|
|
|
(add-hook 'c-mode-common-hook 'oni/prog-mode-hook)
|
|
|
|
|
(add-hook 'go-mode-hook 'oni/prog-mode-hook)
|
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'oni/prog-mode-hook))
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ HTML mode ]-----------------------------------------------------
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(defun oni/html-mode-hook ()
|
|
|
|
|
(set-column-markers 73 81)
|
|
|
|
|
(setq fill-column 73))
|
2011-07-26 01:09:59 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(eval-after-load "sgml-mode"
|
|
|
|
|
(progn
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
'html-mode
|
|
|
|
|
'(("{\\(\\*.*\\*\\)}" 1 font-comment-face)
|
|
|
|
|
("{\\/?\\(extends\\|block\\|foreach\\(else\\)?\\|if\\|else\\)"
|
|
|
|
|
1 font-lock-builtin-face)
|
|
|
|
|
("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)\\(?:|\\(\\(?:\\sw\\|\\s_\\)+\\):\\)"
|
|
|
|
|
(1 font-lock-variable-name-face)
|
|
|
|
|
(2 font-lock-function-name-face))
|
|
|
|
|
("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)"
|
|
|
|
|
1 font-lock-variable-name-face)
|
|
|
|
|
("{\\(\\(?:\\sw\\|\\s_\\)+\\).*}"
|
|
|
|
|
1 font-lock-function-name-face)))))
|
|
|
|
|
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(add-hook 'html-mode-hook 'oni/html-mode-hook)
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Org mode ]------------------------------------------------------
|
2011-07-26 01:18:41 +02:00
|
|
|
|
(require 'org-crypt)
|
|
|
|
|
(require 'org-publish)
|
2011-09-06 10:28:41 +02:00
|
|
|
|
|
|
|
|
|
(defun oni/org-mode-hook ()
|
|
|
|
|
(turn-on-flyspell)
|
|
|
|
|
(turn-on-auto-fill))
|
|
|
|
|
|
2011-07-26 01:18:41 +02:00
|
|
|
|
(setq
|
|
|
|
|
org-tags-exclude-from-inheritance '("crypt")
|
|
|
|
|
org-crypt-key "33E8CC1CC4"
|
|
|
|
|
org-use-fast-todo-selection t
|
|
|
|
|
org-default-notes-file (concat org-directory
|
|
|
|
|
"/notes.org")
|
|
|
|
|
org-outline-path-complete-in-steps t
|
|
|
|
|
org-return-follows-link t
|
|
|
|
|
org-log-into-drawer t
|
|
|
|
|
org-todo-keywords '((sequence "TODO(t)"
|
|
|
|
|
"IN PROGRESS(p)"
|
|
|
|
|
"WAITING(w@/!)"
|
|
|
|
|
"|"
|
|
|
|
|
"DONE(d!/!)"
|
|
|
|
|
"CANCELLED(c@/!)"))
|
|
|
|
|
org-refile-targets '((org-agenda-files :maxlevel . 5)
|
|
|
|
|
(nil :maxlevel . 5))
|
|
|
|
|
org-todo-keyword-faces
|
|
|
|
|
'(("TODO" :foreground "red" :weight bold)
|
|
|
|
|
("IN PROGRESS" :foreground "yellow" :weight bold)
|
|
|
|
|
("DONE" :foreground "forest green" :weight bold)
|
|
|
|
|
("WAITING" :foreground "orange" :weight bold)
|
|
|
|
|
("CANCELLED" :foreground "orangered" :weight bold)))
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.commitmsg$" . org-mode))
|
|
|
|
|
(global-set-key "\C-cl" 'org-store-link)
|
|
|
|
|
(global-set-key "\C-cc" 'org-capture)
|
|
|
|
|
(global-set-key "\C-ca" 'org-agenda)
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(add-hook 'org-mode-hook 'oni/org-mode-hook)
|
2011-07-26 01:18:41 +02:00
|
|
|
|
(org-crypt-use-before-save-magic)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Rainbow delimiters ]--------------------------------------------
|
2011-07-27 11:53:20 +02:00
|
|
|
|
(require 'rainbow-delimiters)
|
|
|
|
|
(setq rainbow-delimiters-max-face-count 8)
|
2011-09-19 20:16:12 +02:00
|
|
|
|
(global-rainbow-delimiters-mode)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Uniquify ]------------------------------------------------------
|
2011-07-27 11:53:20 +02:00
|
|
|
|
(require 'uniquify)
|
|
|
|
|
(setq uniquify-buffer-name-style 'post-forward)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Go mode ]-------------------------------------------------------
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(defun oni/go-mode-hook ()
|
|
|
|
|
(turn-off-auto-fill))
|
|
|
|
|
|
2011-07-27 11:53:20 +02:00
|
|
|
|
(autoload 'go-mode "go-mode" "Major mode for google go" t)
|
|
|
|
|
(autoload 'gofmt "go-mode" "" t)
|
|
|
|
|
(autoload 'go-fmt-before-save "go-mode" "" t)
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.go$" . go-mode))
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(add-hook 'go-mode-hook 'oni/go-mode-hook)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Htmlize ]-------------------------------------------------------
|
2011-07-27 11:53:20 +02:00
|
|
|
|
(require 'htmlize)
|
|
|
|
|
(setq htmlize-output-type 'inline-css)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Git ]-----------------------------------------------------------
|
2011-07-27 11:53:20 +02:00
|
|
|
|
(require 'git)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Markdown mode ]-------------------------------------------------
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(defun oni/markdown-mode-hook ()
|
|
|
|
|
(whitespace-mode 1)
|
|
|
|
|
(turn-on-auto-fill))
|
|
|
|
|
|
2011-07-27 11:53:20 +02:00
|
|
|
|
(autoload 'markdown-mode "markdown-mode" "Major mode for Markdown" t)
|
|
|
|
|
(setq whitespace-style '(face trailing)) ; For use with markdown mode
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.m\\(ark\\)?do?wn$". markdown-mode))
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(add-hook 'markdown-mode-hook 'oni/markdown-mode-hook)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Xmodmap mode ]--------------------------------------------------
|
2011-07-28 11:36:46 +02:00
|
|
|
|
(autoload 'xmodmap-mode "xmodmap-mode" "Major mode for xmodmap" t)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(add-to-list 'auto-mode-alist
|
|
|
|
|
'("\\.[xX]modmap\\(rc\\)?$" . xmodmap-mode))
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Gtags ]---------------------------------------------------------
|
|
|
|
|
;; http://emacs-fu.blogspot.com/2009/01/navigating-through-source-code-using.html
|
|
|
|
|
(defun oni/gtags-create-or-update ()
|
|
|
|
|
"create or update the gnu global tag file"
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (not (= 0 (call-process "global" nil nil nil " -p"))) ; tagfile
|
|
|
|
|
(let ((olddir default-directory) ; doesn't exist?
|
|
|
|
|
(topdir (read-directory-name
|
|
|
|
|
"gtags: top of source tree:" default-directory)))
|
|
|
|
|
(cd topdir)
|
|
|
|
|
(shell-command "gtags && echo 'created tagfile'")
|
|
|
|
|
(cd olddir)) ; restore
|
|
|
|
|
;; tagfile already exists; update it
|
|
|
|
|
(shell-command "global -u && echo 'updated tagfile'")))
|
|
|
|
|
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(defun oni/gtags-mode-hook ()
|
|
|
|
|
(local-set-key "\M-," 'gtags-find-tag)
|
|
|
|
|
(local-set-key "\M-." 'gtags-find-rtag))
|
|
|
|
|
|
2011-08-06 00:39:35 +02:00
|
|
|
|
(autoload 'gtags-mode "gtags" "Minor mode for using gtags" t)
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(add-hook 'gtags-mode-hook 'oni/gtags-mode-hook)
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ C mode ]--------------------------------------------------------
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(defun oni/c-mode-common-hook ()
|
|
|
|
|
(gtags-mode t)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(oni/gtags-create-or-update))
|
2011-09-06 10:28:41 +02:00
|
|
|
|
|
|
|
|
|
(defun oni/c-mode-hook ()
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(local-set-key [f8] 'oni/c-toggle-header-source)
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(local-set-key [f9] 'compile)
|
|
|
|
|
(local-set-key [C-m] 'newline-and-indent)
|
|
|
|
|
(local-set-key [C-return] 'newline))
|
|
|
|
|
|
|
|
|
|
(add-hook 'c-mode-common-hook 'oni/c-mode-common-hook)
|
|
|
|
|
(add-hook 'c-mode-hook 'oni/c-mode-hook)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ PHP mode ]------------------------------------------------------
|
|
|
|
|
(defconst php-outline-regex
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(concat "\\(function .*(\\|\\(public\\|private\\|protected\\)\\( "
|
|
|
|
|
"static\\)? \\$\\|class \\sw\\)")))
|
|
|
|
|
|
2011-09-05 10:25:12 +02:00
|
|
|
|
(defun oni/php-show-outline ()
|
2011-08-26 12:29:11 +02:00
|
|
|
|
(interactive)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(occur php-outline-regex))
|
2011-08-26 12:29:11 +02:00
|
|
|
|
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(defun oni/php-mode-hook ()
|
|
|
|
|
(c-set-offset 'arglist-intro '+)
|
|
|
|
|
(c-set-offset 'arglist-close '0)
|
|
|
|
|
(local-set-key [f6] 'comment-line)
|
|
|
|
|
(local-set-key [f7] 'oni/php-show-outline)
|
2011-09-06 10:49:46 +02:00
|
|
|
|
(local-set-key [M-S-up] 'flymake-goto-prev-error)
|
|
|
|
|
(local-set-key [M-S-down] 'flymake-goto-next-error)
|
|
|
|
|
(set-column-markers 76 81)
|
|
|
|
|
(flymake-mode 1))
|
2011-09-06 10:28:41 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(eval-after-load "php-mode"
|
|
|
|
|
(progn
|
|
|
|
|
;; Add ! at the beginning of font lock
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
'php-mode
|
|
|
|
|
'(("\\([!]\\|\\=>\\)" 1 font-lock-operator-face)))
|
|
|
|
|
;; Add the rest at the end of font lock
|
|
|
|
|
(font-lock-add-keywords
|
|
|
|
|
'php-mode
|
|
|
|
|
'(("\\(->\\|[|.+=&/%*,:?<>-]\\)" 1 font-lock-operator-face)
|
|
|
|
|
("\\(;\\)" 1 font-lock-end-statement)) 1)))
|
|
|
|
|
|
2011-08-12 15:07:19 +02:00
|
|
|
|
(autoload 'php-mode "php-mode" "Major mode for PHP" t)
|
2011-08-16 09:35:50 +02:00
|
|
|
|
(setq-default php-mode-warn-if-mumamo-off nil) ; don't warn me about this
|
2011-08-12 15:07:19 +02:00
|
|
|
|
(setq php-mode-force-pear t)
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode))
|
2011-09-06 10:28:41 +02:00
|
|
|
|
(add-hook 'php-mode-hook 'oni/php-mode-hook)
|
2011-08-16 16:49:35 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ bidi ]----------------------------------------------------------
|
2011-08-16 16:49:35 +02:00
|
|
|
|
(setq-default bidi-display-reordering nil)
|
2011-08-18 10:13:21 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Message ]-------------------------------------------------------
|
2011-09-06 09:50:25 +02:00
|
|
|
|
(defun oni/message-mode-hook ()
|
|
|
|
|
(turn-on-auto-fill)
|
|
|
|
|
(turn-on-flyspell)
|
|
|
|
|
(ispell-change-dictionary (read-string "New dictionary: ")))
|
|
|
|
|
|
|
|
|
|
(add-hook 'message-mode-hook 'oni/message-mode-hook)
|
2011-08-18 10:19:38 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Gnus ]----------------------------------------------------------
|
2011-08-18 10:19:38 +02:00
|
|
|
|
(setq gnus-init-file "~/.emacs.d/gnus")
|
2011-08-30 12:57:02 +02:00
|
|
|
|
|
2011-09-15 15:40:01 +02:00
|
|
|
|
;;-----[ Autosmiley ]----------------------------------------------------
|
|
|
|
|
(require 'autosmiley)
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Jabber ]--------------------------------------------------------
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(defvar ext/jabber-activity-jids-count 0)
|
|
|
|
|
|
|
|
|
|
(defun ext/jabber-urgency-hint ()
|
|
|
|
|
(let ((count (length jabber-activity-jids)))
|
|
|
|
|
(unless (= ext/jabber-activity-jids-count count)
|
|
|
|
|
(if (zerop count)
|
|
|
|
|
(ext/x-urgency-hint (selected-frame) nil)
|
|
|
|
|
(ext/x-urgency-hint (selected-frame) t))
|
|
|
|
|
(setq ext/jabber-activity-jids-count count))))
|
|
|
|
|
|
|
|
|
|
(defun oni/jabber-chat-mode-hook ()
|
|
|
|
|
(autosmiley-mode)
|
|
|
|
|
(local-set-key [S-return] 'newline)
|
|
|
|
|
(local-set-key [C-return] 'newline))
|
|
|
|
|
|
2011-09-15 15:40:01 +02:00
|
|
|
|
(when (require 'jabber-autoloads nil 'noerror)
|
|
|
|
|
(setq jabber-account-list
|
|
|
|
|
'(("ryuslash@gmail.com"
|
|
|
|
|
(:network-server . "talk.google.com")
|
|
|
|
|
(:connection-type . ssl))))
|
|
|
|
|
(setq jabber-history-enabled t)
|
|
|
|
|
(setq jabber-use-global-history nil)
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(add-hook 'jabber-chat-mode-hook 'oni/jabber-chat-mode-hook)
|
|
|
|
|
(add-hook 'jabber-activity-update-hook 'ext/jabber-urgency-hint))
|
2011-09-05 11:03:19 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ X11 ]-----------------------------------------------------------
|
2011-09-05 11:03:19 +02:00
|
|
|
|
(when window-system
|
|
|
|
|
(setq linum-format " %d")
|
|
|
|
|
(global-unset-key "\C-z"))
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ CLI ]-----------------------------------------------------------
|
2011-09-05 11:03:19 +02:00
|
|
|
|
(when (not window-system)
|
|
|
|
|
(setq linum-format "%d "))
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Texinfo ]-------------------------------------------------------
|
2011-09-05 15:31:47 +02:00
|
|
|
|
(add-hook 'texinfo-mode-hook 'turn-on-auto-fill)
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Dot ]-----------------------------------------------------------
|
|
|
|
|
(autoload 'graphviz-dot-mode "graphviz-dot-mode" "Major mode for dot" t)
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.dot$" . graphviz-dot-mode))
|
|
|
|
|
|
|
|
|
|
;;-----[ Cmake ]---------------------------------------------------------
|
|
|
|
|
(define-skeleton cmake-project-skeleton
|
|
|
|
|
"A cmake project template file"
|
|
|
|
|
"Name: "
|
|
|
|
|
"cmake_minimum_required(VERSION 2.6)\n"
|
|
|
|
|
"project(" str ")\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"set(" str "_VERSION_MAJOR 0)\n"
|
|
|
|
|
"set(" str "_VERSION_MINOR 0)\n"
|
|
|
|
|
"set(" str "_VERSION_PATCH 0)\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})\n"
|
|
|
|
|
"add_subdirectory(src)")
|
|
|
|
|
|
|
|
|
|
(autoload 'cmake-mode "cmake-mode" "Major mode for CMake" t)
|
|
|
|
|
(add-to-list 'auto-mode-alist '("CMakeLists\\.txt$" . cmake-mode))
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.cmake$" . cmake-mode))
|
|
|
|
|
|
|
|
|
|
;;-----[ Rainbow ]-------------------------------------------------------
|
|
|
|
|
(autoload 'rainbow-mode "rainbow-mode" "Minor mode for colors" t)
|
|
|
|
|
|
|
|
|
|
;;-----[ Git-commit mode ]-----------------------------------------------
|
|
|
|
|
(autoload 'git-commit-mode "git-commit" "" t)
|
|
|
|
|
(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . git-commit-mode))
|
|
|
|
|
(add-hook 'git-commit-mode-hook 'auto-fill-mode)
|
|
|
|
|
|
|
|
|
|
;;-----[ Ido ]-----------------------------------------------------------
|
|
|
|
|
(ido-mode t)
|
|
|
|
|
(setq ido-save-directory-list-file nil)
|
|
|
|
|
(setq ido-auto-merge-delay-time 2)
|
|
|
|
|
|
|
|
|
|
;;-----[ Js mode ]-------------------------------------------------------
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js-mode))
|
|
|
|
|
|
|
|
|
|
;;-----[ CSS mode ]------------------------------------------------------
|
2011-09-14 20:43:49 +02:00
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
|
|
|
|
|
(add-hook 'css-mode-hook 'rainbow-mode)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
|
2011-09-13 10:35:54 +02:00
|
|
|
|
;;-----[ ELPA ]----------------------------------------------------------
|
|
|
|
|
(setq package-archives
|
|
|
|
|
'(("ELPA" . "http://tromey.com/elpa/")
|
|
|
|
|
("gnu" . "http://elpa.gnu.org/packages/")
|
|
|
|
|
("marmalade" . "http://marmalade-repo.org/packages/")))
|
|
|
|
|
|
2011-09-14 13:36:17 +02:00
|
|
|
|
;;-----[ Windmove ]------------------------------------------------------
|
|
|
|
|
(windmove-default-keybindings 'meta)
|
|
|
|
|
|
2011-09-14 16:05:59 +02:00
|
|
|
|
;;-----[ Autocomplete ]--------------------------------------------------
|
|
|
|
|
(when (require 'auto-complete-config nil 'noerror)
|
|
|
|
|
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
|
|
|
|
|
(setq ac-comphist-file "~/.emacs.d/ac-comphist.dat")
|
|
|
|
|
(ac-config-default))
|
|
|
|
|
|
2011-09-14 20:12:59 +02:00
|
|
|
|
;;-----[ Ide-skel ]------------------------------------------------------
|
|
|
|
|
(require 'ide-skel)
|
|
|
|
|
(global-set-key [f10] 'ide-skel-toggle-left-view-window)
|
|
|
|
|
(global-set-key [f11] 'ide-skel-toggle-bottom-view-window)
|
|
|
|
|
(global-set-key [f12] 'ide-skel-toggle-right-view-window)
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
;;-----[ Misc ]----------------------------------------------------------
|
2011-09-14 20:15:49 +02:00
|
|
|
|
(defun oni/reload-buffer ()
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(interactive)
|
|
|
|
|
(revert-buffer nil t nil))
|
|
|
|
|
|
2011-06-11 19:51:08 +02:00
|
|
|
|
(defvar font-lock-operator-face 'font-lock-operator-face)
|
|
|
|
|
(defvar font-lock-end-statement 'font-lock-end-statement)
|
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
|
(setq-default truncate-lines t)
|
2011-07-27 11:53:20 +02:00
|
|
|
|
(setq-default tab-width 4)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(setq-default require-final-newline t)
|
2011-06-22 21:46:22 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(setq inhibit-startup-message t)
|
|
|
|
|
(setq inhibit-default-init t)
|
|
|
|
|
(setq scroll-conservatively 101)
|
2011-06-22 21:46:22 +02:00
|
|
|
|
(setq browse-url-browser-function 'browse-url-generic)
|
2011-07-15 19:08:07 +02:00
|
|
|
|
(setq browse-url-generic-program (getenv "BROWSER"))
|
2011-06-22 21:46:22 +02:00
|
|
|
|
(setq uniquify-buffer-name-style 'reverse)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(setq jit-lock-defer-time 0.2)
|
2011-07-15 19:08:07 +02:00
|
|
|
|
(setq mouse-autoselect-window t)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(setq frame-title-format '(:eval (concat "emacs: " (buffer-name))))
|
|
|
|
|
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
|
|
|
|
|
(setq auto-save-file-name-transforms
|
|
|
|
|
`((".*" ,temporary-file-directory t)))
|
2011-06-22 21:46:22 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(setq default-frame-alist
|
2011-09-14 16:09:17 +02:00
|
|
|
|
(append '((font . "DejaVu Sans Mono:pixelsize=13"))))
|
2011-06-22 21:46:22 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(setq initial-frame-alist
|
2011-09-14 16:09:17 +02:00
|
|
|
|
(append '((font . "DejaVu Sans Mono:pixelsize=13"))))
|
2011-06-11 19:51:08 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
2011-06-11 19:51:08 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
|
(line-number-mode -1)
|
|
|
|
|
(global-linum-mode t)
|
|
|
|
|
(column-number-mode t)
|
|
|
|
|
(global-font-lock-mode t)
|
|
|
|
|
(delete-selection-mode t)
|
|
|
|
|
(show-paren-mode t)
|
2011-07-15 19:08:07 +02:00
|
|
|
|
|
2011-09-16 12:11:16 +02:00
|
|
|
|
(add-to-list 'compilation-finish-functions 'ext/my-comp-finish-function)
|
2011-07-15 19:08:07 +02:00
|
|
|
|
|
|
|
|
|
(global-set-key "\C-m" 'newline-and-indent)
|
|
|
|
|
(global-set-key (kbd "C-x n r") 'narrow-to-region)
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(global-set-key [f5] 'oni/reload-buffer)
|
2011-06-11 19:51:08 +02:00
|
|
|
|
|
2011-09-10 17:49:33 +02:00
|
|
|
|
(add-hook 'before-save-hook 'oni/before-save-hook)
|
|
|
|
|
(add-hook 'after-save-hook 'oni/after-save-hook)
|
2011-07-15 19:08:07 +02:00
|
|
|
|
|
2011-06-11 19:51:08 +02:00
|
|
|
|
(make-face 'font-lock-operator-face)
|
|
|
|
|
(make-face 'font-lock-end-statement)
|
|
|
|
|
(set-face-foreground 'font-lock-operator-face "#EDD400")
|
|
|
|
|
(set-face-foreground 'font-lock-end-statement "#888A85")
|
|
|
|
|
|
2011-07-26 14:39:03 +02:00
|
|
|
|
;; Custom file
|
|
|
|
|
(setq custom-file "~/.emacs.d/custom.el")
|
2011-08-05 23:59:30 +02:00
|
|
|
|
(if (file-exists-p custom-file)
|
|
|
|
|
(load custom-file))
|
2011-09-10 17:49:33 +02:00
|
|
|
|
|
2011-08-06 20:00:48 +02:00
|
|
|
|
(defvar home-file "~/wiki.info" "File to open when starting")
|
2011-09-10 17:49:33 +02:00
|
|
|
|
|
2011-08-06 20:00:48 +02:00
|
|
|
|
(if (file-exists-p home-file)
|
|
|
|
|
(info home-file))
|