"REDACTED" indicates a personal detail i don't want to divulge
(defun run-at-home ()
(interactive)
(string-match "192" (shell-command-to-string
"/sbin/ifconfig -a|awk '/inet /'")))
;; -------------------------------------------------------------
;; global setup
(setq-default indent-tabs-mode nil)
(setq-default make-backup-files nil)
(setq-default column-number-mode t)
(setq-default ecb-options-version "2.32")
(setq-default ecb-wget-setup (quote cons))
(setq-default tramp-default-user "brad")
(setq-default tramp-default-host "localhost")
(setq-default mumamo-chunk-coloring (quote no-chunks-colored))
(setq-default nxhtml-skip-welcome t)
(setq-default org-agenda-files (quote ("~/Org/todo.org")))
(setq-default org-agenda-ndays 7)
(setq-default org-agenda-show-all-dates t)
(setq-default org-agenda-skip-deadline-if-done t)
(setq-default org-agenda-skip-scheduled-if-done t)
(setq-default org-agenda-start-on-weekday nil)
(setq-default org-deadline-warning-days 14)
(setq-default org-default-notes-file "~/Org/notes.org")
(setq-default org-reverse-note-order t)
(setq-default pgg-default-user-id "brad clawsie REDACTED")
(setq-default pgg-query-keyserver nil)
(setq confirm-nonexistent-file-or-buffer nil)
(setq inhibit-splash-screen t)
(setq display-time-24hr-format t)
(setq debug-on-error t)
(setq next-line-add-newlines nil)
(setq scroll-step 1)
(set-input-mode nil nil t)
(global-set-key "\C-l" `goto-line)
(global-set-key "\C-h" `delete-backward-char)
(global-set-key (kbd "C-x a") 'beginning-of-line)
(global-set-key [mouse-2] 'yank)
(global-font-lock-mode 1)
(mouse-wheel-mode t)
(set-foreground-color "white")
(set-background-color "black")
(display-time)
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'blink-cursor-mode) (blink-cursor-mode 0))
(setq-default transient-mark-mode t)
(standard-display-ascii ?\221 [?\'])
(standard-display-ascii ?\223 [?\"])
(standard-display-ascii ?\224 [?\"])
(standard-display-ascii ?\225 [?+])
(standard-display-ascii ?\227 [?-])
(standard-display-ascii ?\222 [?'])
(standard-display-ascii ?\205 [?.?.?.])
;; -------------------------------------------------------------
;; http://www.emacswiki.org/emacs/SlickCopy
(defadvice kill-ring-save (before slick-copy activate compile)
"When called interactively with no active region, copy a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(message "Copied line")
(list (line-beginning-position)
(line-beginning-position 2)))))
(defadvice kill-region (before slick-cut activate compile)
"When called interactively with no active region, kill a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
;; -------------------------------------------------------------
;; various external modes
;; magit
(load "~/.el/vcs/magit.elc")
;; ido
(require 'ido)
(ido-mode t)
;; w3m
(add-to-list 'load-path "~/.el/net/w3m")
(require 'w3m-load)
;; recursive find
(load "~/.el/util/find-recursive.el")
;; anything!
(add-to-list 'load-path "~/.el/util")
(require 'anything)
(require 'anything-config)
;; bbdb
(add-to-list 'load-path "~/.el/util/bbdb")
(require 'bbdb)
(bbdb-initialize)
;; info
(require 'info)
(require 'epa)
(epa-file-enable)
(setq epg-gpg-program "gpg")
;; -------------------------------------------------------------
;; modes for special tasks
;; wrap mode for text files
(autoload 'wrap-mode "~/.el/text/wrap-mode.el" "Toggle wrapping." t)
(setq auto-mode-alist (append '(("\\.txt$" . wrap-mode)) auto-mode-alist))
(global-set-key (kbd "C-x C-j") `wrap-mode)
;; -------------------------------------------------------------
;; date/time funcs
(defun insert-time ()
(interactive)
(insert (format-time-string "%Y-%m-%d-%R")))
(defun insert-date ()
(interactive)
(insert (format-time-string "%Y-%m-%d")))
;; change email addresses from work to home
(defun cfm ()
(interactive)
(goto-char (point-min))
(while (search-forward "REDACTED" nil t)
(replace-match "REDACTED")))
;; change email addresses from home to work
(defun bsc ()
(interactive)
(goto-char (point-min))
(while (search-forward "REDACTED" nil t)
(replace-match "REDACTED")))
;; dos2unix
(defun dos2unix ()
(interactive)
(goto-char (point-min))
(while (search-forward "\r" nil t)
(replace-match "")))
;; dictionary lookup
(defun lookup ()
(interactive)
(setq lookup-term (read-string "term: "))
(shell-command (concat "dict -h dict.org \"" lookup-term "\"")))
;; -------------------------------------------------------------
;; macros
(fset 'switchbuffers
[?\C-x ?b])
(global-set-key (kbd "C-c b") 'switchbuffers)
(fset 'checkin-vcs
[?\C-x ?v ?v])
(global-set-key (kbd "C-c v") 'checkin-vcs)
;; -------------------------------------------------------------
;; diary
(setq view-diary-entries-initially t
mark-diary-entries-in-calendar t
diary-file "~/diary"
number-of-diary-entries 7)
(add-hook 'diary-display-hook 'fancy-diary-display)
(add-hook 'today-visible-calendar-hook 'calendar-mark-today)
(add-hook 'list-diary-entries-hook 'sort-diary-entries t)
(add-hook 'fancy-diary-display-mode-hook
'(lambda ()
(alt-clean-equal-signs)))
(defun alt-clean-equal-signs ()
"This function makes lines of = signs invisible."
(goto-char (point-min))
(let ((state buffer-read-only))
(when state (setq buffer-read-only nil))
(while (not (eobp))
(search-forward-regexp "^=+$" nil 'move)
(add-text-properties (match-beginning 0)
(match-end 0)
'(invisible t)))
(when state (setq buffer-read-only t))))
;; -------------------------------------------------------------
;; eshell funcs
(load "~/.el/util/esh-proc.el")
(setq eshell-prompt-function
(lambda ()
(if (= (user-uid) 0) " # " " $ ")))
(eval-after-load "em-term"
'(add-to-list 'eshell-visual-commands "git-log"))
(eval-after-load "em-term"
'(add-to-list 'eshell-visual-commands "tig"))
(eval-after-load "em-term"
'(add-to-list 'eshell-visual-commands "perldoc"))
;; -------------------------------------------------------------
;; erc
(defun yim ()
(interactive)
(erc :server "irc.net" :port "6667" :nick "REDACTED"))
(defun fn ()
(interactive)
(erc :server "irc.freenode.net" :port "6667" :nick "REDACTED"))
(defun smuggersirc ()
(interactive)
(erc :server "REDACTED" :port "6667" :nick "REDACTED"))
(add-hook 'erc-after-connect
'(lambda (SERVER NICK)
(cond
((string-match "freenode\\.net" SERVER)
(erc-message "PRIVMSG" "NickServ identify REDACTED"))
((string-match "irc\\.net" SERVER)
(erc-message "PRIVMSG" "NickServ identify REDACTED")))))
;; -------------------------------------------------------------
;; programming language modes
;; haskell editing
(load "~/.el/lang/haskell-mode/haskell-site-file.el")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
;; scheme
(setq scheme-program-name "mzscheme")
(load "~/.el/lang/quack.el")
;; clojure
(load "~/.el/lang/clojure-mode.el")
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
;; perl
(defalias 'perl-mode 'cperl-mode)
(autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(defun my-perl-setup ()
(setq c-basic-offset 2)
(setq indent-tabs-mode nil))
(add-hook 'perl-mode-hook 'my-perl-setup)
;; php
(load "~/.el/lang/php-mode.el")
(defun my-php-mode-hook ()
(c-set-offset 'substatement-open 0)
(c-set-offset 'statement-case-open 0)
(c-set-offset 'case-label '+)
(setq tab-width 4)
(setq c-basic-offset 4)
(setq c-auto-newline nil)
(setq indent-tabs-mode nil)
t)
(add-hook 'php-mode-hook 'my-php-mode-hook)
;; smugmug extensions
(setq auto-mode-alist (append '(("/*.\.php\\w?" . php-mode)
("/*.\js.mgi$" . espresso-mode)
("/*.\css.mgi$" . css-mode)
("/*.\.mg$" . php-mode)
("/*.\.mgi$" . php-mode))
auto-mode-alist))
;; js mode
(load "~/.el/lang/espresso.el")
(add-to-list 'auto-mode-alist '("\\.js$" . espresso-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . espresso-mode))
;; java
(defun my-java-mode-hook ()
"Hook for running Java file..."
;;don't indent braces
(c-set-offset 'substatement-open 0)
(c-set-offset 'statement-case-open 0)
(c-set-offset 'case-label '+)
(setq tab-width 2)
(setq c-basic-offset 2)
(setq c-auto-newline nil)
(setq indent-tabs-mode nil)
t)
(add-hook 'java-mode-hook 'my-java-mode-hook)
;; -------------------------------------------------------------
;; server
(server-start)
last update 2009-12-26