+
+;;; alias the new `flymake-report-status-slim' to
+;;; `flymake-report-status'
+(defalias 'flymake-report-status 'flymake-report-status-slim)
+(defun flymake-report-status-slim (e-w &optional status)
+ "Show \"slim\" flymake status in mode line."
+ (when e-w
+ (setq flymake-mode-line-e-w e-w))
+ (when status
+ (setq flymake-mode-line-status status))
+ (let* ((mode-line " Φ"))
+ (when (> (length flymake-mode-line-e-w) 0)
+ (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
+ (setq mode-line (concat mode-line flymake-mode-line-status))
+ (setq flymake-mode-line mode-line)
+ (force-mode-line-update)))
+
+; load sql-indent when sql is loaded
+(eval-after-load "sql"
+ '(load-library "sql-indent"))
+
+; fix up tmux xterm keys
+; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
+(if (getenv "TMUX")
+ (progn
+ (let ((x 2) (tkey ""))
+ (while (<= x 8)
+ ;; shift
+ (if (= x 2)
+ (setq tkey "S-"))
+ ;; alt
+ (if (= x 3)
+ (setq tkey "M-"))
+ ;; alt + shift
+ (if (= x 4)
+ (setq tkey "M-S-"))
+ ;; ctrl
+ (if (= x 5)
+ (setq tkey "C-"))
+ ;; ctrl + shift
+ (if (= x 6)
+ (setq tkey "C-S-"))
+ ;; ctrl + alt
+ (if (= x 7)
+ (setq tkey "C-M-"))
+ ;; ctrl + alt + shift
+ (if (= x 8)
+ (setq tkey "C-M-S-"))
+
+ ;; arrows
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
+ ;; home
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
+ ;; end
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
+ ;; page up
+ (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
+ ;; page down
+ (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
+ ;; insert
+ (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
+ ;; delete
+ (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
+ ;; f1
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
+ ;; f2
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
+ ;; f3
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
+ ;; f4
+ (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
+ ;; f5
+ (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
+ ;; f6
+ (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
+ ;; f7
+ (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
+ ;; f8
+ (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
+ ;; f9
+ (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
+ ;; f10
+ (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
+ ;; f11
+ (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
+ ;; f12
+ (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
+ ;; f13
+ (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
+ ;; f14
+ (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
+ ;; f15
+ (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
+ ;; f16
+ (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
+ ;; f17
+ (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
+ ;; f18
+ (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
+ ;; f19
+ (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
+ ;; f20
+ (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
+
+ (setq x (+ x 1))
+ ))
+ )
+ )
+
+; require org mode
+(load "org-mode-configuration")
+; ess configuration
+(load "ess_remote_eval")
+(load "ess_configuration")
+; procmailmode configuration
+(load "procmail_mode")
+
+(load "mode-line-cleaner")
+
+(defadvice ask-user-about-supersession-threat (around ask-user-about-supersession-threat-if-necessary)
+ "Call ask-user-about-supersession-threat only if the buffer is actually obsolete."
+ (if (or (buffer-modified-p)
+ (verify-visited-file-modtime)
+ (< (* 8 1024 1024) (buffer-size))
+ (/= 0 (call-process-region 1 (+ 1 (buffer-size)) "diff" nil nil nil "-q" (buffer-file-name) "-")))
+ ad-do-it
+ (clear-visited-file-modtime)
+ (not-modified)))
+(ad-activate 'ask-user-about-supersession-threat)
+
+; apparently things like to step on C-;, so we'll use a hack from
+; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this
+
+(defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
+
+; use iedit everywhere
+(define-key my-keys-minor-mode-map (kbd "C-;") 'iedit-mode)
+
+(define-minor-mode my-keys-minor-mode
+ "A minor mode so that my key settings override annoying major modes."
+ t " my-keys" 'my-keys-minor-mode-map)
+
+(my-keys-minor-mode 1)
+(defun my-minibuffer-setup-hook ()
+ (my-keys-minor-mode 0))
+
+(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
+(defadvice load (after give-my-keybindings-priority)
+ "Try to ensure that my keybindings always have priority."
+ (if (not (eq (car (car minor-mode-map-alist)) 'my-keys-minor-mode))
+ (let ((mykeys (assq 'my-keys-minor-mode minor-mode-map-alist)))
+ (assq-delete-all 'my-keys-minor-mode minor-mode-map-alist)
+ (add-to-list 'minor-mode-map-alist mykeys))))
+(ad-activate 'load)