Created
August 19, 2015 14:50
-
-
Save gmarceau/17be210a923dba234322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Guillaume Marceau's .emacs | |
;; | |
(cd (getenv "HOME")) | |
(setq inhibit-startup-message t) | |
(set-background-color "black") | |
(set-foreground-color "white") | |
;; make all "yes or no" prompts show "y or n" instead | |
(fset 'yes-or-no-p 'y-or-n-p) | |
;; Modules 'n Files | |
;; | |
(add-to-list 'load-path (expand-file-name "~/lisp")) | |
;(load-file (expand-file-name "~/lisp/setup-cygwin.el")) | |
;(load-file (expand-file-name "~/lisp/geiser/elisp/geiser.el")) | |
;(load-file (expand-file-name "~/lisp/git-modes/git-commit-mode.el")) | |
;(load-file (expand-file-name "~/lisp/git-modes/git-rebase-mode.el")) | |
;(load-file (expand-file-name "~/lisp/git-modes/gitattributes-mode.el")) | |
;(load-file (expand-file-name "~/lisp/git-modes/gitconfig-mode.el")) | |
;(load-file (expand-file-name "~/lisp/git-modes/gitignore-mode.el")) | |
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") | |
("marmalade" . "http://marmalade-repo.org/packages/") | |
("melpa" . "http://melpa.milkbox.net/packages/"))) | |
;; Some custom variable binds keys to my personal map | |
(defvar personal-map (make-sparse-keymap)) | |
(define-key global-map [(control c)] personal-map) | |
;; Custom variables | |
(custom-set-faces | |
;; custom-set-faces was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
) | |
(custom-set-variables | |
;; custom-set-variables was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(Man-notify-method (quote pushy)) | |
'(ahk-syntax-directory "c:/Program Files (x86)/AutoHotkey/") | |
'(auto-compression-mode t nil (jka-compr)) | |
'(auto-revert-interval 0.5) | |
'(auto-save-default nil) | |
'(blink-cursor-mode nil) | |
'(c-basic-offset 2) | |
'(c-default-style "bsd") | |
'(compilation-auto-jump-to-first-error nil) | |
'(compilation-scroll-output nil) | |
'(compilation-window-height 25) | |
'(dabbrev-case-fold-search nil) | |
'(desktop-globals-to-save (quote (desktop-missing-file-warning tags-file-name tags-table-list search-ring regexp-search-ring register-alist compile-command compilation-search-path compile-history grep-history find-macro-map personal-macro-map extended-command-history))) | |
'(ediff-default-variant (quote default-A)) | |
'(ediff-quit-merge-hook nil) | |
'(ediff-window-setup-function (quote ediff-setup-windows-plain)) | |
'(emacsw32-style-frame-title t) | |
'(eshell-after-prompt-hook (quote (eshell-show-maximum-output))) | |
'(eshell-ask-to-save-history (quote always)) | |
'(eshell-cmpl-use-paring nil) | |
'(eshell-confine-point-to-input nil) | |
'(eshell-hist-rebind-keys-alist (quote (([(control 112)] . eshell-previous-input) ([(control 110)] . eshell-next-input) ([(control up)] . eshell-previous-input) ([(control down)] . eshell-next-input) ([(control 114)] . eshell-isearch-backward) ([(control 115)] . eshell-isearch-forward) ([(meta 114)] . eshell-previous-matching-input) ([(meta 115)] . eshell-next-matching-input) ([(meta 112)] . eshell-previous-matching-input-from-input) ([(meta 110)] . eshell-next-matching-input-from-input)))) | |
'(eshell-modules-list (quote (eshell-alias eshell-banner eshell-basic eshell-cmpl eshell-dirs eshell-glob eshell-hist eshell-ls eshell-pred eshell-prompt eshell-rebind eshell-script eshell-term eshell-unix))) | |
'(eshell-rebind-keys-alist (quote (([(control 97)] . eshell-bol) ([(control 100)] . eshell-delchar-or-maybe-eof) ([backspace] . eshell-delete-backward-char) ([(control 119)] . backward-kill-word) ([(control 117)] . eshell-kill-input)))) | |
'(eshell-visual-commands (quote ("vi" "screen" "top" "less" "more" "lynx" "ncftp" "pine" "tin" "trn" "elm" "ssh"))) | |
'(fill-column 120) | |
'(grep-command "ack --nogroup < /dev/null") | |
'(grep-template "ack --no-group <C> <R> <F> < /dev/null") | |
'(grep-use-null-device nil) | |
'(indent-tabs-mode nil) | |
'(initial-scratch-message nil) | |
'(js-indent-level 2) | |
'(lazy-highlight-interval 0.02) | |
'(make-backup-files nil) | |
'(menu-bar-mode nil) | |
'(mouse-wheel-scroll-amount (quote (3 ((shift) . 1) ((control))))) | |
'(plugin-download-urls (quote ("ftp://ftp.rge.com/pub/gnu/elisp-archive/archive/"))) | |
'(plugin-installation-dir "~/lisp") | |
'(plugin-installed-modules (quote ((csharp-mode "c:/documents/lisp/csharp-mode-autoload.el") (markdown-mode "c:/documents/lisp/markdown-mode.el") (scala-mode "c:/documents/lisp/scala-mode/scala-mode-autoload.el") (php-mode "c:/documents/lisp/php-mode-autoload.el") (ahk-mode "c:/documents/lisp/ahk-mode.el") (spread "/home/gmarceau/lisp/spread-autoload.elc") (run-command "/home/gmarceau/lisp/run-command-autoload.elc"))) nil (plugin)) | |
'(ruby-indent-level 2) | |
'(ruby-indent-tabs-mode nil) | |
'(safe-local-variable-values (quote ((eval setq compile-command (concat "make" " -wC " (locate-dominating-file (or buffer-file-name ".") ".dir-locals.el") " -j $(nproc)")) (eval setq compile-command (concat "make" " -C " (locate-dominating-file (or buffer-file-name ".") ".dir-locals.el") " -j $(nproc)")) (eval if (boundp (quote c-offsets-alist)) (add-to-list (quote c-offsets-alist) (quote (innamespace . -)))) (eval add-to-list (quote auto-mode-alist) (quote ("\\.h\\'" . c++-mode))) (whitespace-style face tabs tab-mark trailing lines-tail empty) (flycheck-clang-include-path "." "src" "src/lib/asio/include" "src/lib/autocheck/include" "src/lib/cereal/include" "src/lib/util" "src/lib/soci/src/core" "src/lib/soci/src/backends/sqlite3" "src/lib/xdrpp" "src/lib/sqlite" "src/lib/libsodium/src/libsodium" "src/lib/libmedida/src") (flycheck-clang-language-standard . "c++11") (js-indent-level . 2) (tab-always-indent)))) | |
'(scroll-bar-mode (quote right)) | |
'(show-paren-mode t nil (paren)) | |
'(tool-bar-mode nil nil (tool-bar)) | |
'(undo-limit 60000) | |
'(undo-strong-limit 90000) | |
'(uniquify-buffer-name-style (quote forward) nil (uniquify)) | |
'(w32shell-cygwin-bin "c:/cygwin/bin") | |
'(w32shell-shell (quote cygwin))) | |
;; Variable value | |
;; | |
(setq exec-path (append '("c:/cygwin/bin") exec-path)) | |
(setq null-device "/dev/null") | |
(setq ring-bell-function '(lambda () )) | |
(set-mouse-color "white") | |
(set-cursor-color "yellow") | |
(setq mouse-yank-at-point t) | |
(setq line-number-mode t) | |
(setq comint-buffer-maximum-size 4048) | |
(setq parens-require-spaces nil) | |
(setq completion-ignored-extensions (append '(".class" ".cmo" ".cmi" ".cmx" ".d") | |
completion-ignored-extensions)) | |
(setq vc-handled-backends ()) | |
(setq auto-mode-alist (append '(("\\.\\(php\\|eco\\)$" . php-mode) | |
("\\.java$" . java-mode) | |
("\\.scala$" . scala-mode) | |
("\\.cs$" . c++-mode) | |
("\\.sbt$" . scala-mode) | |
("\\.ml$" . tuareg-mode) | |
("\\.ds$" . tuareg-mode) | |
("\\.java_$" . java-mode) | |
("\\.pizza$" . java-mode) | |
("\\.grimp$" . java-mode) | |
("\\.jimp$" . java-mode) | |
("\\.grimple$" . java-mode) | |
("\\.jimple$" . java-mode) | |
("\\.jasmin$" . java-mode) | |
("\\.ccc$" . java-mode) | |
("\\.jl$" . sawfish-mode) | |
("\\.sawmillrc$" . sawfish-mode) | |
("\\.sawfishrc$" . sawfish-mode) | |
("\\.h$" . c++-mode) | |
("Makefile.*" . makefile-mode) | |
("\.\\(frm\\|bas\\|cls\\)$" . visual-basic-mode) | |
("\.\\(vbg\\|vbg\\)$" . vbp-mode) | |
("\.\\(js\\|json\\)$" . javascript-mode) | |
("\\.vbp$" . vbp-mode) | |
("\\.ss$" . scheme-mode) | |
("\\.rkt$" . scheme-mode) | |
("\\.rktl$" . scheme-mode) | |
("\\.inl$" . c++-mode) | |
("\\.cg$" . c-mode) | |
("\\.rb$" . ruby-mode) | |
("\\.spr$" . spread-mode) | |
("^/etc/" . shell-script-mode) | |
("\\.ebuild$" . shell-script-mode) | |
("\\.inc$" . html-mode) | |
("\\.md$" . markdown-mode) | |
) | |
auto-mode-alist)) | |
;; Personnal Functions defs | |
;; | |
(fset 'indent-riffle [tab down]) | |
(defun save-motion-as-kill (motion-fn arg) | |
(if (eq last-command 'save-motion-as-kill) | |
(append-next-kill)) | |
(copy-region-as-kill (point) (progn (funcall motion-fn arg) (point))) | |
(message "Saved: \"%s\"" (car kill-ring)) | |
(setq this-command 'save-motion-as-kill)) | |
(defun save-word-as-kill (arg) (interactive "p") (save-motion-as-kill 'forward-word arg)) | |
(defun save-sexp-as-kill (arg) (interactive "p") (save-motion-as-kill 'forward-sexp arg)) | |
(defun forward-save-sexp-as-kill (arg) (interactive "p") (save-sexp-as-kill arg)) | |
(defun backward-save-sexp-as-kill (arg) (interactive "p") (save-sexp-as-kill (- arg))) | |
(defun backward-save-word-as-kill (arg) (interactive "p") (save-word-as-kill (- arg))) | |
(defun c-mode-customize () | |
(interactive) | |
(set-fill-column 140) | |
(turn-on-auto-fill)) | |
(defun unfill () | |
"Maximally undo the effect of a fill" | |
(interactive) | |
(let ((left (save-excursion | |
(min (progn (beginning-of-line) (point)) | |
(progn (backward-paragraph) (point))))) | |
(right (make-marker))) | |
(save-excursion | |
(set-marker right (max (progn (end-of-line) (point)) | |
(progn (forward-paragraph) (point)))) | |
(goto-char left) (forward-line 1) | |
(while (< (point) right) | |
(end-of-line) (delete-char 1) (just-one-space)) | |
(delete-char -1) (insert "\n")))) | |
(defun kill-line-in-place () | |
"Kill the current line without moving the cursor from its column" | |
(interactive) | |
(let ((col (current-column))) | |
(let ((kill-whole-line t)) | |
(beginning-of-line) | |
(kill-line 1)) | |
(move-to-column col))) | |
(defun kill-whole-line () | |
"Kill the current line" | |
(interactive) | |
(let ((kill-whole-line t)) | |
(beginning-of-line) | |
(kill-line 1))) | |
(defun yank-a-scratch-buffer () | |
"Clear the current *scratch* buffer and yank" | |
(interactive) | |
(switch-to-buffer "*scratch*") | |
(erase-buffer) | |
(yank)) | |
(defun desktop-load (d) | |
"Select a new desktop directory and load its .emacs.desktop file" | |
(interactive "DDirectory: ") | |
(message d) | |
(load-file (concat (file-name-as-directory d) ".emacs.desktop")) | |
(desktop-save d)) | |
(defun insert-tab-char () (interactive) (insert ?\t)) | |
(defun insert-space-char () (interactive) (insert " ")) | |
(defun count-words () | |
(interactive) | |
(save-excursion | |
(if (< (mark) (point)) (exchange-point-and-mark)) | |
(let ((end (mark))) | |
(message "%d words" | |
(while-break ((i 0)) | |
(if (not (re-search-forward "\\<" end t)) (break i) | |
(setq i (+ 1 i)) | |
(forward-char 1))))))) | |
(defun debug-on-error () | |
(interactive) | |
(setq debug-on-error (not debug-on-error)) | |
(message "debug-on-error is now %s" (if debug-on-error "ON" "OFF"))) | |
(defun truncate-lines () | |
(interactive) | |
(setq truncate-lines (not truncate-lines)) | |
(message "truncate-lines is now %s" (if truncate-lines "ON" "OFF"))) | |
(defun pickup-differing-files-and-ediff () | |
(interactive) | |
(save-excursion | |
(beginning-of-line) | |
(if (not (looking-at "^Files \\(.*\\) and \\(.*\\) differ$")) | |
(error "Not on a diff line - try 'diff -rq dir1 dir2'"))) | |
(forward-line) | |
(ediff-files (match-string 1) (match-string 2))) | |
(autoload 'eshell-truncate-buffer "eshell") | |
(defun eshell-erase-buffer () | |
(interactive) | |
(let ((eshell-buffer-maximum-lines 0)) | |
(eshell-truncate-buffer))) | |
(defalias 'eshell/clear 'eshell-erase-buffer) | |
(defun indent-buffer () | |
(interactive) | |
(indent-region 0 (buffer-size) nil)) | |
(defun set-tab-width (width) | |
(interactive "p") | |
(set-variable 'tab-width width) | |
(recenter)) | |
(defun insert-time-stamp () | |
(interactive) | |
(insert (current-time-string))) | |
(defun set-default-font-buffer () | |
(interactive) | |
(switch-to-buffer (get-buffer-create "*fonts*")) | |
(erase-buffer) | |
(mapc #'(lambda (txt) (insert txt "\n")) (x-list-fonts "*" nil (selected-frame))) | |
(sort-lines nil (point-min) (point-max)) | |
(goto-char 1) | |
(when (search-forward-regexp "^[^-]" nil t) | |
(beginning-of-line) | |
(let ((str (buffer-substring 1 (point)))) | |
(delete-region 1 (point)) | |
(goto-char (point-max)) | |
(insert str))) | |
(goto-char 1) | |
(insert " Move down to a line and press RET to select a font\n\n") | |
(goto-char 1) | |
(set-buffer-modified-p nil) | |
(local-set-key [return] | |
'(lambda () | |
"Switches the current frame to the font named under the point." | |
(interactive) | |
(save-excursion | |
(beginning-of-line) | |
(looking-at "[^\n]+") | |
(set-default-font (match-string 0)))))) | |
(defun indent-current-sexp () | |
(interactive) | |
(save-excursion | |
(unless (= (char-after) 40) | |
(up-list) | |
(backward-sexp)) | |
(indent-according-to-mode) | |
(indent-sexp))) | |
(defun insert-balanced-comments (arg) | |
"Insert a set of balanced comments around the s-expression containing the point. If this command is invoked repeatedly (without any other command occurring between invocations), the comment progressively moves outward over enclosing expressions." | |
(interactive "*p") | |
(save-excursion | |
(when (eq last-command this-command) | |
(when (search-backward "#|" nil t) | |
(save-excursion | |
(delete-char 2) | |
(while (and (< (point) (point-max)) (not (looking-at " *|#"))) | |
(forward-sexp)) | |
(replace-match "")))) | |
(while (> arg 0) | |
(backward-char 1) | |
(cond ((looking-at ")") (incf arg)) | |
((looking-at "(") (decf arg)))) | |
(insert "#|") | |
(forward-sexp) | |
(insert "|#") | |
(font-lock-fontify-block))) | |
(defun remove-balanced-comments () | |
"Remove a set of balanced comments enclosing point." | |
(interactive "*") | |
(save-excursion | |
(when (search-backward "#|" nil t) | |
(delete-char 2) | |
(while (and (< (point) (point-max)) (not (looking-at " *|#"))) | |
(forward-sexp)) | |
(replace-match "")) | |
(font-lock-fontify-block))) | |
(defvar up-list-stack ()) | |
(defvar up-list-stack-max 50) | |
(make-variable-buffer-local 'up-list-stack) | |
(defun up-list-backward-sexp () | |
(interactive) | |
(setq up-list-stack (cons (point) up-list-stack)) | |
(when (> (length up-list-stack) up-list-stack-max) | |
(setcdr (nthcdr (1- up-list-stack-max) up-list-stack) nil)) | |
(up-list) | |
(backward-sexp)) | |
(defun up-list-pop () | |
(interactive) | |
(when up-list-stack | |
(goto-char (car up-list-stack)) | |
(setq up-list-stack (cdr up-list-stack)))) | |
(defun selective-display (column) | |
"set selective display fold everything greater than the current column, or toggle off if active" | |
(interactive "p") | |
(set-selective-display | |
(cond (selective-display nil) | |
((> column 1) (+ column 1)) | |
((current-column) (+ (current-column) 1)) | |
(t 1)))) | |
;; Advices | |
(require 'ansi-color) | |
(defadvice display-message-or-buffer (before ansi-color activate) | |
"Process ANSI color codes in shell output." | |
(let ((buf (ad-get-arg 0))) | |
(and (bufferp buf) | |
(string= (buffer-name buf) "*Shell Command Output*") | |
(with-current-buffer buf | |
(ansi-color-apply-on-region (point-min) (point-max)))))) | |
(defadvice kill-buffer (around immortal-scratch-buffer activate) | |
(let* ((buf-or-name (ad-get-arg 0)) | |
(buffer (if buf-or-name | |
(get-buffer-create buf-or-name) | |
(current-buffer))) | |
(name (buffer-name buffer)) | |
(immortal (and (string= name "*scratch*") | |
(not (buffer-file-name buffer))))) | |
(when (and ad-do-it immortal) | |
(switch-to-buffer (get-buffer-create "*scratch*")) | |
(emacs-lisp-mode) | |
(bury-buffer)))) | |
(defadvice next-error (after recenter-next-error activate) | |
(let ((prev (current-buffer))) | |
(pop-to-buffer "*compilation*") | |
(recenter 5) | |
(pop-to-buffer prev))) | |
(defadvice previous-error (after recenter-previous-error activate) | |
(let ((prev (current-buffer))) | |
(pop-to-buffer "*compilation*") | |
(recenter 5) | |
(pop-to-buffer prev))) | |
(defun autocompile-dot-emacs nil | |
"compile itself if ~/.emacs" | |
(interactive) | |
(require 'bytecomp) | |
(when (or (string= (buffer-file-name) (expand-file-name (concat default-directory ".emacs"))) | |
(string= (buffer-file-name) (expand-file-name (concat default-directory "_emacs")))) | |
(byte-compile-file (buffer-file-name)))) | |
(setq compilation-finish-functions | |
(list (lambda (buf str) | |
(if (string-match "exited abnormally" str) | |
;;there were errors | |
(message "compilation errors, press M-n 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"))))) | |
;; Prefered Key bindings | |
;; | |
(define-key global-map [f11] 'pickup-differing-files-and-ediff) | |
(define-key global-map [f2] 'call-last-kbd-macro) | |
(define-key global-map [\M-f2] 'apply-macro-to-region-lines) | |
(define-key global-map [f9] (lambda () (interactive) | |
(save-some-buffers t) | |
(if (get-buffer "*compilation*") (set-buffer "*compilation*")) | |
(compile compile-command))) | |
(define-key global-map [\M-f9] (lambda () (interactive) (switch-to-buffer "*compilation*"))) | |
(define-key global-map [(control \;)] 'repeat) | |
(define-key global-map [\C-down] '(lambda () (interactive) (scroll-up 3))) | |
(define-key global-map [\C-up] '(lambda () (interactive) (scroll-down 3))) | |
(define-key global-map [\C-delete] "\C-d") | |
(define-key global-map [\C-backspace] 'backward-save-word-as-kill) | |
(define-key global-map [\M-delete] 'kill-word) | |
(define-key global-map "\M- " 'just-one-space) | |
(define-key global-map "\M-n" 'next-error) | |
(define-key global-map "\M-p" 'previous-error) | |
(define-key global-map "\C-o" 'other-window) | |
(define-key global-map [f3] (lambda () (interactive) (switch-to-buffer nil))) | |
(define-key global-map [\M-f3] 'bury-buffer) | |
(define-key global-map "\C-cr" (lambda () (interactive) (revert-buffer t t))) | |
(define-key global-map "\M-s" 'tags-search) ;; # etags <file ...> | |
(define-key global-map "\C-hn" 'man) | |
(define-key global-map [mouse-4] (lambda () (interactive) (scroll-down 8))) | |
(define-key global-map [mouse-5] (lambda () (interactive) (scroll-up 8))) | |
(define-key global-map "\M-k" 'kill-whole-line) | |
(define-key global-map "\M-e" 'forward-save-sexp-as-kill) | |
(define-key global-map "\M-r" 'backward-save-sexp-as-kill) | |
(define-key global-map [\M-up] '(lambda () (interactive) (search-backward "}") (forward-char) (backward-sexp))) | |
(define-key global-map [\M-down] '(lambda () (interactive) (search-forward "{") (backward-char) (forward-sexp))) | |
(define-key global-map [\M-left] '(lambda () (interactive) (search-backward-regexp "[])\"]") (forward-char) (backward-sexp))) | |
(define-key global-map [\M-right] '(lambda () (interactive) (search-forward-regexp "[[(\"]") (backward-char) (forward-sexp))) | |
(define-key global-map "\C-ci" '(lambda (arg) (interactive "P") (set-fill-column (if (not arg) (current-column) arg)))) | |
(define-key global-map [\C-end] '(lambda () (interactive) (search-forward-regexp (concat "\\b" (current-kill 0 t) "\\b")))) | |
(define-key global-map [\C-home] '(lambda () (interactive) (search-backward-regexp (concat "\\b" (current-kill 0 t) "\\b")))) | |
(define-key global-map [\C-\S-tab] 'insert-tab-char) | |
(define-key global-map [\C-\M-space] 'insert-space-char) | |
(define-key global-map [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag) | |
(define-key global-map "\C-j" '(lambda () (interactive) (join-line -1))) | |
(define-key global-map [\M-\C-/] 'dabbrev-expand) | |
(define-key global-map "\M-/" 'dabbrev-completion) | |
(define-key global-map "\C-\M-q" 'indent-current-sexp) | |
(define-key emacs-lisp-mode-map "\C-\M-q" 'indent-current-sexp) | |
(if window-system (define-key global-map "\C-z" 'indent-riffle)) | |
(global-set-key [(shift tab)] 'comint-dynamic-complete-filename) | |
(global-set-key [(shift iso-lefttab)] 'comint-dynamic-complete-filename) | |
(global-set-key (kbd "C-.") (kbd "M-. <return>")) | |
(global-set-key "\C-x$" 'selective-display) | |
(defvar personal-macro-map (make-sparse-keymap)) | |
(define-key personal-map "a" 'magit-status) | |
(define-key personal-map "g" 'lgrep) | |
(define-key personal-map "\C-q" 'fill-region) | |
(define-key personal-map ";" 'comment-region) | |
(define-key personal-map "q" 'unfill) | |
(define-key personal-map "p" 'compile) | |
(define-key personal-map "c" 'calculator) | |
(define-key personal-map "mb" 'bind-last-kdb-macro) | |
(define-key personal-map "md" 'global-unset-key) | |
(define-key personal-map "l" 'font-lock-fontify-buffer) | |
(define-key personal-map "f" 'find-file-at-point) | |
(define-key personal-map "o" 'occur) | |
(define-key personal-map "t" 'insert-time-stamp) | |
(define-key personal-map "v" 'view-mode) | |
(define-key personal-map "y" '(lambda () (interactive) (flyspell-mode) (flyspell-buffer))) | |
(define-key personal-map "." 'visit-tags-table) | |
(define-key personal-map [up] 'up-list-backward-sexp) | |
(define-key personal-map [down] 'up-list-pop) | |
(define-key personal-map "-" 'text-scale-decrease) | |
(define-key personal-map "=" 'text-scale-increase) | |
(define-key personal-map [tab] 'set-tab-width) | |
(define-key personal-map "h" 'highlight-phrase) | |
(define-key personal-map "\C-h" 'highlight-regexp) | |
(defun bind-last-kdb-macro (key) | |
(interactive "KKey to set: ") | |
(define-key (current-global-map) key last-kbd-macro) | |
(message "Bound %s to %s" key last-kbd-macro)) | |
(defvar grep-and-find-map (make-sparse-keymap)) | |
(define-key global-map "\C-xf" grep-and-find-map) | |
(define-key global-map "\C-xfg" 'find-grep-dired) | |
(define-key global-map "\C-xff" 'find-name-dired) | |
(define-key global-map "\C-xfl" (lambda (dir pattern) | |
(interactive "DFind-name locate-style (directory): \nsFind-name locate-style (filename wildcard): ") | |
(find-dired dir (concat "-name '*" pattern "*'")))) | |
;; Hooks for key mappings | |
;; | |
(add-hook 'after-save-hook 'autocompile-dot-emacs) | |
(add-hook 'ruby-mode-hook | |
'(lambda () | |
(define-key ruby-mode-map (kbd "C-j") '(lambda () (interactive) (join-line -1))))) | |
(add-hook 'custom-mode-hook | |
'(lambda () | |
(define-key custom-mode-map "s" 'Custom-save) | |
(define-key custom-mode-map "a" (lambda () (interactive) (Custom-set) (message "custom set"))))) | |
(add-hook 'dired-mode-hook | |
'(lambda () | |
(define-key dired-mode-map "\C-o" 'other-window))) | |
(add-hook 'compilation-mode-hook | |
'(lambda () (define-key compilation-mode-map "\C-c\C-c" 'kill-compilation))) | |
(add-hook 'latex-mode-hook | |
'(lambda () (define-key latex-mode-map "\C-j" '(lambda () (interactive) (join-line -1))))) | |
(add-hook 'ediff-keymap-setup-hook | |
'(lambda () (define-key ediff-mode-map "q" '(lambda () (interactive) (ediff-really-quit nil))))) | |
;; Hooks Action configs | |
;; | |
(add-hook 'diary-display-hook 'appt-make-list) | |
(add-hook 'c-mode-common-hook 'c-mode-customize) | |
(add-hook 'c-mode-hook 'c-mode-customize) | |
(add-hook 'java-mode-hook 'c-mode-customize) | |
(add-hook 'text-mode-hook 'turn-on-auto-fill) | |
(add-hook 'comint-output-filter-functions 'comint-truncate-buffer) | |
(add-hook 'compilation-mode-hook '(lambda () (setq tab-width 30))) | |
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t) | |
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt nil t) | |
;(add-hook 'auto-save-hook '(lambda () (desktop-save desktop-dirname))) | |
(add-hook 'comint-mode-hook '(lambda () (define-key comint-mode-map [C-return] 'comint-accumulate))) | |
(add-hook 'javascript-mode-hook (lambda () (flymake-mode t))) | |
;; Re-enable Some functions | |
(put 'eval-expression 'disabled nil) | |
(put 'erase-buffer 'disabled nil) | |
(put 'narrow-to-region 'disabled nil) | |
(put 'downcase-region 'disabled nil) | |
(put 'upcase-region 'disabled nil) | |
(put 'downcase-word 'disabled nil) | |
(put 'edit-kbd-macro 'disabled nil) | |
(put 'dired-find-alternate-file 'disabled nil) | |
;; Enable Feature Stuff | |
;; | |
(delete-selection-mode) | |
(transient-mark-mode 0) | |
(column-number-mode t) | |
(ido-mode) | |
(require 'uniquify) | |
(require 'dired-x) | |
(require 'cygwin-mount) | |
(setenv "LANG" "en_US.UTF-8") | |
;; And disable some | |
(put 'c-toggle-auto-state 'disabled t) | |
;(unless (getenv "EMACS_NO_DESKTOP") | |
; (desktop-save-mode 1) | |
; (desktop-save-mode) | |
; (add-to-list 'desktop-globals-to-save 'compile-command) | |
; (add-to-list 'desktop-globals-to-save 'compilation-search-path) | |
; (add-to-list 'desktop-globals-to-save 'compile-history) | |
; (add-to-list 'desktop-globals-to-save 'grep-history) | |
; (add-to-list 'desktop-globals-to-save 'find-args-history) | |
; (add-to-list 'desktop-globals-to-save 'personal-macro-map) | |
; (add-to-list 'desktop-globals-to-save 'extended-command-history) | |
; (desktop-read) | |
; ) ;; use desktop-save to save the session list of files if not done automaticaly | |
(define-key personal-map "m" personal-macro-map) ;; HACK! | |
(server-start) | |
(put 'scroll-left 'disabled nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment