Source

dotfiles / .emacs

Diff from to
 ;; -*-Lisp-*-
+
 ;;
 ;; Load elisp dir
 ;;
+
 (setq elisp-dir "~/.elisp/")
 (add-to-list 'load-path elisp-dir)
+
 ;;
 ;; Load jbo.el
 ;;
+
 (setq jbo-dir (concat elisp-dir "jbo.el/"))
 (add-to-list 'load-path jbo-dir)
 (require 'jbo)
 (global-set-key (kbd "C-c M-l") 'jbo-lookup-at-point)
+
 ;;
 ;; Load Haskell mode
 ;;
+
 (setq haskell-elisp-dir (concat elisp-dir "haskell-mode/"))
 (add-to-list 'load-path haskell-elisp-dir)
 (load (concat haskell-elisp-dir "haskell-site-file.el"))
 (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
 (add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
 (add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
+
 ;;
 ;; Load OCaml major mode (Tuareg)
 ;;
+
 (setq tuareg-elisp-dir (concat elisp-dir "tuareg/"))
 (add-to-list 'load-path tuareg-elisp-dir)
 (load (concat tuareg-elisp-dir "tuareg.el"))
 (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
 (autoload 'camldebug "camldebug" "Run the Caml debugger" t)
 (add-to-list 'auto-mode-alist '("\\.ml$" . tuareg-mode))
+
 ;;
 ;; Load D major mode
 ;;
+
 (setq d-elisp-dir (concat elisp-dir "d-mode/"))
 (add-to-list 'load-path d-elisp-dir)
 (autoload 'd-mode "d-mode" "Major mode for editing D code." t)
 (add-to-list 'auto-mode-alist '("\\.d[i]?\\'" . d-mode))
+
 ;;
 ;; Load Go major mode
 ;;
+
 (setq go-elisp-dir (concat elisp-dir "go/"))
 (add-to-list 'load-path go-elisp-dir)
 (require 'go-mode-load)
+
 ;;
 ;; Load Clojure major mode
 ;;
+
 ;; (setq clojure-elisp-dir (concat elisp-dir "clojure-mode/"))
 ;; (add-to-list 'load-path clojure-elisp-dir)
 ;; (require 'clojure-mode)
+
 ;;
 ;; Load Yacc major mode
 ;;
+
 (setq yacc-elisp-dir (concat elisp-dir "yacc-mode/"))
 (add-to-list 'load-path yacc-elisp-dir)
 (autoload 'yacc-mode "yacc.el")
 (add-to-list 'auto-mode-alist '("\\.y$" . yacc-mode))
+
 ;;
 ;; Load Markdown major mode
 ;;
+
 (setq mardown-elisp-dir (concat elisp-dir "markdown-mode/"))
 (autoload 'markdown-mode "markdown-mode.el")
 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
+
+;;
+;; Load column-marker.el
+;;
+
+(setq column-marker-dir (concat elisp-dir "column-marker/"))
+(add-to-list 'load-path column-marker-dir)
+(require 'column-marker)
+
+;;
+;; Create code functions 
+;; Put this after all coding major modes have been loaded
+
+(defun turn-on-columns ()
+  (interactive)
+  (column-marker-1 70)
+  (column-marker-2 80))
+
+(defun turn-off-erc-modeline-tracking ()
+  (interactive)
+  (set (make-local-variable 'erc-modified-channels-object) nil))
+
+(defun turn-on-line-numbering ()
+  (interactive)
+  (linum-mode 1)
+  (setq linum-format "%d "))
+
+(defun run-code-hooks ()
+  (interactive)
+  (turn-on-columns)
+  (turn-off-erc-modeline-tracking)
+  (turn-on-line-numbering))
+
+(setq coding-major-modes '(elisp-mode c-mode asm-mode python-mode ruby-mode 
+				      haskell-mode literate-haskell-mode 
+				      tuareg-mode markdown-mode d-mode yacc-mode
+				      ld-script-mode R-mode c++-mode forth-mode
+				      fortran-mode go-mode javascript-mode 
+				      latex-mode makefile-mode objc-mode 
+				      octave-mode pascal-mode perl-mode 
+				      scheme-mode html-mode))
+
+(while coding-major-modes
+  (add-hook (intern (concat (symbol-name (car coding-major-modes)) "-hook")) 
+	    'run-code-hooks)
+  (setq coding-major-modes (cdr coding-major-modes)))
+
 ;;
 ;; Load ProofGeneral
 ;;
+
 (setq proof-elisp-dir (concat elisp-dir "ProofGeneral/"))
 (add-to-list 'load-path proof-elisp-dir)
 (load-file (concat proof-elisp-dir "generic/proof-site.el"))
+
 ;;
 ;; Load ESS (Emacs Speaks Statistics)
 ;;
+
 (setq ess-elisp-dir (concat elisp-dir "ess/"))
 (add-to-list 'load-path ess-elisp-dir)
 (load (concat ess-elisp-dir "lisp/ess-site"))
+
 ;;
 ;; Load ELPA (Emacs packaging) with package.el
 ;;
+
 (setq package-elisp-dir (concat elisp-dir "package.el/"))
 (add-to-list 'load-path package-elisp-dir)
 (load "package")
 (package-initialize)
+
 ;;
 ;; Load Emacs Privacy Assistant
 ;;
+
 (require 'epa)
 (epa-file-enable)
+
 ;;
 ;; Load Rinari
 ;;
+
 ;; (setq rinari-elisp-dir (concat elisp-dir "rinari/"))
 ;; (add-to-list 'load-path rinari-elisp-dir)
 ;; (require 'rinari)
+
 ;;
 ;; Load CEDET (Common Emacs Development Environment)
 ;;
+
 (setq cedet-elisp-dir (concat elisp-dir "cedet/"))
 (setq cedet-ede-enabled t)
 (setq cedet-completion-enabled t)
 (when cedet-ede-enabled (global-ede-mode 1))
 (when cedet-completion-enabled (semantic-load-enable-code-helpers))
 (when cedet-template-enabled (global-srecode-minor-mode 1))
+
 ;;
 ;; Load ECB (Emacs Code Browser)
 ;;
+
 (setq ecb-elisp-dir (concat elisp-dir "ecb/"))
 (add-to-list 'load-path ecb-elisp-dir)
 (require 'ecb)
+
 ;;
 ;; Load Auto-Complete
 ;;
+
 (setq autocomplete-elisp-dir (concat elisp-dir "auto-complete/"))
 (add-to-list 'load-path autocomplete-elisp-dir)
 (require 'auto-complete)
 (add-to-list 'ac-dictionary-directories (concat autocomplete-elisp-dir "dict/"))
 (require 'auto-complete-config)
 (ac-config-default)
+
 ;;
 ;; Load nXhtml for webdev
 ;;
+
 ;; (setq nxhtml-elisp-dir (concat elisp-dir "nxhtml/"))
 ;; (load-file (concat nxhtml-elisp-dir "autostart.el"))
+
 ;;
 ;; Load AUCTeX
 ;;
+
 ;; (setq auctex-elisp-dir (concat elisp-dir "auctex/"))
 ;; (load (concat auctex-elisp-dir "auctex.el") nil t t)
 ;; (load (concat auctex-elisp-dir "preview-latex.el") nil t t)
+
 ;;
 ;; Load DVC (Distributed Version Control)
 ;;
+
 ;; (setq dvc-elisp-dir (concat elisp-dir "dvc/"))
 ;; (add-to-list 'load-path (concat dvc-elisp-dir "lisp/"))
 ;; (add-to-list 'Info-default-directory-list (concat dvc-elisp-dir "texinfo/"))
 ;; (require 'dvc-autoloads)
+
 ;;
 ;; Load Flymake
 ;;
+
 ;; (add-hook 'find-file-hook flymake-find-file-hook)
+
 ;;
 ;; Session management
 ;;
+
 (desktop-save-mode t)
 (require 'midnight)
 (savehist-mode 1)
-;;
-;; Enable linum (line numbering) globally, except where we don't want it.
-;;
-(setq linum-disabled-modes-list '(eshell-mode compilation-mode erc-mode apropos-mode Info-mode woman-mode))
-(defun linum-on ()
-  (unless (or (minibufferp)
-	      (member major-mode linum-disabled-modes-list))
-    (linum-mode 1)))
-;;
-;; ERC modeline tracking only in erc-mode buffers
-;;
-(defun set-erc-tracking-if-erc-mode ()
-  (if (not (eq major-mode "erc-mode"))
-      (set (make-local-variable 'erc-modified-channels-object) nil)))
-(add-hook 'after-change-major-mode-hook 'set-erc-tracking-if-erc-mode t)
+
 ;;
 ;; Set ruby program
 ;; 
+
 (setq ruby-program-name "irb --inf-ruby-mode -f")
+
 ;;
 ;; Require final newline
 ;;
+
 (setq require-final-newline t)
+
 ;;
 ;; Start server
 ;;
+
 (server-start)
+
 ;;
 ;; Set variables
 ;;
+
 (custom-set-variables
   ;; custom-set-variables was added by Custom.
   ;; If you edit it by hand, you could mess it up, so be careful.
  '(comment-style (quote plain))
  '(display-time-mode t)
  '(dvc-tips-enabled nil)
- '(ecb-options-version "2.32")
+ '(ecb-compilation-major-modes (quote (compilation-mode slime-mode)))
+ '(ecb-compile-window-height 6)
+ '(ecb-compile-window-width (quote edit-window))
+ '(ecb-options-version "2.40")
  '(ecb-tip-of-the-day nil)
  '(erc-autojoin-channels-alist (quote (("freenode.net" "##crawl" "##freebsd" "#go-nuts" "#python" "#haskell" "#ruby-lang" "#clojure" "#debian" "#lojban" "##linux" "#haskell-blah" "#math" "#ubuntu" "#ubuntu-offtopic" "#emacs"))))
  '(erc-autojoin-mode t)