Initial commit.
authorLuke Hoersten <Luke@Hoersten.org>
Thu, 01 Jan 2009 10:51:38 -0600
changeset 0 c25fee3c92e9
child 1 ede059431d20
Initial commit.
emacs.el
hoersten-c-style.el
hoersten-pastebin-region.el
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emacs.el	Thu Jan 01 10:51:38 2009 -0600
@@ -0,0 +1,84 @@
+;; ~/.emacs - Luke Hoersten - v4.0
+
+;; general
+(setq-default load-path (cons "~/.emacs.d" load-path))                ; set default emacs load path
+
+(setq-default ediff-split-window-function 'split-window-horizontally) ; diff horizontally
+(setq-default x-select-enable-clipboard t)                            ; paste from X buffer
+(setq-default inhibit-splash-screen t)                                ; disable splash screen
+(setq-default indicate-empty-lines t)                                 ; show empty lines
+(setq-default show-trailing-whitespace t)                             ; show trailing whitespace
+(put 'set-goal-column 'disabled nil)                                  ; enable goal column setting
+(put 'narrow-to-region 'disabled nil)                                 ; enable hiding
+
+(display-time-mode t)                                                 ; show clock
+(column-number-mode t)                                                ; show column numbers
+(delete-selection-mode t)                                             ; replace highlighted text
+(windmove-default-keybindings)                                        ; move between windows with shift-arrow
+
+(ido-mode t)                                                          ; file/buffer selector
+(setq-default ido-enable-flex-matching t)                             ; fuzzy matching is a must have
+(add-hook 'text-mode-hook 'flyspell-mode t)                           ; spellcheck text
+
+;; coding
+(which-func-mode t)                                                   ; show current function
+(show-paren-mode t)                                                   ; show matching paren
+(global-font-lock-mode t)                                             ; syntax highlighting
+(transient-mark-mode t)                                               ; show highlighting
+(add-hook 'before-save-hook 'whitespace-cleanup)                      ; cleanup whitespace on exit
+(load "hoersten-pastebin-region")                                     ; send selected text to pastebin
+(load "mercurial")                                                    ; load mercurial mode
+(load "ahg")                                                          ; load suplimental mercurial mode
+(load "hoersten-c-style")                                             ; load c specific lisp
+(global-set-key (kbd "C-c c") 'compile)
+
+;; gdb settings
+(setq-default gdb-many-windows t)                                     ; gdb many windows
+(setq-default gdb-use-separate-io-buffer t)                           ; gdb stdio output
+(setq-default gud-tooltip-mode t)                                     ; mouse hover variables
+(global-set-key (kbd "C-c g") 'gdb)                                   ; gdb
+
+;; haskell
+(setq haskell-font-lock-symbols 'unicode)
+
+;; indentation
+(setq-default tab-width 3)
+(setq-default c-basic-offset 3)
+(setq-default indent-tabs-mode t)
+
+;; use only spaces for alignment
+(global-set-key (kbd "C-c a") 'align-with-spaces)  ; align
+(defun align-with-spaces (beg end)
+  "Align selected using only spaces for whitespace."
+  (interactive "r")
+  (let ((indent-tabs-mode nil))
+	 (align beg end)))
+
+;; shell
+(global-set-key (kbd "C-c s") 'shell)              ; start shell
+(ansi-color-for-comint-mode-on)                    ; color in shell buffer
+(setq-default comint-scroll-to-bottom-on-input t)  ; only type on prompt
+(setq-default comint-scroll-show-maximum-output t) ; place text at bottom
+
+;; map file extensions to modes
+(setq-default auto-mode-alist
+				  (append
+					'(("\\.ipp$" . c++-mode)
+					  ("\\.inl$" . c++-mode)
+					  ("SCons"   . python-mode)
+					  ("\\.jj$"  . java-mode))
+					auto-mode-alist))
+
+;; x stuff
+(if (not window-system)
+	 (menu-bar-mode nil)                      ; remove menu bar in no-x mode
+  (tool-bar-mode nil)                        ; remove tool bar
+  (scroll-bar-mode nil)                      ; remove scroll bar
+  (custom-set-faces '(default ((t (:background "#000000" :foreground "#ffffff" :height 100 :family "DejaVu Sans Mono")))))
+  (setq default-frame-alist '((width . 100) (height . 50) (menu-bar-lines . 1)))
+
+  ;; twilight theme
+  (require 'color-theme)
+  (load "color-theme-twilight")
+  (color-theme-twilight)
+  (global-hl-line-mode t))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hoersten-c-style.el	Thu Jan 01 10:51:38 2009 -0600
@@ -0,0 +1,50 @@
+;; ~/.emacs.d/hoersten-c-style.el - Luke Hoersten - v1.0
+
+;; hoersten c++-style
+(c-add-style "hoersten"
+				 '(;; indentation
+					(indent-tabs-mode . t)
+					(tab-width        . 3)
+					(c-basic-offset   . 3)
+
+					;; brace cleanups
+					(c-cleanup-list
+					 brace-else-brace
+					 brace-elseif-brace
+					 brace-catch-brace
+					 empty-defun-braces
+					 defun-close-semi
+					 list-close-comma
+					 scope-operator)
+
+					;; syntactic symbols
+					(c-offsets-alist
+					 (substatement-open . 0)
+					 (inline-open       . 0)
+					 (case-label        . +)
+					 (innamespace       . 0)
+					 (cpp-macro         . -))))
+
+;; c-like language settings (c, c++, java, etc.)
+(setq-default c-hungry-delete-key t)                             ; enable hungry delete
+(setq-default c-default-style "hoersten")                        ; load c-style
+(add-hook 'c-mode-common-hook
+			 (lambda()
+				(c-toggle-auto-newline t)                            ; auto newline
+				(auto-fill-mode t)                                   ; word wrap
+
+				;; custom keys
+				(local-set-key (kbd "C-c f")   'ff-find-other-file)  ; toggle header/source file
+				(local-set-key (kbd "C-c C-c") 'comment-or-uncomment-region)
+
+				;; code folding
+				(local-set-key (kbd "C-c v") 'hs-toggle-hiding)
+				(local-set-key (kbd "<f1>")  'hs-hide-all)
+				(local-set-key (kbd "<f2>")  'hs-show-all)
+				(hs-minor-mode t)                                    ; enable hide-show mode
+				(hs-hide-all)                                        ; hide all blocks by default
+
+				;; highlight todos
+				(font-lock-add-keywords
+				 nil
+				 '(("\\([@]\\(TODO\\|todo\\|warning\\)\\)" 1 font-lock-warning-face t)))))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hoersten-pastebin-region.el	Thu Jan 01 10:51:38 2009 -0600
@@ -0,0 +1,35 @@
+;; ~/.emacs.d/hoersten-pastebin-region.el - Luke Hoersten - v0.6
+
+;; custom keys
+(global-set-key (kbd "C-c w") 'pastebin-region)
+
+;; Based on http://www.emacswiki.org/cgi-bin/wiki/download/pastebin.el
+(defvar pastebin-type-assoc
+  '((emacs-lisp-mode . "common-lisp")
+	 (c-mode          . "c")
+	 (python-mode     . "python")
+	 (nxml-mode       . "xml")
+	 (c++-mode        . "cpp")))
+
+(defun pastebin-region (start end)
+  "Send selected text to dpaste pastebin."
+  (interactive "r")
+  (let* ((pastebin-url "http://build-ch-03/paste/")
+			(url-request-method "POST")
+			(url-request-extra-headers '(("Content-Type" . "application/x-www-form-urlencoded")))
+			(url-request-data
+			 (format "title=%s&content=%s&lexer=%s&author=%s"
+						(url-hexify-string (buffer-file-name)) ;; title
+						(url-hexify-string (buffer-substring-no-properties start end)) ;; content
+						(url-hexify-string (or (assoc-default major-mode pastebin-type-assoc) "text")) ;; lexer
+						(url-hexify-string (user-full-name))))) ;; author
+	 (url-retrieve pastebin-url (lambda (arg)
+											(cond
+											 ((equal :error (car arg))
+											  (signal (cdr arg)))
+											 ((equal :redirect (car arg))
+											  (let ((redirected (cadr arg)))
+												 (message redirected)
+												 (with-temp-buffer
+													(insert redirected)
+													(clipboard-kill-ring-save (point-min) (point-max))))))))))