Please bear with us as we work to restore functionality to dotfiles.org.
; .emacs
;(add-to-list 'load-path "~/.emacs.d/plugins")
(setq inhibit-startup-message t)
(setq inhibit-startup-echo-area-message nil)
(setq-default auto-save-default nil)
(defconst use-backup-dir t)
(setq backup-directory-alist (quote ((".*" . "~/.emacs.d/tmp/")))
version-control t
kept-new-versions 16
kept-old-versions 2
delete-old-versions t
backup-by-copying-when-linked t)
(setq-default visible-bell t)
(setq case-fold-search nil)
(setq scroll-preserve-screen-position t)
(fset 'yes-or-no-p 'y-or-n-p)
(setq transient-mark-mode t)
(show-paren-mode 1)
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
(require 'color-theme)
;(color-theme-initialize)
;(color-theme-black-on-gray)
;(set-background-color "white")
;(set-foreground-color "black")
(set-cursor-color "chartreuse")
;(set-face-foreground 'modeline "black")
;(global-hl-line-mode 1)
;(set-face-background 'highlight "gray90")
(setq global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq font-lock-maximum-size nil)
(setq c-mode-hook 'customize-cc-mode)
(setq c-indent-level 2)
(setq tab-width 4)
(setq indent-tabs-mode nil)
(setq c-basic-offset 2)
(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-state 1)))
(set-default 'fill-column 78)
;(set-default 'truncate-lines t)
(setq skeleton-pair t)
(global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "{") 'skeleton-pair-insert-maybe)
(global-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
;(global-set-key (kbd "'") 'skeleton-pair-insert-maybe)
;(set-default-font "-misc-fixed-medium-r-normal-*-14-*-*-*-*-*-iso10646-1")
;(set-default-font "-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1")
(set-default-font "-b&h-luxi mono-medium-r-normal-*-15-*-*-*-*-*-iso10646-1")
(setq line-number-mode t)
;(require 'linum)
(setq column-number-mode t)
(toggle-scroll-bar -1)
(menu-bar-mode 0)
(tool-bar-mode 0)
(setq display-time-day-and-date t
display-time-24hr-format t)
(display-time)
(which-func-mode t)
;; (setq eol-mnemonic-undecided "(?)"
;; eol-mnemonic-unix "(unix)" ;; LF
;; eol-mnemonic-dos "(dos)" ;; CRLF
;; eol-mnemonic-mac "(mac)") ;;
(setq require-final-newline t)
(when (require 'hippie-expand nil t)
(global-set-key [C-tab] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-file-name-partially
try-expand-file-name
try-complete-list-symbol-partially
try-complete-lisp-symbol
try-expand-whole-kill)))
(defun indent-or-expand (arg)
"Either indent according to mode, or expand the word preceding
point."
(interactive "*P")
(if (and
(or (bobp) (= ?w (char-syntax (char-before))))
(or (eobp) (not (= ?w (char-syntax (char-after))))))
(dabbrev-expand arg)
(indent-according-to-mode)))
(defun my-tab-fix ()
(local-set-key [tab] 'indent-or-expand))
(add-hook 'c-mode-hook 'my-tab-fix)
(add-hook 'sh-mode-hook 'my-tab-fix)
(add-hook 'emacs-lisp-mode-hook 'my-tab-fix)
(require 'cc-mode)
(setq c-default-style "linux")
(setq compilation-window-height 8)
(setq compilation-finish-function
(lambda (buf str)
(if (string-match "exited abnormally" str)
;; errors
(message "compilation errors, press C-x ` to visit")
;; no errors
(run-at-time 0.5 nil 'delete-windows-on buf)
(message "Peanut Butter Jelly Time!"))))
(global-set-key [(f9)] 'compile)
(global-set-key "\C-z" 'goto-line)
;(add-to-list 'load-path "~/.emacs/plugins/ido")
;(require 'ido)
;(ido-mode t)
;(add-to-list 'load-path "~/.emacs.d/plugins/tabbar")
;(require 'tabbar)
;(tabbar-mode)
(add-hook 'shell-mode-hook
'(lambda ()
(local-set-key [up]
'(lambda () (interactive)
(if (comint-after-pmark-p)
(comint-previous-input 1)
(previous-line 1))))
(local-set-key [down]
'(lambda () (interactive)
(if (comint-after-pmark-p)
(forward-line 1))))
))
(defun align-vars-buffer()
"Aligns c/c++ variable declaration names on the same column in this buffer"
(interactive)
(save-excursion)
(let (beg end)
(beginning-of-buffer)
(setq beg (point)
(end-of-buffer)
(setq end(point)
(align-vars beg end)))))
(defun untabify-buffer()
"Untabify the current buffer"
(interactive)
(save-excursion
(untabify (point-min) (point-max))))
(defun count-words-buffer()
"Count the number of words in the current buffer"
(interactive)
(save-excursion
(let ((count 0))
(goto-char (point-min))
(while (< (point) (point-max))
(forward-word 1)
(setq count (1+ count)))
(message "Buffer has %d words" count))))
(defun yic-ignore (str)
(or
;; skip list
(string-match "\\*Buffer List\\*" str)
(string-match "^\\*Messages\\*$" str)
(string-match "^\\*Completions\\*$" str)
(string-match "^\\*scratch\\*$" str)
(string-match "^ " str)
(string-match "output\\*$" str)
(string-match "compilation" str)))
(defun yic-next (ls)
"Switch to next buffer"
(let* ((ptr ls)
bf bn go)
(while (and ptr (null go))
(setq bf(car ptr) bn (buffer-name bf))
(if (null (yic-ignore bn))
(setq go bf)
(setq ptr (cdr ptr))))
(if go
(switch-to-buffer go))))
(defun yic-prev-buffer ()
"Switch to previous buffer"
(interactive)
(yic-next (reverse (buffer-list))))
(defun yic-next-buffer ()
"Switch to other boffer"
(interactive)
(bury-buffer (current-buffer))
(yic-next (buffer-list)))
(defun dos2unix ()
"Convert buffer from dos to unix format"
(interactive)
(goto-char (point-min))
(while (search-forward "\r" nil t) (replace-match "")))
(defun unix2dos ()
"Convert buffer from unix to dos format"
(interactive)
(goto-char (point-min))
(while (search-forward "\n" nil t) (replace-match "\r\n")))
(global-set-key [f1] 'manual-entry)
(global-set-key [f2] 'yic-next-buffer)
(global-set-key [f3] 'yic-prev-buffer)
;(split-window-vertically)
;(shell)
;(term "/bin/bash")
;(other-window 1)