summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
Diffstat (limited to 'conf')
-rw-r--r--conf/em.el94
-rw-r--r--conf/ev.el56
-rw-r--r--conf/ibuf.el46
-rw-r--r--conf/kb.el7
-rw-r--r--conf/om.el203
-rw-r--r--conf/pkg.el29
-rw-r--r--conf/tex.el44
7 files changed, 479 insertions, 0 deletions
diff --git a/conf/em.el b/conf/em.el
new file mode 100644
index 0000000..300b37a
--- /dev/null
+++ b/conf/em.el
@@ -0,0 +1,94 @@
+;; general emacs settings
+(server-start)
+
+(setq-default fill-column 72)
+(add-hook 'text-mode-hook 'turn-on-auto-fill)
+
+;; to customize font
+(setq default-frame-alist '((font . "Source Code Pro-9")))
+
+(setq browse-url-browser-function 'browse-url-generic
+ browse-url-generic-program "google-chrome")
+;; ess
+(require 'ess-site)
+(add-hook 'ess-mode-hook (lambda ()
+ (setq ess-indent-level 4)))
+
+;(require 'dired+)
+
+;; shell scripts
+(add-hook 'sh-mode-hook (lambda ()
+ (setq sh-basic-offset 4)))
+
+;; set location of custom.el
+(setq custom-file "~/.emacs.d/custom.el")
+(load custom-file)
+
+;; make whitespace-mode use just basic coloring
+;; http://ergoemacs.org/emacs/whitespace-mode.html
+(setq whitespace-style (quote
+ (spaces tabs newline space-mark
+ tab-mark newline-mark)))
+;; y or n
+(defalias 'yes-or-no-p 'y-or-n-p)
+
+;; splash screen
+(setq inhibit-splash-screen t
+ initial-scratch-message nil)
+
+(scroll-bar-mode -1)
+(tool-bar-mode -1)
+(menu-bar-mode -1)
+(blink-cursor-mode -1)
+
+(delete-selection-mode t) ;; write over selected text
+(transient-mark-mode t)
+;; share clipboard with system
+(setq x-select-enable-clipboard t)
+
+(setq-default indicate-empty-lines t)
+(when (not indicate-empty-lines)
+ (toggle-indicate-empty-lines))
+
+
+(setq echo-keystrokes 0.1
+ use-dialog-box nil
+ visible-bell t)
+(show-paren-mode t)
+
+;; store all backup and autosave files in the tmp dir
+(setq backup-directory-alist
+ `((".*" . ,temporary-file-directory)))
+(setq auto-save-file-name-transforms
+ `((".*" ,temporary-file-directory t)))
+
+;; revert buffers automatically when underlying files are changed externally
+(global-auto-revert-mode t)
+
+;; line info
+(line-number-mode t)
+(column-number-mode t)
+(size-indication-mode t)
+
+
+;; ido mode
+(ido-mode t)
+(setq ido-enable-prefix nil
+ ido-enable-flex-matching t
+ ido-create-new-buffer 'always
+ ido-use-filename-at-point 'guess
+ ido-max-prospects 10
+ ido-save-directory-list-file "~/.emacs.d/cache/ido.hist")
+
+;; recent files
+(setq recentf-save-file "~/.emacs.d/cache/recentf"
+ recentf-max-saved-items 200
+ recentf-max-menu-items 15)
+(recentf-mode t)
+; from prelude
+(defun recentf-ido-find-file ()
+ "Find a recent file using ido."
+ (interactive)
+ (let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
+ (when file
+ (find-file file))))
diff --git a/conf/ev.el b/conf/ev.el
new file mode 100644
index 0000000..632cb78
--- /dev/null
+++ b/conf/ev.el
@@ -0,0 +1,56 @@
+;; ev.org - evil mode configuration
+
+;; evil mode uses undo-tree
+(require 'undo-tree)
+
+(require 'evil)
+(evil-mode 1)
+;; much of this it taken from http://permalink.gmane.org/gmane.emacs.vim-emulation/1135
+
+;; red box in emacs mode
+(setq evil-emacs-state-cursor '("red" box))
+
+(define-key evil-motion-state-map "H" 'evil-scroll-up)
+(define-key evil-motion-state-map "L" 'evil-scroll-down)
+
+(defun save-and-kill-buffer ()
+ "Save current buffer and then kill it"
+ (interactive)
+ (save-buffer)
+ (kill-this-buffer)
+)
+
+(defun my-back-one-window ()
+ "Go back one windo"
+ (interactive)
+ (other-window -1))
+
+(define-key evil-normal-state-map ",w" 'save-buffer)
+(define-key evil-normal-state-map "Q" 'fill-paragraph)
+(define-key evil-normal-state-map ",b" 'ido-switch-buffer)
+(define-key evil-normal-state-map ",d" 'save-and-kill-buffer)
+(define-key evil-visual-state-map ",c" 'comment-or-uncomment-region)
+
+(define-key evil-normal-state-map ",j" 'other-window)
+(define-key evil-normal-state-map ",k" 'my-back-one-window)
+(define-key evil-normal-state-map ",q" 'kill-buffer)
+(define-key evil-normal-state-map ",a" 'org-archive-subtree)
+
+(fset 'comment-this-line ;; this depends on evil bindings
+ "0v$,c")
+(define-key evil-normal-state-map ",c" 'comment-this-line)
+
+;; for simult keys
+;; evil mode uses undo-tree
+;; again, adopted from here: http://permalink.gmane.org/gmane.emacs.vim-emulation/1135
+(add-to-list 'load-path "~/.emacs-packages/key-chord")
+(require 'key-chord)
+(key-chord-mode 1)
+
+(key-chord-define-global "jf" 'evil-normal-state)
+(key-chord-define-global ",r" 'recentf-ido-find-file)
+(key-chord-define-global ",t" 'org-capture)
+(key-chord-define-global ",e" 'org-export-as-pdf)
+;; instead of alt-x
+(key-chord-define-global ",x" 'execute-extended-command)
+(key-chord-define-global ",f" 'find-file)
diff --git a/conf/ibuf.el b/conf/ibuf.el
new file mode 100644
index 0000000..da71b8e
--- /dev/null
+++ b/conf/ibuf.el
@@ -0,0 +1,46 @@
+;; ibuf.el
+;; configuration for ibuffer
+;; modified from http://martinowen.net/blog/2010/02/tips-for-emacs-ibuffer.html
+;; and here http://www.elliotglaysher.org/emacs/
+(setq ibuffer-saved-filter-groups
+ '(("home"
+ ("emacs-config" (or (filename . ".emacs.d")
+ (filename . ".el")))
+ ("org" (or (mode . org-mode)
+ (name . "^\\*Org Agenda")
+ (name . "^\\*Calendar\\*$")))
+ ("web" (or (mode . html-mode)
+ (mode . nxml-mode)
+ (mode . css-mode)))
+ ("r" (or (mode . ess-mode)
+ (name . "^\\*R\\*$")))
+ ("markup" (or (mode . markdown-mode)
+ (mode . rst-mode)))
+ ("lua" (name . ".lua$"))
+ ("perl" (name . ".pl$"))
+ ("python" (name . ".py$"))
+ ("git" (name . "\*git"))
+ ("text" (name . ".txt"))
+ ("shell" (name . ".sh$"))
+ ("latex" (or (mode . latex-mode)
+ (mode . LaTeX-mode)
+ (mode . bibtex-mode)
+ (mode . reftex-mode)))
+ ("dirs" (or (mode . dired-mode)
+ (name . "^\\*tramp")))
+ ("terminal" (name . "^\\*ansi-term\\*$"))
+ ("help" (or (name . "\*Help\*")
+ (name . "\*Apropos\*")
+ (name . "\*info\*")
+ (name . "^\\*Completions\\*$"))))))
+
+ (add-hook 'ibuffer-mode-hook
+ '(lambda ()
+ (ibuffer-auto-mode 1) ; keep buffer list up-to-date
+ (ibuffer-switch-to-saved-filter-groups "home")))
+
+ ;; do not prompt to delete unmodified buffers
+ (setq ibuffer-expert t)
+
+ ;; don't show empty filter groups
+ (setq ibuffer-show-empty-filter-groups nil)
diff --git a/conf/kb.el b/conf/kb.el
new file mode 100644
index 0000000..2ceb33e
--- /dev/null
+++ b/conf/kb.el
@@ -0,0 +1,7 @@
+;; kb.el - key bindings
+;; evil-specific ones are in evil.el
+
+(global-set-key (kbd "C-x \\") 'align-regexp)
+
+;; replace buffer-menu with ibuffer
+(global-set-key (kbd "C-x C-b") 'ibuffer)
diff --git a/conf/om.el b/conf/om.el
new file mode 100644
index 0000000..00cdf04
--- /dev/null
+++ b/conf/om.el
@@ -0,0 +1,203 @@
+;;; om.el - org mode config
+;; created 24 Nov 2011
+
+;;;; org-mode
+(setq org-log-done t)
+(setq org-todo-keywords
+ '((sequence "TODO" "STARTED" "|" "DONE" "NA")))
+
+;(setq org-agenda-files (list "~/notes/tasks.org"))
+
+;; next 6 lines merged from prelude-org
+(global-set-key "\C-cl" 'org-store-link)
+(global-set-key "\C-ca" 'org-agenda)
+(global-set-key "\C-cb" 'org-iswitchb)
+(setq org-log-done t)
+(defun prelude-org-mode-defaults ()
+ (electric-indent-mode -1))
+
+;; allow for file to end in txt
+(add-to-list 'auto-mode-alist '("\\.org.txt$" . org-mode))
+
+;; set up capture
+;(setq org-default-notes-file (expand-file-name "~/notes/tasks.org"))
+(setq org-capture-templates
+ '(("c" "cal" entry (file+headline "~/notes/calendar.org" "misc")
+ "* %?")
+ ("t" "Todo" entry (file+headline "~/notes/tasks.org" "To file")
+ "* TODO %?")
+ ("m" "mail todo" entry (file+headline "~/notes/tasks.org" "mail")
+ "* TODO %?\nSource: %u, %c\n%i")
+ ("d" "mail date" entry (file+headline "~/notes/calendar.org" "mail")
+ "* %?\nSource: %u, %c\n%i")))
+
+;; for mutt capture
+(require 'org-protocol)
+;; ensure that emacsclient will show just the note to be edited when invoked
+;; from Mutt, and that it will shut down emacsclient once finished;
+;; fallback to legacy behavior when not invoked via org-protocol.
+(add-hook 'org-capture-mode-hook 'delete-other-windows)
+(setq my-org-protocol-flag nil)
+(defadvice org-capture-finalize (after delete-frame-at-end activate)
+ "Delete frame at capture finalization"
+ (progn (if my-org-protocol-flag (delete-frame))
+ (setq my-org-protocol-flag nil)))
+(defadvice org-capture-kill (after delete-frame-at-end activate)
+ "Delete frame at capture abort"
+ (progn (if my-org-protocol-flag (delete-frame))
+ (setq my-org-protocol-flag nil)))
+(defadvice org-protocol-capture (before set-org-protocol-flag activate)
+ (setq my-org-protocol-flag t))
+
+(custom-set-variables
+ '(org-agenda-files (quote ("~/notes/calendar.org" "~/notes/tasks.org")))
+ '(org-default-notes-file "~/notes/tasks.org")
+ '(org-agenda-ndays 7)
+; '(org-deadline-warning-days 14)
+ '(org-agenda-show-all-dates t)
+ '(org-agenda-skip-deadline-if-done t)
+ '(org-agenda-skip-scheduled-if-done t)
+ '(org-agenda-start-on-weekday nil)
+ '(org-reverse-note-order t)
+ '(org-fast-tag-selection-single-key (quote expert))
+ '(org-agenda-custom-commands
+ (quote (("d" todo "DONE" nil)
+ ("s" todo "STARTED" nil)
+ ("A" agenda ""
+ ((org-agenda-skip-function
+ (lambda nil
+ (org-agenda-skip-entry-if (quote notregexp) "\\=.*\\[#A\\]")))
+ (org-agenda-ndays 1)
+ (org-agenda-overriding-header "Today's Priority #A tasks: ")))
+ ("u" alltodo ""
+ ((org-agenda-skip-function
+ (lambda nil
+ (org-agenda-skip-entry-if (quote scheduled) (quote deadline)
+ (quote regexp) "\n]+>")))
+ (org-agenda-overriding-header "Unscheduled TODO entries: ")))))))
+
+;; other customization in prelude's org module
+
+;; have font colors in code blocks
+(setq org-src-fontify-natively t)
+
+;; from http://doc.norang.ca/org-mode.html
+;; this should prevent blank lines from being inserted
+;; before headers
+(setq org-blank-before-new-entry (quote ((heading)
+ (plain-list-item . auto))))
+(setq org-cycle-separator-lines 1)
+
+;; for evil setup
+;; put here because wasn't loading when in evil config file
+(eval-after-load "org"
+ '(progn
+ (defun always-insert-item ()
+ (interactive)
+ (if (not (org-in-item-p))
+ (insert "\n- ")
+ (org-insert-item)))
+
+ (evil-define-key 'normal org-mode-map "O" (lambda ()
+ (interactive)
+ (end-of-line)
+ (org-insert-heading t)
+ (evil-append nil)
+ ))
+
+ (evil-define-key 'normal org-mode-map "o" (lambda ()
+ (interactive)
+ (end-of-line)
+ (always-insert-item)
+ (evil-append nil)
+ ))
+ ; mark a TODO item as DONE
+ ; s - status
+ (evil-define-key 'normal org-mode-map ",s" 'org-todo)
+ ;change bullet style
+ (evil-define-key 'normal org-mode-map "-" 'org-cycle-list-bullet)
+ ;; (evil-define-key 'normal org-mode-map "L" 'org-shiftright)
+ ;; (evil-define-key 'normal org-mode-map "H" 'org-shiftleft)
+ ;; (evil-define-key 'normal org-mode-map "K" 'org-shiftup)
+ ;; (evil-define-key 'normal org-mode-map "J" 'org-shiftdown)
+ (evil-define-key 'normal org-mode-map (kbd "M-l") 'org-metaright)
+ (evil-define-key 'normal org-mode-map (kbd "M-h") 'org-metaleft)
+ (evil-define-key 'normal org-mode-map (kbd "M-k") 'org-metaup)
+ (evil-define-key 'normal org-mode-map (kbd "M-j") 'org-metadown)
+ (evil-define-key 'normal org-mode-map (kbd "M-L") 'org-shiftmetaright)
+ (evil-define-key 'normal org-mode-map (kbd "M-H") 'org-shiftmetaleft)
+ (evil-define-key 'normal org-mode-map (kbd "M-K") 'org-shiftmetaup)
+ (evil-define-key 'normal org-mode-map (kbd "M-J") 'org-shiftmetadown)
+
+;; ;;; org agenda -- leave in emacs mode but add j & k
+;; (define-key org-agenda-mode-map "j" 'evil-next-line)
+;; (define-key org-agenda-mode-map "k" 'evil-previous-line))
+ ))
+
+; from http://doc.norang.ca/org-mode.html
+(setq org-refile-targets (quote ((nil :maxlevel . 5)
+ (org-agenda-files :maxlevel . 5))))
+
+; Stop using paths for refile targets - we file directly with IDO
+(setq org-refile-use-outline-path nil)
+
+; Targets complete directly with IDO
+(setq org-outline-path-complete-in-steps nil)
+
+; Allow refile to create parent tasks with confirmation
+(setq org-refile-allow-creating-parent-nodes (quote confirm))
+
+; Use IDO for both buffer and file completion and ido-everywhere to t
+(setq org-completion-use-ido t)
+(setq ido-everywhere t)
+(setq ido-max-directory-size 100000)
+(ido-mode (quote both))
+
+;;;; Refile settings
+; Exclude DONE state tasks from refile targets
+(defun bh/verify-refile-target ()
+ "Exclude todo keywords with a done state from refile targets"
+ (not (member (nth 2 (org-heading-components)) org-done-keywords)))
+
+(setq org-refile-target-verify-function 'bh/verify-refile-target)
+
+;; set up babel languages
+(org-babel-do-load-languages
+ 'org-babel-load-languages
+ '( (perl . t)
+ (sh . t)
+ (python . t)
+ (R . t)
+ (emacs-lisp . t)
+ (latex . t)
+ (ditaa . t)
+ ))
+;; don't ask for confirmation before running code
+(setq org-confirm-babel-evaluate nil)
+
+;; babel minted latex export
+;; modified from
+;; http://orgmode.org/worg/org-tutorials/org-latex-export.html
+(setq org-export-latex-listings 'minted)
+(setq org-export-latex-custom-lang-environments
+ '(
+ (R "rcode")
+ (sh "shcode")
+ (python "pythoncode")
+ ))
+;; (setq org-export-latex-custom-lang-environments
+;; '(
+;; (emacs-lisp "common-lispcode")
+;; ))
+;; (setq org-export-latex-minted-options
+;; '(("frame" "lines")
+;; ("fontsize" "\\scriptsize")
+;; ("linenos" "")))
+(setq org-latex-to-pdf-process
+ '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
+ "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
+ "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
+
+;; ditaa giving error
+;; could not find elpa/contrib/scripts/ditaa.jar
+(setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar")
diff --git a/conf/pkg.el b/conf/pkg.el
new file mode 100644
index 0000000..9813a1b
--- /dev/null
+++ b/conf/pkg.el
@@ -0,0 +1,29 @@
+;; pkg.el
+;; http://www.aaronbedra.com/emacs.d/
+
+(require 'package)
+(add-to-list 'package-archives
+ '("melpa" . "http://melpa.milkbox.net/packages/") t)
+(package-initialize)
+
+(require 'cl)
+(defvar kyle-packages '(
+ evil
+ undo-tree
+ org
+ ess
+ )
+ "Default packages")
+
+(defun kyle-packages-installed-p ()
+ (loop for pkg in kyle-packages
+ when (not (package-installed-p pkg)) do (return nil)
+ finally (return t)))
+
+(unless (kyle-packages-installed-p)
+ (message "%s" "Refreshing package database...")
+ (package-refresh-contents)
+ (dolist (pkg kyle-packages)
+ (when (not (package-installed-p pkg))
+ (message "installing %s" pkg)
+ (package-install pkg))))
diff --git a/conf/tex.el b/conf/tex.el
new file mode 100644
index 0000000..ed35fba
--- /dev/null
+++ b/conf/tex.el
@@ -0,0 +1,44 @@
+;; tex.el
+
+;;; add path for pdflatex
+(getenv "PATH")
+(setenv "PATH"
+ (concat
+ "/usr/texbin" ":"
+ (getenv "PATH")))
+
+;; for viewing in-frame
+;;http://www.sigmafield.org/2009/10/03/using-doc-view-with-auto-revert-to-view-latex-pdf-output-in-emacs/
+;(setq TeX-PDF-mode t)
+;(add-hook 'doc-view-mode-hook 'auto-revert-mode)
+
+;; reftex
+;; mostly from http://www.kieranhealy.org/esk/starter-kit-latex.html
+;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
+;; (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
+;; (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
+;; (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
+;; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
+;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
+;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
+
+;; ;; Make RefTeX faster
+;; (setq reftex-enable-partial-scans t)
+;; (setq reftex-save-parse-info t)
+;; (setq reftex-use-multiple-selection-buffers t)
+
+;; commented out the rest of it because something was causing it to
+;; prompt for master file in org mode
+(defun org-mode-reftex-setup ()
+ (load-library "reftex")
+ ;; (and (buffer-file-name)
+ ;; (file-exists-p (buffer-file-name))
+ ;; (reftex-parse-all))
+ (define-key org-mode-map (kbd "C-c [") 'reftex-citation)
+ )
+
+(add-hook 'org-mode-hook 'org-mode-reftex-setup)
+
+(setq reftex-default-bibliography
+ (quote
+ ("~/refs/refs.bib")))