(when window-system
(tool-bar-mode -1))
(defvar *freebsd-system* (string-match "freebsd" system-configuration))
(defvar *linux-system* (string-match "linux" system-configuration))
(defvar *nt-system* (string-match "nt" system-configuration))
(setq inhibit-startup-message t) (when window-system
(set-scroll-bar-mode 'right) (scroll-bar-mode -1) (tooltip-mode 0)) (menu-bar-mode -1)
(setq menu-bar-final-items '(tools buffer help-menu))
(when (fboundp 'set-fringe-mode) (set-fringe-mode 2))
(global-font-lock-mode 1) (blink-cursor-mode nil) (setq visible-bell t)
(setq load-path (cons "~/.emacs.d" load-path))
(setq message-log-max nil)
(when (not (eq nil (get-buffer "*Messages*")))
(kill-buffer "*Messages*"))
(setq debug-on-error t)
(setq make-backup-files t backup-by-copying t backup-directory-alist
'(("." . "~/.emacs.d/saves")) delete-old-versions t kept-new-versions 4
kept-old-versions 2
version-control t auto-save-default nil)
(set-default-coding-systems 'utf-8-unix)
(require 'cl)
(load-library "misc")
(when *nt-system*
(and (= emacs-major-version 23)
(defun server-ensure-safe-dir (dir) "Noop" t)))
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-xw" 'kill-region)
(global-set-key "\C-xs" 'save-buffer)
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key "\M-g" 'goto-line)
(global-set-key "\M-G" 'goto-char)
(global-set-key "\M-?" 'help-for-help)
(global-set-key "\C-x\C-k" 'kill-this-buffer) (global-set-key "\C-r" 'isearch-backward)
(global-set-key "\C-c\C-r" 'revert-buffer)
(global-set-key "\C-x\C-i" 'indent-region)
(global-set-key "\C-c\C-i" 'indent-region)
(global-set-key "\C-ce" 'fixup-whitespace)
(global-set-key "\C-x\C-u" 'undo)
(global-set-key "\C-cg" 'replace-string)
(global-set-key "\C-c;" 'comment-region)
(global-set-key "\C-c'" 'uncomment-region)
(global-set-key "\M-/" 'hippie-expand) (global-set-key "\M-z" 'zap-up-to-char) (global-set-key "\M-o" 'other-window)
(global-set-key "\C-x\C-a" 'align-regexp)
(global-set-key "\C-xf" 'find-file)
(global-set-key "\C-x\M-f" 'set-fill-column)
(global-set-key [f9] 'start-kbd-macro)
(global-set-key [f10] 'edit-kdb-macro)
(global-set-key [f11] 'end-kbd-macro)
(global-set-key [f12] 'call-last-kbd-macro)
(global-set-key (kbd "<C-tab>") 'bury-buffer)
(global-set-key [f5] 'compile)
(global-set-key "\C-cn" 'next-error)
(global-set-key "\C-cp" 'previous-error)
(global-set-key [Scroll_Lock] 'ignore)
(global-set-key [mouse-9] 'ignore)
(global-set-key [double-mouse-9] 'ignore)
(global-set-key [drag-mouse-9] 'ignore)
(when window-system
(global-unset-key "\C-z"))
(setq-default fill-column 79)
(defun bcm-unfill-paragraph ()
"Un-fill paragraph at point."
(interactive)
(let ((fill-column (point-max)))
(fill-paragraph nil)))
(global-set-key "\M-p" 'bcm-unfill-paragraph)
(setq-default indent-tabs-mode nil)
(setq tab-stop-list '(2 4 6 8 10 12 14 16 18))
(show-paren-mode 1)
(put 'narrow-to-region 'disabled nil)
(put 'erase-buffer 'disabled nil)
(defun overwrite-mode (arg) (interactive "P"))
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))
(setq hippie-expand-dabbrev-as-symbol nil)
(setq bcm-set-cursor-color-color "")
(setq bcm-set-cursor-color-buffer "")
(defun bcm-set-cursor-color-according-to-mode ()
"Change cursor color according to some minor modes."
(let ((color (if buffer-read-only "red" "DarkSlateGray")))
(unless (and
(string= color bcm-set-cursor-color-color)
(string= (buffer-name) bcm-set-cursor-color-buffer))
(set-cursor-color (setq bcm-set-cursor-color-color color))
(setq bcm-set-cursor-color-buffer (buffer-name)))))
(add-hook 'post-command-hook 'bcm-set-cursor-color-according-to-mode)
(defalias 'qrr 'query-replace-regexp)
(defadvice query-replace-read-args (before barf-if-buffer-read-only activate)
"Signal a `buffer-read-only' error if the current buffer is read-only."
(barf-if-buffer-read-only))
(setq mouse-yank-at-point t)
(require 'saveplace)
(setq-default save-place t)
(setq sentence-end-double-space t)
(transient-mark-mode 1)
(setq set-mark-command-repeat-pop t)
(setq require-final-newline t)
(defun bcm-backward-kill-line (arg)
"Kill chars backward until encountering the end of a line."
(interactive "p")
(kill-line 0))
(global-set-key "\M-\C-k" 'bcm-backward-kill-line)
(defun bcm-copy-line (&optional arg)
"Do a kill-line but copy rather than kill."
(interactive "P")
(toggle-read-only 1)
(kill-line arg)
(toggle-read-only 0))
(setq-default kill-read-only-ok t)
(defun bcm-wp-munge ()
"Un-fill paragraphs and remove blank lines."
(interactive)
(let ((save-fill-column fill-column))
(set-fill-column 1000000)
(mark-whole-buffer)
(fill-individual-paragraphs (point-min) (point-max))
(delete-matching-lines "^$")
(set-fill-column save-fill-column)))
(defun bcm-cut-ctrlm ()
"Cut all visible ^M."
(interactive)
(beginning-of-buffer)
(while (search-forward "\r" nil t)
(replace-match "" nil t)))
(defun bcm-date ()
"Insert a nicely formated date string."
(interactive)
(insert (format-time-string "%Y-%m-%d")))
(windmove-default-keybindings)
(setq scroll-conservatively 4)
(setq hscroll-margin 1)
(setq scroll-margin 2)
(setq scroll-preserve-screen-position t)
(defadvice scroll-up (around ewd-scroll-up first act)
"Keep cursor in the same column."
(let ((col (current-column)))
ad-do-it
(move-to-column col)))
(defadvice scroll-down (around ewd-scroll-down first act)
"Keep cursor in the same column."
(let ((col (current-column)))
ad-do-it
(move-to-column col)))
(global-set-key [M-down]
'(lambda () (interactive) (progn (forward-line 4) (recenter))))
(global-set-key [M-up]
'(lambda () (interactive) (progn (forward-line -4) (recenter))))
(global-set-key "\C-x\C-b" 'bs-show)
(global-set-key [home] 'bcm-my-smart-home)
(global-set-key [end] 'bcm-my-smart-end)
(defun bcm-my-smart-home ()
"Odd home to beginning of line, even home to beginning of text/code."
(interactive)
(if (and (eq last-command 'bcm-my-smart-home)
(/= (line-beginning-position) (point)))
(beginning-of-line)
(beginning-of-line-text)))
(defun bcm-my-smart-end ()
"Odd end to end of line, even end to begin of text/code."
(interactive)
(if (and (eq last-command 'bcm-my-smart-end)
(= (line-end-position) (point)))
(bcm-end-of-line-text)
(end-of-line)))
(defun bcm-end-of-line-text ()
"Move to end of current line and skip comments and trailing space."
(interactive)
(end-of-line)
(let ((bol (line-beginning-position)))
(unless (eq font-lock-comment-face (get-text-property bol 'face))
(while (and (/= bol (point))
(eq font-lock-comment-face
(get-text-property (point) 'face)))
(backward-char 1))
(unless (= (point) bol)
(forward-char 1) (skip-chars-backward " \t\n")))))
(global-set-key [\C-home] 'beginning-of-buffer)
(global-set-key [\C-end] 'end-of-buffer)
(setq gc-cons-threshold 50000000)
(setq window-min-height 3)
(setq column-number-mode t)
(setq safe-local-variable-values '((outline-minor-mode . t)
(eldoc-mode . t)))
(when *freebsd-system*
(setq shell-file-name "/usr/local/bin/zsh")
(setq tex-shell-file-name "/usr/local/bin/zsh"))
(when *linux-system*
(setq shell-file-name "/usr/bin/zsh")
(setq tex-shell-file-name "/usr/bin/zsh"))
(when *nt-system*
(setq shell-file-name "/usr/bin/bash")
(setq tex-shell-file-name "/usr/bin/bash"))
(defalias 'yes-or-no-p 'y-or-n-p)
(define-key query-replace-map [return] 'act)
(define-key query-replace-map [?\C-m] 'act)
(when (not window-system)
(setq use-dialog-box nil))
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt)
(setq disabled-command-hook nil)
(auto-compression-mode 1)
(icomplete-mode t)
(setq read-buffer-completion-ignore-case t)
(setq read-file-name-completion-ignore-case t)
(setq completion-ignored-extensions
'(".o" ".elc" ".class" "java~" ".ps" ".abs" ".mx" ".~jv" ".bak" ))
(defun bcm-emacs-reloaded ()
"Display animated startup message."
(animate-string (concat ";; Initialization successful. Welcome to "
(substring (emacs-version) 0 16)
".")
0 0)
(newline-and-indent) (newline-and-indent))
(add-hook 'after-init-hook 'bcm-emacs-reloaded)
(defun bcm-zoom (n)
"With positive N, increase the font size, otherwise decrease it."
(set-face-attribute 'default (selected-frame) :height
(+ (face-attribute 'default :height)
(* (if (> n 0) 1 -1) 10))))
(global-set-key (kbd "C-+") '(lambda () (interactive) (bcm-zoom 1)))
(global-set-key [C-kp-add] '(lambda () (interactive) (bcm-zoom 1)))
(global-set-key (kbd "C--") '(lambda () (interactive) (bcm-zoom -1)))
(global-set-key [C-kp-subtract] '(lambda () (interactive) (bcm-zoom -1)))
(setq time-stamp-active t time-stamp-line-limit 10 time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)") (add-hook 'write-file-hooks 'time-stamp)
(defun bcm-autocompile ()
"Compile self in ~/.emacs.d/build"
(interactive)
(require 'bytecomp)
(if (string= (buffer-file-name)
(expand-file-name
(concat default-directory "~/.emacs.d/build")))
(byte-compile-file (buffer-file-name))))
(add-hook 'after-save-hook 'bcm-autocompile)
(defun bcm-cleanup ()
"Kill all buffers except *scratch*."
(interactive)
(mapcar (lambda (x) (kill-buffer x)) (buffer-list)) (delete-other-windows))
(defun bcm-indent ()
"Indent whole buffer."
(interactive)
(delete-trailing-whitespace)
(indent-region (point-min) (point-max) nil)
(untabify (point-min) (point-max)))
(global-set-key (kbd "<f4>") 'bcm-indent)
(when (or *freebsd-system* *linux-system*)
(defvar scheme-program-name "gosh"
"*Program invoked by the run-scheme command"))
(add-hook 'scheme-mode-hook 'flyspell-prog-mode)
(add-hook 'emacs-lisp-mode-hook 'flyspell-prog-mode)
(setq compilation-window-height 16)
(setq compilation-scroll-output t)
(setq compilation-finish-function
(lambda (buf str)
(if (or (string-match "exited abnormally" str)
(string-match (buffer-name buf) "*grep*"))
(message "Compilation errors, press C-x ` to visit.")
(run-at-time 2 nil 'delete-windows-on buf)
(message "Build Succeeded."))))
(setq auto-mode-alist
(append '(("\\.l$" . c-mode))
auto-mode-alist))
(setq c-default-style "bsd"
c-basic-offset 4)
(add-hook 'c-mode-hook 'flyspell-prog-mode)
(setq sql-connection-alist
'((pool-a
(sql-product 'mysql)
(sql-server "127.0.0.1")
(sql-user "root")
(sql-password "lintest")
(sql-database "l1jdb")
(sql-port 3306))))
(defun sql-connect-preset (name)
"Connect to a predefined SQL connection listed in `sql-connection-alist'."
(eval `(let ,(cdr (assoc name sql-connection-alist))
(flet ((sql-get-login (&rest what)))
(sql-product-interactive sql-product)))))
(defun sql-pool-a ()
"Connect to SQL pool 0."
(interactive)
(sql-connect-preset 'pool-a))
(add-to-list 'auto-mode-alist '("\\.script$" . sql-mode))
(add-to-list 'auto-mode-alist '("\\.hql$" . sql-mode))
(when (fboundp 'resize-minibuffer-mode)
(resize-minibuffer-mode)
(setq resize-minibuffer-window-exactly nil))
(defun bcm-flymake-display-err-minibuf ()
"Displays the error/warning for the current line in the minibuffer."
(interactive)
(let* ((line-no (flymake-current-line-no))
(line-err-info-list (nth 0 (flymake-find-err-info
flymake-err-info line-no)))
(count (length line-err-info-list)))
(while (> count 0)
(when line-err-info-list
(let* ((file (flymake-ler-file (nth (1- count) line-err-info-list)))
(full-file (flymake-ler-full-file (nth (1- count)
line-err-info-list)))
(text (flymake-ler-text (nth (1- count) line-err-info-list)))
(line (flymake-ler-line (nth (1- count) line-err-info-list))))
(message "[%s] %s" line text)))
(setq count (1- count)))))
(global-set-key "\C-c[" 'flymake-goto-prev-error)
(global-set-key "\C-c]" 'flymake-goto-next-error)
(global-set-key "\C-c\\" 'bcm-flymake-display-err-minibuf)
(autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
(setq prolog-system 'swi)
(setq prolog-program-switches
'((sicstus ("-i")) (swi ("-L0" "-G0" "-T0" "-A0")) (t nil)))
(add-to-list 'auto-mode-alist '("\\.plg$" . prolog-mode))
(setq auto-mode-alist (cons '("\\.m$" . prolog-mode) auto-mode-alist))
(defalias 'perl-mode 'cperl-mode)
(add-to-list 'auto-mode-alist '("\\.pl$" . cperl-mode))
(add-to-list 'auto-mode-alist '("\\.cgi$" . cperl-mode))
(add-to-list 'auto-mode-alist '("\\.pm$" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(setq auto-mode-alist
(cons '("\\.\\(xml\\|xsl\\|rng\\)\\'" . nxml-mode)
auto-mode-alist))
(add-hook 'conf-javaprop-mode-hook
'(lambda () (conf-quote-normal nil)))
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(dolist (hook '(text-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))
(dolist (hook '(change-log-mode-hook log-edit-mode-hook))
(add-hook hook (lambda () (flyspell-mode -1))))
(setq ispell-program-name "aspell"
ispell-extra-args '("--sug-mode=ultra"))
(setq flyspell-issue-welcome-flag nil)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq
org-todo-keywords (quote ((sequence
"TODO(t)"
"STARTED(s!)"
"|"
"DONE(d!/!)"
"CANCELED(c!)")))
org-todo-keyword-faces
(quote (("TODO" :foreground "red" :weight bold)
("STARTED" :foreground "blue" :weight bold)
("DONE" :foreground "forest green" :weight bold)
("CANCELED" :foreground "light sky blue" :weight bold))))
(add-hook 'org-mode-hook 'turn-on-auto-fill)
(org-remember-insinuate)
(setq remember-annotation-functions '(org-remember-annotation))
(add-hook 'remember-mode-hook 'org-remember-apply-template)
(setq remember-data-file "~/notes.org")
(global-set-key (kbd "\C-cr") 'org-remember)
(setq user-mail-address "bm3719@gmail.com") (setq change-log-default-name "CHANGELOG")
(setq savehist-additional-variables
'(search-ring regexp-search-ring) savehist-file "~/.emacs.d/savehist") (savehist-mode t)
(add-hook 'calendar-load-hook
'(lambda ()
(define-key calendar-mode-map "\C-x>" 'scroll-calendar-right)
(define-key calendar-mode-map "\C-x<" 'scroll-calendar-left)))
(setq
mark-holidays-in-calendar t
all-christian-calendar-holidays t
all-islamic-calendar-holidays nil
all-hebrew-calendar-holidays nil
display-time-24hr-format t)
(setq diary-file "~/.emacs.d/.diary") (setq mark-diary-entries-in-calendar t)
(setq tetris-score-file "~/.emacs.d/tetris-scores")
(setq mail-archive-file-name "~/Mail/sent") (defconst user-mail-address "bm3719@gmail.com")
(defalias 'man 'woman)
(setq
bookmark-default-file "~/.emacs.d/bookmarks" bookmark-save-flag 1)
(setq auto-mode-alist (cons '("\\.plan$" . text-mode) auto-mode-alist)
auto-mode-alist (cons '("\\.project$" . text-mode) auto-mode-alist)
auto-mode-alist (cons '("\\.doc$" . text-mode) auto-mode-alist)
auto-mode-alist (cons '("\\.zsh$" . sh-mode) auto-mode-alist)
auto-mode-alist (cons '("\\CHANGELOG$" . text-mode) auto-mode-alist)
auto-mode-alist (cons '("\\INSTALL$" . text-mode) auto-mode-alist)
auto-mode-alist (cons '("\\README$" . text-mode) auto-mode-alist)
auto-mode-alist (cons '("\\TODO$" . text-mode) auto-mode-alist))
(require 'generic)
(define-generic-mode 'arff-file-mode
(list ?%)
(list "attribute" "relation" "end" "data")
'(("\\('.*'\\)" 1 'font-lock-string-face)
("^\\@\\S-*\\s-\\(\\S-*\\)" 1 'font-lock-string-face)
("^\\@.*\\(real\\)" 1 'font-lock-type-face)
("^\\@.*\\(integer\\)" 1 'font-lock-type-face)
("^\\@.*\\(numeric\\)" 1 'font-lock-type-face)
("^\\@.*\\(string\\)" 1 'font-lock-type-face)
("^\\@.*\\(date\\)" 1 'font-lock-type-face)
("^\\@.*\\({.*}\\)" 1 'font-lock-type-face)
("^\\({\\).*\\(}\\)$" (1 'font-lock-reference-face)
(2 'font-lock-reference-face))
("\\(\\?\\)" 1 'font-lock-reference-face)
("\\(\\,\\)" 1 'font-lock-keyword-face)
("\\(-?[0-9]+?.?[0-9]+\\)" 1 'font-lock-constant-face)
("\\(\\@\\)" 1 'font-lock-preprocessor-face))
(list "\.arff?")
(list
(function
(lambda ()
(setq font-lock-defaults
(list 'generic-font-lock-defaults nil t (list (cons ?* "w") (cons ?- "w"))))
(turn-on-font-lock)))) "Mode for arff-files.")
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(server-force-delete)
(server-start)
(setq comint-scroll-to-bottom-on-input t
comint-scroll-to-bottom-on-output nil
comint-scroll-show-maximum-output t
comint-completion-addsuffix t
comint-buffer-maximum-size 100000
comint-input-ring-size 5000)
(when *nt-system*
(setq shell-file-name "bash")
(setq explicit-shell-file-name shell-file-name))
(setq tramp-default-method "scp")
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(let* ((my-lisp-dir "~/.emacs.d/")
(default-directory my-lisp-dir))
(add-to-list 'load-path my-lisp-dir)
(normal-top-level-add-subdirs-to-load-path)))
(require 'pabbrev)
(require 'pretty-symbols)
(require 'clojure-mode)
(require 'paredit)
(autoload 'enable-paredit-mode "paredit"
"Turn on pseudo-structural editing of Lisp code."
t)
(add-hook 'clojure-mode-hook 'enable-paredit-mode)
(cond ((or *freebsd-system* *linux-system*) (load "~/.emacs.d/haskell-mode/haskell-site-file.el"))
(*nt-system* (load "C:\\bm3719\\.emacs.d\\haskell-mode\\haskell-site-file.el")))
(setq auto-mode-alist
(append auto-mode-alist
'(("\\.[hg]s$" . haskell-mode)
("\\.hi$" . haskell-mode)
("\\.l[hg]s$" . literate-haskell-mode))))
(autoload 'haskell-mode "haskell-mode"
"Major mode for editing Haskell scripts." t)
(autoload 'literate-haskell-mode "haskell-mode"
"Major mode for editing literate Haskell scripts." t)
(defun flymake-get-haskell-cmdline (source base-dir)
"Handles command line GHC call."
(list "ghc"
(list "--make" "-fbyte-code"
(concat "-i"base-dir)
source)))
(defun flymake-haskell-init ()
"Initialize flymake-haskell."
(flymake-simple-make-init-impl
'flymake-create-temp-with-folder-structure nil nil
(file-name-nondirectory buffer-file-name)
'flymake-get-haskell-cmdline))
(defvar multiline-flymake-mode nil)
(defvar flymake-split-output-multiline nil)
(defadvice flymake-split-output
(around flymake-split-output-multiline activate protect)
(if multiline-flymake-mode
(let ((flymake-split-output-multiline t))
ad-do-it)
ad-do-it))
(defadvice flymake-split-string
(before flymake-split-string-multiline activate)
(when flymake-split-output-multiline
(ad-set-arg 1 "^\\s *$")))
(eval-after-load "flymake"
'(progn
(add-to-list 'flymake-allowed-file-name-masks
'("\\.l?hs$" flymake-haskell-init flymake-simple-java-cleanup))
(add-to-list 'flymake-err-line-patterns
'("^\\(.+\\.l?hs\\):\\([0-9]+\\):\\([0-9]+\\):\\(\\(?:.\\|\\W\\)+\\)"
1 2 3 4))))
(add-hook 'haskell-mode-hook
'(lambda ()
(turn-on-haskell-decl-scan)
(turn-on-haskell-doc-mode)
(turn-on-font-lock)
(turn-on-haskell-indentation)
(flyspell-prog-mode)
(setq show-trailing-whitespace t)
(set (make-local-variable 'multiline-flymake-mode) t)
(flymake-mode 1)))
(add-hook 'literate-haskell-mode
'(lambda ()
(flyspell-mode 1)
(pretty-greek)
(haskell-unicode)
(flymake-mode 1)))
(setq use-dialog-box nil)
(when *freebsd-system*
(load-file (let ((coding-system-for-read 'utf-8))
(shell-command-to-string "agda-mode locate")))
(autoload 'agda-mode "agda2-mode.el"
"Major mode for Agda files" t)
(unless (assoc "\\.agda" auto-mode-alist)
(setq auto-mode-alist
(nconc '(("\\.agda" . agda2-mode)
("\\.alfa" . agda2-mode)) auto-mode-alist))))
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))
(add-hook 'python-mode-hook
(lambda ()
(set (make-variable-buffer-local 'beginning-of-defun-function)
'py-beginning-of-def-or-class)
(setq outline-regexp "def\\|class ")
(pabbrev-mode)
(flyspell-prog-mode)
(flymake-mode)
(local-set-key "\C-cL" 'py-execute-buffer)))
(defun flymake-pyflakes-init ()
"Initialize Flymake for Python, using pyflakes."
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "pyflakes" (list local-file))))
(when (load "flymake" t)
(push '("\\.py\\'" flymake-pyflakes-init)
flymake-allowed-file-name-masks))
(require 'ipython)
(require 'helm-config)
(require 'helm-ipython)
(define-key py-mode-map (kbd "M-<tab>") 'helm-ipython-complete)
(define-key py-shell-map (kbd "M-<tab>") 'helm-ipython-complete)
(define-key py-mode-map (kbd "C-c M") 'helm-ipython-import-modules-from-buffer)
(autoload 'ruby-mode "ruby-mode" "Major mode for ruby files" t)
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
(autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)
(flyspell-prog-mode)))
(when (not *nt-system*)
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq LaTeX-section-hook
'(LaTeX-section-heading
LaTeX-section-title
LaTeX-section-toc
LaTeX-section-section
LaTeX-section-label)))
(load "~/.emacs.d/nxhtml/autostart.el")
(dolist (hook '(nxhtml-mode-hook))
(add-hook hook (lambda () (flyspell-prog-mode))))
(custom-set-faces
'(mumamo-background-chunk-major ((((class color) (min-colors 88) (background dark)) nil))))
(autoload #'espresso-mode "espresso" "Start espresso-mode" t)
(add-to-list 'auto-mode-alist '("\\.js$" . espresso-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . espresso-mode))
(require 'flymake-jslint)
(autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t)
(add-hook 'espresso-mode-hook
'(lambda ()
(moz-minor-mode 1)
(pabbrev-mode)
(flymake-mode)
(flyspell-prog-mode)))
(require 'batch-mode)
(when *nt-system* (load-file "~/.emacs.d/cedet-1.0pre6/common/cedet.el"))
(setq semantic-load-turn-useful-things-on t)
(setq semanticdb-default-save-directory "~/.emacs.d/saves/semantic.cache")
(require 'cedet)
(require 'jde)
(when (not (eq nil (get-buffer "*JDEE bsh*")))
(kill-buffer "*JDEE bsh*"))
(when *freebsd-system*
(setq jde-jdk-registry '(("1.6.0" . "/usr/local/diablo-jdk1.6.0"))))
(when *linux-system*
(if (file-exists-p "/usr/lib/jvm/java-6-openjdk")
(setq jde-jdk-registry '(("1.6.0" . "/usr/lib/jvm/java-6-openjdk")))
(setq jde-jdk-registry '(("1.6.0" . "/usr/lib/jvm/java-6-sun")))))
(when *nt-system*
(if (file-exists-p "C:\\Program Files\\Java\\jdk1.6.0_18")
(setq jde-jdk-registry
'(("1.6.0" . "C:\\Program Files\\Java\\jdk1.6.0_18")))
(setq jde-jdk-registry
'(("1.6.0" . "C:\\Program Files (x86)\\Java\\jdk1.6.0_18")))))
(setq
jde-jdk '("1.6.0")
jde-gen-k&r nil
jde-enable-abbrev-mode t
jde-complete-function 'jde-complete-menu
jde-sourcepath '(("."))
jde-global-classpath '("."))
(jde-gen-define-abbrev-template
"main"
'('> "public static void main (String[] args) {" '> 'n '> 'r 'n '> "}" '>))
(when (or *freebsd-system* *linux-system*)
(defvar ecj-path "/home/bm3719/.ant/lib/ecj-3.6.jar"))
(when *nt-system*
(defvar ecj-path
"C:\\bm3719\\bin\\org.eclipse.jdt.core_3.5.2.v_981_R35x.jar"))
(require 'jde-eclipse-compiler-server)
(setq jde-compiler (list (list "eclipse java compiler server" ecj-path)))
(setq jde-ecj-command-line-args (list "-d" "none"
"-target" "1.6" "-source" "1.6"
"-proceedOnError"))
(push '(".+\\.java$" jde-ecj-flymake-init jde-ecj-flymake-cleanup)
flymake-allowed-file-name-masks)
(push '("\\(.*?\\):\\([0-9]+\\): error: \\(.*?\\)\n" 1 2 nil 2 3
(6 compilation-error-face)) compilation-error-regexp-alist)
(push '("\\(.*?\\):\\([0-9]+\\): warning: \\(.*?\\)\n" 1 2 nil 1 3
(6 compilation-warning-face)) compilation-error-regexp-alist)
(add-hook 'jde-mode-hook '(lambda ()
(flymake-mode)
(flyspell-prog-mode)
(local-set-key (kbd "C-c C-v TAB")
'jde-complete-menu)))
(require 'ess-site)
(require 'ess-rutils)
(setq ess-ask-for-ess-directory nil
ess-local-process-name "R"
ess-imenu-use-S t
ess-language "R"
ess-pdf-viewer-pref "xpdf"
ess-ps-viewer-pref "gs")
(defun bcm-ess-start-R ()
"Start R."
(interactive)
(when (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
(delete-other-windows)
(setq w1 (selected-window))
(setq w1name (buffer-name))
(setq w2 (split-window w1))
(R)
(set-window-buffer w2 "*R*")
(set-window-buffer w1 w1name)))
(defun bcm-ess-eval ()
"Eval ESS region."
(interactive)
(bcm-ess-start-R)
(if (and transient-mark-mode mark-active)
(call-interactively 'ess-eval-region)
(call-interactively 'ess-eval-line-and-step)))
(add-hook 'ess-mode-hook
'(lambda ()
(local-set-key [(shift return)] 'bcm-ess-eval)
(local-set-key [?\C-c ?\M-r] 'ess-rutils-rmall)
(local-set-key [?\C-c ?\C-f] 'ess-rutils-rsitesearch)))
(add-hook 'inferior-ess-mode-hook
'(lambda ()
(local-set-key [C-up] 'comint-previous-input)
(local-set-key [C-down] 'comint-next-input)
(local-set-key [?\C-c ?\M-r] 'ess-rutils-rmall)
(local-set-key [?\C-c ?\C-f] 'ess-rutils-rsitesearch)))
(setq auto-mode-alist (cons '("\\.max" . maxima-mode) auto-mode-alist))
(when *freebsd-system*
(setq load-path (cons "/usr/local/share/maxima/5.20.1/emacs" load-path)))
(when *linux-system*
(setq load-path (cons "/usr/share/maxima/5.20.1/emacs" load-path)))
(when *nt-system*
(setq load-path
(cons "C:\\bin\\utils\\maxima\\share\\maxima\\5.20.1\\emacs"
load-path)))
(autoload 'maxima "maxima" "Running Maxima interactively" t)
(autoload 'maxima-mode "maxima" "Maxima editing mode" t)
(add-to-list 'auto-mode-alist
'("/mutt-\\|itsalltext.*mail\\.google" . mail-mode))
(add-hook 'mail-mode-hook 'turn-on-auto-fill)
(add-hook
'mail-mode-hook
(lambda ()
(define-key mail-mode-map [(control c) (control c)]
(lambda ()
(interactive)
(save-buffer)
(server-edit)))))
(when *freebsd-system*
(setq load-path (cons "/usr/local/share/gtags" load-path))
(autoload 'gtags-mode "gtags" "" t)
(setq c-mode-hook '(lambda () (gtags-mode 1))))
(load "elscreen" "ElScreen" t)
(global-set-key (kbd "<f7>") 'elscreen-create)
(global-set-key (kbd "<f8>") 'elscreen-kill)
(require 'elscreen-w3m)
(if window-system
(progn
(setq browse-url-browser-function 'browse-url-generic)
(when *nt-system*
(setq browse-url-generic-program
"C:\\Program Files\\Mozilla Firefox\\firefox.exe"))
(when *freebsd-system*
(setq browse-url-generic-program "/usr/local/bin/conkeror"))
(when *linux-system*
(setq browse-url-generic-program "/home/bm3719/bin/conkeror")))
(setq browse-url-browser-function 'w3m-browse-url))
(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
(global-set-key "\C-x\M-m" 'browse-url-at-point)
(setq w3m-use-tab t)
(setq w3m-use-cookies t)
(autoload 'multi-term "multi-term" nil t)
(autoload 'multi-term-next "multi-term" nil t)
(when *freebsd-system*
(setq multi-term-program "/usr/local/bin/zsh"))
(when *linux-system*
(setq multi-term-program "/usr/bin/zsh"))
(when *nt-system*
(setq multi-term-program "/usr/bin/bash"))
(global-set-key (kbd "C-c t") 'multi-term-next)
(global-set-key (kbd "C-c T") 'multi-term)
(require 'lusty-explorer)
(global-set-key (kbd "C-x C-f") 'lusty-file-explorer)
(global-set-key (kbd "C-x b") 'lusty-buffer-explorer)
(require 'emms-setup)
(emms-standard)
(emms-default-players)
(push 'emms-player-mplayer emms-player-list)
(add-hook 'emms-player-started-hook 'emms-show)
(setq emms-show-format "NP: %s")
(setq emms-source-file-default-directory "~/snd/")
(global-set-key (kbd "<kp-subtract>") 'emms-previous)
(global-set-key (kbd "<kp-add>") 'emms-next)
(global-set-key (kbd "<insert>") 'emms-pause)
(global-set-key (kbd "<kp-insert>") 'emms-pause)
(global-set-key (kbd "<f3>") 'emms)
(global-set-key (kbd "<kp-right>") 'emms-seek-forward)
(global-set-key (kbd "<kp-left>") 'emms-seek-backward)
(require 'color-theme)
(color-theme-initialize)
(require 'color-theme-wombat)
(when window-system
(color-theme-wombat))
(require 'darcsum)
(require 'psvn)
(require 'egg)
(when (not (eq nil (get-buffer "*Egg:Select Action*")))
(kill-buffer "*Egg:Select Action*"))
(autoload 'lojban-parse-region "lojban" nil t)
(autoload 'lojban-mode "lojban-mode" nil t)
(require 'lambdacalc)
(require 'malyon)
(require 'keywiz)
(require 'redo+)
(global-set-key "\C-x\M-_" 'redo)
(require 'htmlize)
(when *nt-system*
(set-default-font
"-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1"))
(when *nt-system*
(progn
(setq-default ps-lpr-command
(expand-file-name
"C:\\bin\\utils\\gs\\gsview\\gsview\\gsprint.exe"))
(setq-default ps-printer-name t)
(setq-default ps-printer-name-option nil)
(setq ps-lpr-switches '("-query")) (setq ps-right-header
'("/pagenumberstring load" ps-time-stamp-mon-dd-yyyy))))
(when *freebsd-system*
(setq lpr-command "xpp"))
(custom-set-variables
'(global-senator-minor-mode t nil (senator))
'(safe-local-variable-values (quote ((eldoc-mode . t) (outline-minor-mode . t))))
'(which-function-mode nil)
'(global-semantic-decoration-mode nil nil (semantic-decorate-mode))
'(global-semantic-highlight-edits-mode nil nil (semantic-util-modes))
'(global-semantic-highlight-func-mode nil nil (semantic-util-modes))
'(global-semantic-idle-completions-mode t nil (semantic-idle))
'(global-semantic-idle-scheduler-mode nil nil (semantic-idle))
'(global-semantic-idle-summary-mode nil nil (semantic-idle))
'(global-semantic-idle-tag-highlight-mode nil nil (semantic-idle))
'(global-semantic-show-parser-state-mode nil nil (semantic-util-modes))
'(global-semantic-show-unmatched-syntax-mode nil nil (semantic-util-modes))
'(global-semantic-stickyfunc-mode nil nil (semantic-util-modes))
'(semantic-complete-inline-analyzer-displayor-class (quote semantic-displayor-tooltip))
'(semantic-complete-inline-analyzer-idle-displayor-class (quote semantic-displayor-tooltip))
'(semantic-idle-scheduler-verbose-flag nil)
'(semantic-imenu-sort-bucket-function (quote semantic-sort-tags-by-name-increasing))
'(semanticdb-global-mode t nil (semanticdb)))
(run-with-timer 1 nil #'yow)