2010-09-12 10:12:38 +02:00
|
|
|
(add-to-list 'load-path "~/.emacs.d")
|
|
|
|
|
|
|
|
;; Requires
|
|
|
|
(require 'paren)
|
|
|
|
(require 'uniquify)
|
|
|
|
(require 'autopair)
|
|
|
|
(require 'color-theme)
|
2010-09-23 22:05:17 +02:00
|
|
|
(require 'flymake)
|
2010-10-05 10:45:28 +02:00
|
|
|
(require 'org-install)
|
|
|
|
(require 'zenburn)
|
2010-09-12 10:12:38 +02:00
|
|
|
|
|
|
|
;; Autoloads
|
|
|
|
(autoload 'vala-mode
|
2010-09-23 22:05:17 +02:00
|
|
|
"vala-mode.elc" "A Major mode for editing Vala files" t)
|
2010-09-12 10:12:38 +02:00
|
|
|
(autoload 'csharp-mode
|
2010-09-23 22:05:17 +02:00
|
|
|
"csharp-mode.elc" "A Major mode for editing C# files" t)
|
2010-09-12 10:12:38 +02:00
|
|
|
(autoload 'javascript-mode
|
2010-09-23 22:05:17 +02:00
|
|
|
"javascript.elc" "A Major mode for editing JavaScript files" t)
|
2010-09-12 10:12:38 +02:00
|
|
|
(autoload 'sqlplus-mode
|
2010-09-23 22:05:17 +02:00
|
|
|
"sqlplus,elc" "A Major mode for communicating with Oracle" t)
|
2010-09-12 10:12:38 +02:00
|
|
|
(autoload 'batch-mode
|
2010-09-23 22:05:17 +02:00
|
|
|
"batch-mode.elc" "A Major mode for editing Batch files" t)
|
2010-09-12 10:12:38 +02:00
|
|
|
(autoload 'rainbow-mode
|
2010-09-23 22:05:17 +02:00
|
|
|
"rainbow-mode.elc" "A Minor mode for showing colors inline" t)
|
2010-09-12 10:12:38 +02:00
|
|
|
|
|
|
|
;; Functions
|
|
|
|
(defun what-face (pos)
|
|
|
|
"Find out which face the current position uses"
|
|
|
|
(interactive "d")
|
|
|
|
(let ((face (or (get-char-property (point) 'read-face-name)
|
|
|
|
(get-char-property (point) 'face))))
|
|
|
|
(if face (message "Face: %s" face) (message "No face at %d" pos))))
|
|
|
|
|
|
|
|
(defun my-comp-finish-function (buf str)
|
|
|
|
(if (string-match "exited abnormally" str)
|
|
|
|
;; there were errors
|
|
|
|
(message "compilation errors, press C-x ` to visit")
|
|
|
|
;; no errors, make the compilation window go away in 0.5 seconds
|
|
|
|
(run-at-time 0.5 nil 'delete-windwos-on buf)
|
|
|
|
(message "NO COMPILATION ERRORS!")))
|
|
|
|
|
2010-10-05 10:45:28 +02:00
|
|
|
(defun bh/hide-other ()
|
|
|
|
(interactive)
|
|
|
|
(save-excursion
|
|
|
|
(org-back-to-heading)
|
|
|
|
(org-shifttab)
|
|
|
|
(org-reveal)
|
|
|
|
(org-cycle)))
|
|
|
|
|
|
|
|
(defun bh/go-to-scratch ()
|
|
|
|
(interactive)
|
|
|
|
(switch-to-buffer "*scratch*")
|
|
|
|
(delete-other-windows))
|
|
|
|
|
|
|
|
(defun bh/untabify ()
|
|
|
|
(interactive)
|
|
|
|
(untabify (point-min) (point-max)))
|
|
|
|
|
|
|
|
(defun bh/killframe ()
|
|
|
|
(interactive)
|
|
|
|
(unless (buffer-modified-p)
|
|
|
|
(kill-buffer (current-buffer)))
|
|
|
|
(delete-frame))
|
|
|
|
|
2010-09-12 10:12:38 +02:00
|
|
|
;; Platform specifics
|
2010-10-05 10:45:28 +02:00
|
|
|
(if (eq system-type 'gnu/linux) ; if we're running linux
|
2010-09-23 22:05:17 +02:00
|
|
|
(set-frame-font "-xos4-terminus-medium-*-*-*-14-*-*-*-*-*-*-*"))
|
2010-09-12 10:12:38 +02:00
|
|
|
|
|
|
|
;; Variables
|
|
|
|
(setq
|
2010-10-05 10:45:28 +02:00
|
|
|
inhibit-startup-message t ; don't show welcom screen
|
|
|
|
require-final-newline t ; always append a newline to a file, if
|
|
|
|
; it doesn't have one
|
|
|
|
font-lock-maximum-decoration t ; denotes my interest in maximum possible
|
|
|
|
; fontification
|
|
|
|
uniquify-buffer-name-style 'reverse ; reverse uniquify file names
|
|
|
|
backup-directory-alist `((".*" . ,temporary-file-directory))
|
|
|
|
; backup file location
|
|
|
|
auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
|
|
|
|
; autosave file location
|
|
|
|
(setq org-todo-keywords (quote ((sequence "TODO(t)"
|
|
|
|
"NEXT(n)"
|
|
|
|
"|" "Done(d!/!)")
|
|
|
|
(sequence "WAITING(w@/!)"
|
|
|
|
"SOMEDAY(s!)"
|
|
|
|
"|" "CANCELLED(c@/!)")
|
|
|
|
(sequence "QUOTE(q!)"
|
|
|
|
"QUOTED(Q!)"
|
|
|
|
"|" "APPROVED(A@)"
|
|
|
|
"EXPIRED(E@)"
|
|
|
|
"REJECTED(R@)")
|
|
|
|
(sequence "OPEN(O)"
|
|
|
|
"|" "CLOSED(C)"))))
|
|
|
|
(setq org-todo-keyword-faces
|
|
|
|
(quote (("TODO" :foreground "red" :weight bold)
|
|
|
|
("NEXT" :foreground "blue" :weight bold)
|
|
|
|
("DONE" :foreground "forest green" :weight bold)
|
|
|
|
("WAITING" :foreground "yellow" :weight bold)
|
|
|
|
("SOMEDAY" :foreground "goldenrod" :weight bold)
|
|
|
|
("CANCELLED" :foreground "orangered" :weight bold)
|
|
|
|
("QUOTE" :foreground "hotpink" :weight bold)
|
|
|
|
("QUOTED" :foreground "indianred1" :weight bold)
|
|
|
|
("APPROVED" :foreground "forest green" :weight bold)
|
|
|
|
("EXPIRED" :foreground "olivedrab1" :weight bold)
|
|
|
|
("REJECTED" :foreground "olivedrab" :weight bold)
|
|
|
|
("OPEN" :foreground "magenta" :weight bold)
|
|
|
|
("CLOSED" :foreground "forest green" :weight bold))))
|
|
|
|
(setq org-use-fast-todo-selection t)
|
|
|
|
(setq org-todo-state-tags-triggers
|
|
|
|
(quote (("CANCELLED"
|
|
|
|
("CANCELLED" . t))
|
|
|
|
("WAITING"
|
|
|
|
("WAITING" . t))
|
|
|
|
("SOMEDAY"
|
|
|
|
("WAITING" . t))
|
|
|
|
(done
|
|
|
|
("WAITING"))
|
|
|
|
("TODO"
|
|
|
|
("WAITING")
|
|
|
|
("CANCELLED"))
|
|
|
|
("NEXT"
|
|
|
|
("WAITING"))
|
|
|
|
("DONE"
|
|
|
|
("WAITING")
|
|
|
|
("CANCELED")))))
|
|
|
|
(setq org-default-notes-file "~/prj/org/refile.org")
|
|
|
|
(setq org-capture-templates (quote (("t" "todo" entry (file "~/prj/org/refile.org") "* TODO %?
|
|
|
|
%U
|
|
|
|
%a" :clock-in t :clock-resume t)
|
|
|
|
("n" "note" entry (file "~/prj/org/refile.org") "* %?
|
|
|
|
%U
|
|
|
|
%a
|
|
|
|
:CLOCK:
|
|
|
|
:END:" :clock-in t :clock-resume t))))
|
|
|
|
(setq org-completion-use-ido t) ; Use IDO for target completion
|
|
|
|
(setq org-refile-targets (quote ((org-agenda-files :maxlevel . 5) (nil :maxlevel . 5))))
|
|
|
|
; Targets include this file and any file
|
|
|
|
; and any file contributing to the agenda
|
|
|
|
; - up to 5 levels deep
|
|
|
|
(setq org-refile-use-outline-path (quote file))
|
|
|
|
; Targets start with the file name -
|
|
|
|
; allows creating level 1 tasks
|
|
|
|
(setq org-outline-path-complete-in-steps t)
|
|
|
|
; Targets complete in steps so we start
|
|
|
|
; with filename, TAB shows the next
|
|
|
|
; level of targets etc
|
|
|
|
(setq org-refile-allow-creating-parent-nodes (quote confirm))
|
|
|
|
; Allow refile to create parent tasks
|
|
|
|
; with confirmation
|
|
|
|
(setq org-agenda-custom-commands
|
|
|
|
(quote (("w" "Tasks waiting on something" tags "WAITING/!"
|
|
|
|
((org-use-tag-inheritance nil)
|
|
|
|
(org-agenda-todo-ignore-scheduled nil)
|
|
|
|
(org-agenda-todo-ignore-deadlines nil)
|
|
|
|
(org-agenda-todo-ignore-with-date nil)
|
|
|
|
(org-agenda-overriding-header "Waiting Tasks")))
|
|
|
|
("r" "Refile New Notes and Tasks" tags "LEVEL=1+REFILE"
|
|
|
|
((org-agenda-todo-ignore-with-date nil)
|
|
|
|
(org-agenda-todo-ignore-deadlines nil)
|
|
|
|
(org-agenda-todo-ignore-scheduled nil)
|
|
|
|
(org-agenda-overriding-header "Tasks to Refile")))
|
|
|
|
("N" "Notes" tags "NOTE"
|
|
|
|
((org-agenda-overriding-header "Notes")))
|
|
|
|
("n" "Next" tags-todo "-WAITING-CANCELLED/!NEXT"
|
|
|
|
((org-agenda-overriding-heaer "Next Tasks")))
|
|
|
|
("p" "Projects" tags-todo "LEVEL=2-REFILE|LEVEL=1+REFILE/!-DONE-CANCELLED"
|
|
|
|
(;(org-agenda-skip-function 'bh/skip-non-projects)
|
|
|
|
(org-agenda-overriding-header "Projects")))
|
|
|
|
("o" "other (Non-Project) tasks" tags-todo "LEVEL=2-REFILE|LEVEL=1+REFILE/!-DONE-CANCELLED"
|
|
|
|
(;(org-agenda-skip-function 'bh/skip-projects)
|
|
|
|
(org-agenda-overriding-header "Other Non-Project Tasks")))
|
|
|
|
("A" "Tasks to be Archived" tags "LEVEL=2-REFILE/DONE|CANCELLED"
|
|
|
|
((org-agenda-overriding-header "Tasks to Archive")))
|
|
|
|
("h" "Habits" tags "STYLE=\"habit\""
|
|
|
|
((org-agenda-todo-ignore-with-date nil)
|
|
|
|
(org-agenda-todo-ignore-scheduled nil)
|
|
|
|
(org-agenda-todo-ignore-deadlines nil)
|
|
|
|
(org-agenda-overriding-header "Habits")))
|
|
|
|
("#" "Stuck Projects" tags-todo "LEVEL=2-REFILE|LEVEL=1+REFILE/!-DONE-CANCELLED"
|
|
|
|
((org-agenda-skip-function 'bh/skip-non-stuck-projects)
|
|
|
|
(org-agenda-overriding-header "Stuck Projects")))
|
|
|
|
("c" "Select default clocking task" tags "LEVEL=2-REFILE"
|
|
|
|
((org-agenda-skip-function
|
|
|
|
'(org-agenda-skip-subree-if 'notregexp "^\\*\\* Organization"))
|
|
|
|
(org-agenda-overriding-header "Set default clocking task with C-u C-u I"))))))
|
|
|
|
(setq-default indent-tabs-mode nil) ; spaces, no tabs
|
2010-09-12 10:12:38 +02:00
|
|
|
|
2010-10-05 10:45:28 +02:00
|
|
|
(fset 'yes-or-no-p 'y-or-n-p) ; switch yes or no answers to y or n
|
|
|
|
; answers
|
2010-09-12 10:12:38 +02:00
|
|
|
|
|
|
|
;; Mode settings
|
2010-10-05 10:45:28 +02:00
|
|
|
( tool-bar-mode -1) ; no toolbar
|
|
|
|
( menu-bar-mode -1) ; no menu
|
|
|
|
( line-number-mode -1) ; don't show line numbers in splitter
|
|
|
|
( global-linum-mode t) ; show line numbers in gutter
|
|
|
|
( column-number-mode t) ; show column numbers in splitter
|
|
|
|
(global-font-lock-mode t) ; show syntax highlighting
|
|
|
|
( show-paren-mode t) ; show matching parens
|
|
|
|
( autopair-global-mode) ; enable autopair mode
|
|
|
|
(delete-selection-mode t) ; delete selection upon typing
|
2010-09-12 10:12:38 +02:00
|
|
|
|
|
|
|
;; Keybindings
|
2010-10-05 10:45:28 +02:00
|
|
|
(global-set-key "\C-m" 'newline-and-indent) ; Automatically indent on newline
|
|
|
|
;;; Org Mode
|
|
|
|
(global-set-key "\C-cl" 'org-store-link)
|
|
|
|
(global-set-key "\C-ca" 'org-agenda)
|
|
|
|
(global-set-key "\C-cb" 'org-iswitchb)
|
|
|
|
(global-set-key (kbd "<f12>") 'org-agenda)
|
|
|
|
;(global-set-key (kbd "<f5>") 'bh/org-todo)
|
|
|
|
;(global-set-key (kbd "<S-f5>") 'bh/widen)
|
|
|
|
(global-set-key (kbd "<f7>") 'set-truncate-lines)
|
|
|
|
(global-set-key (kbd "<f8>") 'org-cycle-agenda-files)
|
|
|
|
;(global-set-key (kbd "<f9> b") 'bbdb)
|
|
|
|
(global-set-key (kbd "<f9> c") 'calendar)
|
|
|
|
(global-set-key (kbd "<f9> f") 'boxquote-insert-file)
|
|
|
|
;(global-set-key (kbd "<f9> g") 'gnus)
|
|
|
|
(global-set-key (kbd "<f9> h") 'bh/hide-other)
|
|
|
|
;(global-set-key (kbd "<f9> i") 'bh/org-info)
|
|
|
|
;(global-set-key (kbd "<f9> I") 'bh/clock-in)
|
|
|
|
;(global-set-key (kbd "<f9> O") 'bh/clock-out)
|
|
|
|
(global-set-key (kbd "<f9> r") 'boxquote-region)
|
|
|
|
(global-set-key (kbd "<f9> s") 'bh/go-to-scratch)
|
|
|
|
;(global-set-key (kbd "<f9> t") 'bh/insert-inactive-timestamp)
|
|
|
|
(global-set-key (kbd "<f9> u") 'bh/untabify)
|
|
|
|
(global-set-key (kbd "<f9> v") 'visible-mode)
|
|
|
|
;(global-set-key (kbd "<f9> SPC") 'bh/clock-in-last-task)
|
|
|
|
(global-set-key (kbd "C-<f9>") 'previous-buffer)
|
|
|
|
(global-set-key (kbd "C-x n r") 'narrow-to-region)
|
|
|
|
(global-set-key (kbd "C-<f10>") 'next-buffer)
|
|
|
|
(global-set-key (kbd "<f11>") 'org-clock-goto)
|
|
|
|
(global-set-key (kbd "C-<f11>") 'org-clock-in)
|
|
|
|
(global-set-key (kbd "C-s-<f12>") 'bh/save-then-publish)
|
|
|
|
(global-set-key (kbd "M-<f11>") 'org-resolve-clocks)
|
|
|
|
(global-set-key (kbd "C-M-r") 'org-capture)
|
|
|
|
(global-set-key (kbd "M-<f9>") 'bh/killframe)
|
2010-09-12 10:12:38 +02:00
|
|
|
|
|
|
|
;; File associations
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.vala$" . vala-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.vapi$" . vala-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.bat$" . batch-mode))
|
|
|
|
|
|
|
|
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
|
|
|
|
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
|
|
|
|
|
2010-09-23 22:05:17 +02:00
|
|
|
(add-to-list 'compilation-finish-functions 'my-comp-finish-function)
|
|
|
|
|
2010-09-12 10:12:38 +02:00
|
|
|
;; Color theme
|
2010-10-05 10:45:28 +02:00
|
|
|
;;(require 'color-theme-weirdness)
|
|
|
|
(color-theme-zenburn)
|
2010-09-23 22:05:17 +02:00
|
|
|
|
|
|
|
;; Hooks
|
|
|
|
(add-hook 'find-file-hook 'flymake-find-file-hook)
|
2010-10-05 10:45:28 +02:00
|
|
|
(add-hook 'org-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(flyspell-mode 1)
|
|
|
|
(auto-fill-mode 1)))
|
|
|
|
(add-hook 'css-mode-hook (lambda ()
|
|
|
|
(rainbow-mode)))
|
|
|
|
|
|
|
|
(custom-set-variables
|
|
|
|
;; custom-set-variables was added by Custom.
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
'(org-agenda-files (quote ("~/prj/org/tgn.org" "~/Documents/iACTOR/tasks.org" "~/prj/org/seiko.org" "~/prj/org/projects.org" "~/prj/org/refile.org" "~/prj/org/aethon.org"))))
|
|
|
|
(custom-set-faces
|
|
|
|
;; custom-set-faces was added by Custom.
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
)
|