+(setq org-log-done 'note)
+(setq org-agenda-ndays 5)
+
+
+(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
+(add-hook 'message-mode-hook 'turn-on-flyspell)
+(add-hook 'text-mode-hook 'turn-on-flyspell)
+(add-hook 'c-mode-common-hook 'flyspell-prog-mode)
+(add-hook 'cperl-mode-hook 'flyspell-prog-mode)
+(add-hook 'tcl-mode-hook 'flyspell-prog-mode)
+(add-hook 'ess-mode-hook 'flyspell-prog-mode)
+(defun turn-on-flyspell ()
+ "Force flyspell-mode on using a positive arg. For use in hooks."
+ (interactive)
+ (flyspell-mode 1))
+
+;;; outlining support for ess modes
+(add-hook 'ess-mode-hook
+ '(lambda ()
+ (outline-minor-mode)
+ (setq outline-regexp "\\(^#\\{4,5\\} \\)\\|\\(^[a-zA-Z0-9_\.]+ ?<- ?function(.*{\\)")
+ (defun outline-level
+ (lambda () (interactive) (cond ((looking-at "^##### ") 1)((looking-at "^#### ") 2)((looking-at "^[a-zA-Z0-9_\.]+ ?<- ?function(.*{") 3) (t 1000)))
+ )))
+
+(defun my-org-mode-setup ()
+ (when (and (buffer-file-name)
+ (file-exists-p (buffer-file-name)))
+ (load-library "reftex")
+ (and (buffer-file-name)
+ (file-exists-p (buffer-file-name))
+ (reftex-parse-all))
+ (reftex-set-cite-format
+ '((?b . "[[bib::%l]]")
+ (?n . "[[note::%l]]"))))
+ (define-key org-mode-map "\C-c\C-g" 'reftex-citation)
+)
+(add-hook 'org-mode-hook 'my-org-mode-setup)