;;; planner-init.el --- Initialize Planner
;; This file is part of Michael Olson's Emacs settings.
;; The code in this file may be used, distributed, and modified
;; without restriction.
;; I use initsplit.el to separate customize settings on a per-project
;; basis.
;; Add working directories to load path
(add-to-list 'load-path "/home/mwolson/proj/emacs/planner/community")
(add-to-list 'load-path "/home/mwolson/proj/emacs/remember/community" t)
;; I want my own project name
(setq planner-project "Plans")
;; Initialize
(require 'appt)
(require 'planner)
(require 'planner-bbdb)
(require 'planner-deadline)
(require 'planner-diary)
(eval-after-load "erc"
'(progn
(require 'planner-erc)))
(eval-after-load "gnus"
'(progn
(require 'planner-gnus)))
(require 'planner-id)
;(require 'planner-multi)
(require 'planner-notes-index)
(require 'planner-publish)
(require 'remember-planner)
(require 'solar)
;; Define diary-opening function before binding it
(defun my-diary-open ()
"Open the diary file."
(interactive)
(find-file-other-window
(substitute-in-file-name diary-file)))
;; Insinuate planner into various other packages
(planner-calendar-insinuate)
(planner-diary-insinuate)
;; Do these when entering planner mode
(defun my-planner-goto-stuff ()
"My own planner stuff. Prohibit modes we don't want here."
(auto-fill-mode -1)
(flyspell-mode-off))
(add-hook 'planner-mode-hook 'my-planner-goto-stuff)
;; Get sunrise and sunset times as a string
(defun my-planner-get-sunrise-sunset ()
"Retrieve the sunrise and sunset info for the current day."
(save-match-data
(let ((date (planner-page-name)))
(setq date (when (string-match planner-date-regexp date)
(planner-filename-to-calendar-date date)))
(when date
(save-excursion
(when (re-search-forward "^\\* Sunrise and sunset$" nil t)
(forward-line 1)
(let ((beg (point)))
(re-search-forward "^\\* " nil 0)
(forward-line -1)
(delete-region beg (point))
(setq date (solar-sunrise-sunset date))
(insert "\n - Sunrise: " (apply 'solar-time-string (nth 0 date))
"\n - Sunset : " (apply 'solar-time-string (nth 1 date))
"\n - Hours daylight: " (nth 2 date) "\n"))))))))
(add-hook 'planner-goto-hook 'my-planner-get-sunrise-sunset)
;; Cause deadlines to be updated
(add-hook 'planner-goto-hook 'planner-deadline-update)
;; Initialize appt
;; (if (and (not (featurep 'xemacs))
;; (fboundp 'appt-activate))
;; (appt-activate 1)
;; (appt-initialize)
;; (display-time))
;;; Key customizations
;; Use some extra keybindings (that should be default)
(planner-install-extra-context-keybindings)
(planner-install-extra-task-keybindings)
(planner-install-extra-note-keybindings)
;; Don't clobber C-c C-t
(define-key planner-mode-map "\C-c\C-t" #'muse-publish-this-file)
;; The following key bindings are an attempt to make planner stuff
;; globally accessible.
;;(global-set-key "\C-cp" nil)
(global-set-key ; insert A-level task
"\C-cpa" 'planner-create-high-priority-task-from-buffer)
(global-set-key ; insert B-level task
"\C-cpb" 'planner-create-medium-priority-task-from-buffer)
(global-set-key ; insert C-level task
"\C-cpc" 'planner-create-low-priority-task-from-buffer)
(global-set-key "\C-cpd" ; insert diary entry
'calendar)
(global-set-key "\C-cpe" ; change deadline
'planner-deadline-change)
;;(global-set-key "\C-cpn" 'remember) ; insert note
(global-set-key "\C-cpo" ; open diary
'my-diary-open)
(global-set-key "\C-cp\C-s" ; search notes
'planner-search-notes)
;;; Customizations
(custom-set-variables
'(appt-display-format (quote window))
'(calendar-latitude 41.6161)
'(calendar-location-name "Mishawaka, IN")
'(calendar-longitude -86.1361)
'(calendar-time-display-form (quote (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))))
'(diary-display-hook (quote (fancy-diary-display)))
'(diary-file "~/.emacs.d/diary")
'(planner-annotation-functions (quote (planner-gnus-annotation planner-erc-annotation-from-erc planner-bbdb-annotation-from-bbdb planner-annotation-from-info planner-annotation-from-dired)))
'(planner-annotation-strip-directory t)
'(planner-carry-tasks-forward 7)
'(planner-custom-variables (quote ((emacs-wiki-project-server-prefix . "../plans/"))))
'(planner-day-page-template "* Diary
* Sunrise and sunset
* Tasks
* Notes")
'(planner-default-task-priority "B")
'(planner-diary-appts-file "~/.emacs.d/diary")
'(planner-diary-appts-number-of-days 7)
'(planner-diary-cal-desk-file "~/.emacs.d/diary")
'(planner-diary-cal-desk-number-of-days 7)
'(planner-diary-exclude-appts-from-diary t)
'(planner-diary-file "~/.emacs.d/diary")
'(planner-diary-number-of-days 7)
'(planner-diary-private-file "~/.emacs.d/diary")
'(planner-diary-public-file "~/.emacs.d/diary")
'(planner-diary-use-appts nil)
'(planner-diary-use-cal-desk nil)
'(planner-diary-use-diary t)
'(planner-id-tracking-file "~/.emacs.d/.planner-id")
'(planner-id-update-automatically t)
'(planner-plan-page-template "* Tasks
* Notes")
'(planner-publishing-directory "~/proj/notmine/planner-out")
'(planner-tasks-file-behavior (quote (quote close)))
'(planner-use-other-window nil)
'(remember-data-file "~/.emacs.d/notes")
'(remember-filter-functions (quote ((lambda nil (delete-trailing-whitespace)))))
'(remember-handler-functions (quote (remember-planner-append)))
'(remember-mode-hook (quote (muse-list-edit-minor-mode))))
(custom-set-faces
'(planner-cancelled-task-face ((t (:foreground "dim gray" :strike-through t))))
'(planner-completed-task-face ((t (:foreground "dim gray" :strike-through t))))
'(planner-id-face ((((class color) (background light)) (:foreground "slate gray"))))
'(planner-medium-priority-task-face ((t (:foreground "dark green")))))
;;; planner-init.el ends here