Created
September 25, 2012 23:12
-
-
Save zwass/3785014 to your computer and use it in GitHub Desktop.
emacs config file as of 2012-09-25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Here are some examples of how to override the defaults for the | |
;; various prelude-emacs settings. To *append* to any of the | |
;; configurations attached to prelude-*-hooks, you can attach a | |
;; function to the appropriate hook: | |
;; disable whitespace-mode and whitespace-cleanup | |
(add-hook 'prelude-prog-mode-hook | |
(lambda () | |
(prelude-turn-off-whitespace) | |
(remove-hook 'before-save-hook 'whitespace-cleanup)) t) | |
;; For other global settings, just run the appropriate function; all | |
;; personal/*.el files will be evaluate after prelude-emacs is loaded. | |
;; disable line highlight | |
;; (global-hl-line-mode -1) | |
;; make the cursor blinking | |
;; (blink-cursor-mode t) | |
;; ***BEGIN MY SECTION*** | |
;;Load path | |
(add-to-list 'load-path "/Users/zwass/.emacs.d/personal/elisp") | |
;; Set email | |
(setq user-mail-address "zwass@seas.upenn.edu") | |
;; Turn off icomplete, use helm instead | |
(icomplete-mode 0) | |
(ido-ubiquitous 1) | |
;;Smex... For better M-x completions | |
(require 'smex) | |
(setq smex-history-length 100) | |
(smex-initialize) | |
(global-set-key (kbd "M-x") 'smex) | |
(global-set-key (kbd "M-X") 'smex-major-mode-commands) | |
;; Time to get rowdy with helm | |
;; Turn on helm autocomplete in eshell | |
;; (add-hook 'eshell-mode-hook | |
;; #'(lambda () | |
;; (define-key eshell-mode-map | |
;; [remap pcomplete] | |
;; 'helm-esh-pcomplete))) | |
;; Use Helm for buffer switching and file finding | |
;;(global-set-key "\C-x b" 'helm-buffers-list) | |
;;(global-set-key "\C-x \C-f" 'helm-find-files) | |
;;Recentf stuff | |
(add-to-list 'recentf-exclude "\\.ido\\.last") | |
(add-to-list 'recentf-exclude "recentf") | |
(global-set-key (kbd "\C-x f") 'prelude-recentf-ido-find-file) | |
;; C-x b recent file finding | |
(setq ido-use-virtual-buffers 1) | |
;; Turn on linum mode | |
(global-linum-mode t) | |
(setq linum-format "%d ") | |
;; for fixing broken fringes issue | |
(fringe-mode 0) | |
;;Doxymacs | |
(require 'doxymacs) | |
(add-hook 'prelude-c-mode-common-hook | |
'(lambda () | |
(doxymacs-mode 1))) | |
;;C mode setup | |
(setq c-basic-offset 2) | |
(add-hook 'prelude-c-mode-common-hook | |
'(lambda () | |
(electric-pair-mode 0) | |
(c-set-style "gnu"))) | |
;; Eldoc in C mode | |
(add-hook 'prelude-c-mode-hook 'c-turn-on-eldoc-mode) | |
;;Command for sending to email (bound to C-c m) | |
(defun mail-current-buffer () | |
"Send the current buffer to email (for Mac)" | |
(interactive) | |
(shell-command (format "open -a Sparrow %s" (buffer-file-name)))) | |
(define-key global-map "\C-cm" 'mail-current-buffer) | |
;;Make lines wrap instead of going over edge | |
(global-visual-line-mode) | |
;;Bind compile | |
(global-set-key "\C-cl" 'compile) | |
;;Multi-hop Tramp connections to Speclab | |
(require 'tramp) | |
(setq tramp-default-method "ssh") | |
(add-to-list 'tramp-default-user-alist | |
'("ssh" ".*\\.speclab\\.seas\\.upenn\\.edu\\'" "zwass")) | |
(add-to-list 'tramp-default-proxies-alist | |
'("\\`speclab\\.seas\\.upenn\\.edu\\'" | |
"\\`zwass\\'" | |
"/ssh:zwass@eniac.seas.upenn.edu:")) | |
; From http://www.emacswiki.org/emacs/ParenthesisMatching#toc4 | |
(defun goto-match-paren (arg) | |
"Go to the matching parenthesis if on parenthesis AND last command is a movement command, otherwise insert %. | |
vi style of % jumping to matching brace." | |
(interactive "p") | |
(if (not (memq last-command '( | |
set-mark | |
cua-set-mark | |
goto-match-paren | |
down-list | |
up-list | |
end-of-defun | |
beginning-of-defun | |
backward-sexp | |
forward-sexp | |
backward-up-list | |
forward-paragraph | |
backward-paragraph | |
end-of-buffer | |
beginning-of-buffer | |
backward-word | |
forward-word | |
mwheel-scroll | |
backward-word | |
forward-word | |
mouse-start-secondary | |
mouse-yank-secondary | |
mouse-secondary-save-then-kill | |
move-end-of-line | |
move-beginning-of-line | |
backward-char | |
forward-char | |
scroll-up | |
scroll-down | |
scroll-left | |
scroll-right | |
mouse-set-point | |
next-buffer | |
previous-buffer | |
previous-line | |
next-line | |
) | |
)) | |
(self-insert-command (or arg 1)) | |
(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)))))) | |
(global-set-key (kbd "%") 'goto-match-paren) | |
;; Newline and indent everywhere | |
(global-set-key (kbd "RET") 'newline-and-indent) | |
;; Reindent on yank | |
;; http://emacswiki.org/emacs/AutoIndentation | |
(dolist (command '(yank yank-pop)) | |
(eval `(defadvice ,command (after indent-region activate) | |
(and (not current-prefix-arg) | |
(member major-mode '(emacs-lisp-mode lisp-mode | |
clojure-mode scheme-mode | |
haskell-mode ruby-mode | |
rspec-mode python-mode | |
c-mode c++-mode | |
objc-mode latex-mode | |
plain-tex-mode java-mode)) | |
(let ((mark-even-if-inactive transient-mark-mode)) | |
(indent-region (region-beginning) (region-end) nil)))))) | |
;; Delete extra whitespace when killing lines | |
(defun kill-and-join-forward (&optional arg) | |
"If at end of line, join with following; otherwise kill line. | |
Deletes whitespace at join." | |
(interactive "P") | |
(if (and (eolp) (not (bolp))) | |
(delete-indentation t) | |
(kill-line arg))) | |
(global-set-key "\C-k" 'kill-and-join-forward) | |
;; Elisp useful stuff | |
;;(add-hook 'prelude-emacs-lisp-mode-hook 'turn-on-eldoc-mode) | |
;;Autocomplete mode | |
;;Supposedly makes nicer autocomplete rendering | |
(require 'pos-tip) | |
(require 'auto-complete-config) | |
(add-to-list 'ac-dictionary-directories "~/.emacs.d/dict") | |
;;(global-auto-complete-mode t) | |
(ac-config-default) | |
;;Needed for compatibility with flyspell | |
(ac-flyspell-workaround) | |
(setq ac-auto-start 3) | |
(setq ac-auto-show-menu t) | |
(setq ac-quick-help-delay .3) | |
(ac-set-trigger-key "TAB") | |
;; Make \C-n and \C-p work in autocompletion menu | |
(setq ac-use-menu-map t) | |
(define-key ac-menu-map "\C-n" 'ac-next) | |
(define-key ac-menu-map "\C-p" 'ac-previous) | |
;;More package archives | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/")) | |
;; Buffer movement by arrow keys | |
;; (require 'buffer-move) | |
;; (global-set-key (kbd "<up>") 'buf-move-up) | |
;; (global-set-key (kbd "<down>") 'buf-move-down) | |
;; (global-set-key (kbd "<left>") 'buf-move-left) | |
;; (global-set-key (kbd "<right>") 'buf-move-right) | |
;;CMake mode | |
(require 'cmake-mode) | |
(setq auto-mode-alist | |
(append '(("CMakeLists\\.txt\\'" . cmake-mode) | |
("\\.cmake\\'" . cmake-mode)) | |
auto-mode-alist)) | |
(setq auto-mode-a) | |
;;Disable flymake GUI warnings (they cause crash) | |
(setq flymake-gui-warnings-enabled nil) | |
;; Scroll to end of window before error | |
(setq scroll-error-top-bottom t) | |
;; Might help TRAMP stability and speed | |
(defadvice vc-svn-registered (around my-vc-svn-registered-tramp activate) | |
"Don't try to use SVN on files accessed via TRAMP." | |
(if (and (fboundp 'tramp-tramp-file-p) | |
(tramp-tramp-file-p (ad-get-arg 0))) | |
nil | |
ad-do-it)) | |
;; Ido-ubiquitous broken in M-x man, disable it | |
(add-to-list 'ido-ubiquitous-command-exceptions 'man) | |
(ido-ubiquitous-disable-in man) | |
;;Email setup | |
(setq user-mail-address "zachwass2000@gmail.com") | |
(setq user-full-name "Zachary Wasserman") | |
(setq smtpmail-smtp-user "zachwass2000") | |
(setq smtpmail-smtp-server "smtp.gmail.com") | |
(setq mail-user-agent 'message-user-agent) | |
(setq message-send-mail-function 'smtpmail-send-it) | |
;;Start the server | |
(server-start) | |
;; fontify code in code blocks | |
(setq org-src-fontify-natively t) | |
;;give me my damn arrow keys! | |
(guru-mode -1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment