My Dot Emacs File

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GENERIC EMACS CONFIGUATION FILE
;; Author: Terence Tong
;; turn on syntax highlighting
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)

;; make text mode the default mode for new buffer
;; turn on auto fill mode automatically in text mode
(setq default-major-mode 'c-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;; parentheses highlighting
(show-paren-mode 1)
(setq blink-matching-paren t)
;; highlight during query
(setq query-replace-highlight t)
;; highlight incremental search
(setq search-highlight t)

;; visual bell
(setq visible-bell t)
;; scroll with less jump
;; (setq scroll-step 1)
;; set this to make scolloing faster
;; (setq lazy-lock-defer-on-scrolling t)

;; line length is 95 chars
(setq fill-column 95)
(setq-default comment-coulumn 95)

;; disable startup message
(setq inhibit-startup-message t)

;; set debugging mode to on
;; (setq debug-on-error t)

;; make things more consistent, yes and y
(fset 'yes-or-no-p 'y-or-n-p)

;; delete should be delete!
(global-set-key [delete] 'delete-char)
;; goto-line meta g
(global-set-key "\M-g" 'goto-line)
;; disable ctrl Z
(global-unset-key "\^z")
;; make help/backspace to delete backward
(global-set-key "\^h" 'backward-delete-char)
;; reload .emacs
(global-set-key "\M-r"
  '(lambda () (interactive) (load-file "~/.emacs")))
;; shortbut for fill-region
(global-set-key "\C-f" 'fill-paragraph)
;; i hate this control x backsapce,
;; delete the whole block
(global-set-key "" 'ignore)
;; disable that minize window thing
(global-unset-key "\C-x\C-z")

;; display line and column
(setq-default line-number-mode t)
(setq-default column-number-mode t)
;; display time
(setq display-time-24hr-format t)
(display-time)

;; define offset
(setq c-basic-offset 2)
;; tab width
;; (setq-default tab-width 2)
;; treat tab as space from now on
(setq indent-tabs-mode nil)

;; turn off scroll bar
;; (scroll-bar-mode nil)

;; don't automatically add new line.
;;  when scroll down at the bottom of a buffer
(setq next-line-add-newlines nil)
;; require final new line
(setq require-final-newline t)
;; keep mouse high-lighted
(setq mouse-sel-retain-highlight t)
;; highlight the stuff you are marking
(setq transient-mark-mode t)
;; access system clipboard
(setq x-select-enable-clipboard t)
;; replace highlighted text with what i type
;; (delete-selection-mode t)


(set-background-color "black")
(set-foreground-color "cyan")
(set-cursor-color "yellow")

(if (string-equal "21" (substring (emacs-version) 10 12))
    (progn
      (blink-cursor-mode 0)
      ;; Turn on image viewing
      (auto-image-file-mode t)
      ;; Turn off tool bar (this bar has icons)
      ;; (Use numeric argument to turn on)
      (tool-bar-mode nil)))


;;;;;;;;;;;;;;;;;;;;;;;;;
;; AUTO INSERT COMMENT
(global-unset-key "\C-t")
(global-set-key "\C-t\C-h" 'insert-function-header)

(defun insert-function-header () (interactive)
  (insert "  /******************************************/\n")
  (insert "  /* \n")
  (insert "   * \n")
  (insert "   * @author: terence\n")
  (insert "   * @param: \n")
  (insert "   * @return: \n")
  (insert "   */\n"))

(global-set-key "\C-t\C-g" 'insert-file-header)

(defun insert-file-header () (interactive)
  (insert "/* -*- Mode: C; c-basic-indent: 2; indent-tabs-mode: nil -*- */ \n")
  (insert "/* $Id: dotemacs.php,v 1.1 2003/05/19 22:50:17 tmtong Exp $ */\n")
  (insert "/* \n")
  (insert " * \n")
  (insert " * Author: Terence Tong\n")
  (insert " * \n")
  (insert " ******************************************/\n"))

;;;;;;;;;;;;;;;;;;;;;;;;;
;; STRIP CONTROL M
(global-set-key "\C-t\C-m" 'no-more-control-m)
(defun no-more-control-m () (interactive) (replace-string "
" ""))

;;;;;;;;;;;;;;;;;;;;;;;;;
;; SHELL MODE
;; strip away those shit
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)
;; send invisble word for password in shell
(add-hook 'comint-output-filter-functions 
'comint-watch-for-password-prompt)
(setq explicit-shell-file-name "bash")
(setq shell-file-name explicit-shell-file-name)
(setq comint-completion-addsuffix t)

;;;;;;;;;;;;;;;;;;;;;;;;;
;; NESC MODE
(setq auto-mode-alist
  (append auto-mode-alist '(("\\.\\(nc\\|td\\|ti\\)\\'" . c-mode))))

;;;;;;;;;;;;;;;;;;;;;;;;;
;; CYGWIN STUFF
;; (require 'cygwin-mount)
;; (cygwin-mount-activate)
          
;;;;;;;;;;;;;;;;;;;;;;;;;
;; HTML MODE
(autoload 'html-helper-mode "html-helper-mode"
  "Yay HTML" t)
(setq auto-mode-alist 
  (append auto-mode-alist '(("\\.\\(html\\|shtml\\|php\\|jsp\\)\\'" . html-helper-mode))))




Written by Terence Tong
Statistics:
Go back to Home