planner.el 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ;;; ------
  2. ;;; Planner
  3. ;;; ------
  4. (require 'planner)
  5. (define-key mode-specific-map [?n] 'planner-goto-today)
  6. (global-set-key (kbd "<f9> t") 'planner-create-task)
  7. (global-set-key (kbd "<f9> n") 'planner-create-note)
  8. (setq mark-diary-entries-in-calendar t)
  9. (setq planner-project "WikiPlanner")
  10. (setq planner-day-page-template
  11. "* Tasks\n\n\n* Schedule\n\n\n* Diet\n(See [[Recipes]] and [[Exercises]])\nWeigh-in: \n\n* Notes\n\n")
  12. (require 'planner-diary)
  13. (planner-diary-insinuate)
  14. (add-hook 'diary-display-hook 'fancy-diary-display)
  15. ;(require 'planner-timeclock)
  16. ;(require 'planner-deadline)
  17. ;(require 'planner-schedule)
  18. (require 'planner-cyclic)
  19. ;; Notes from Sacha
  20. ;;;;;;;;;;;;;;;;;;;
  21. ;; I've bound sacha/planner-what-am-i-supposed-to-be-doing to F9 F9. I
  22. ;; start out by clocking into the task (use planner-timeclock.el and
  23. ;; C-c TAB to mark a task as in progress). Then, when I find myself
  24. ;; getting distracted, I hit F9 F9 to see my current task in the
  25. ;; minibuffer. C-u F9 F9 jumps back to the task so that I can either
  26. ;; mark it as postponed. M-x planner-task-pending (bound to C-c C-p in
  27. ;; my local config) and M-x planner-task-done (C-c C-x) both clock out
  28. ;; of the task. If I want to jump back to the previous window
  29. ;; configuration from that planner page, I can just hit F9 F9 again.
  30. (defvar sacha/window-register "w"
  31. "Register for jumping back and forth between planner and wherever I am.")
  32. (defvar sacha/planner-current-task nil
  33. "Current task info.")
  34. (defadvice planner-task-in-progress (after sacha activate)
  35. "Keep track of the task info."
  36. (setq sacha/planner-current-task (planner-current-task-info)))
  37. (defun sacha/planner-what-am-i-supposed-to-be-doing (&optional prefix)
  38. "Make it easy to keep track of what I'm supposed to be working on.
  39. If PREFIX is non-nil, jump to the current task, else display it
  40. in a message. If called from the plan page, jump back to whatever
  41. I was looking at."
  42. (interactive "P")
  43. (if planner-timeclock-current-task
  44. (if (string= (planner-task-page sacha/planner-current-task)
  45. (planner-page-name))
  46. (jump-to-register sacha/window-register)
  47. (if (null prefix)
  48. (message "%s" planner-timeclock-current-task)
  49. (frame-configuration-to-register sacha/window-register)
  50. (planner-find-file (planner-task-page sacha/planner-current-task))
  51. (planner-find-task sacha/planner-current-task)))
  52. (if prefix
  53. (planner-goto-today)
  54. (message "No current task. HEY!"))))
  55. (global-set-key (kbd "<f9> <f9>") 'sacha/planner-what-am-i-supposed-to-be-doing)
  56. (defadvice planner-create-task-from-buffer (before cwebber activate)
  57. "Change the priority if specified.
  58. You can set the priority of a task during creation by starting the
  59. task description with #A, #B, or #C. This changes the default task
  60. status."
  61. (when (string-match "^#\\([ABC]\\)[ \t]" title)
  62. (setq planner-default-task-priority (match-string 1 title))
  63. (setq title (substring title (match-end 0)))))