Emacs personal configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 line
5.2KB

  1. ;;; package --- Org mode configuration
  2. ;;; Commentary:
  3. ;;; see: http://doc.norang.ca/org-mode.html
  4. ;;; Code
  5. (when (< emacs-major-version 24)
  6. (require-package 'org))
  7. (require-package 'org-plus-contrib)
  8. (define-key global-map (kbd "C-c l") 'org-store-link)
  9. (define-key global-map (kbd "C-c a") 'org-agenda)
  10. (define-key global-map (kbd "C-c b") 'org-iswitchb)
  11. ;; Various preferences
  12. (setq org-log-done t
  13. org-completion-use-ido t
  14. org-edit-timestamp-down-means-later t
  15. org-agenda-start-on-weekday nil
  16. org-agenda-span 14
  17. org-agenda-include-diary t
  18. org-agenda-window-setup 'current-window
  19. org-fast-tag-selection-single-key 'expert
  20. org-html-validation-link nil
  21. org-export-kill-product-buffer-when-displayed t
  22. org-tags-column 80)
  23. ;; all files in this directories will contribute to the agenda
  24. (setq org-agenda-files (quote ("~/Documents/org"
  25. "~/org")))
  26. ;;(add-to-list 'org-agenda-custom-commands
  27. ;; '("W" "Weekly review"
  28. ;; agenda ""
  29. ;; ((org-agenda-start-day "-7d")
  30. ;; (org-agenda-span 14)
  31. ;; (org-agenda-start-on-weekday 1))))
  32. ; Refile targets include this file and any file contributing to the agenda - up to 5 levels deep
  33. (setq org-refile-targets (quote ((nil :maxlevel . 5) (org-agenda-files :maxlevel . 5))))
  34. ; Targets start with the file name - allows creating level 1 tasks
  35. (setq org-refile-use-outline-path (quote file))
  36. ; Targets complete in steps so we start with filename, TAB shows the next level of targets etc
  37. (setq org-outline-path-complete-in-steps t)
  38. (setq org-todo-keywords
  39. (quote ((sequence "TODO(t)" "NEXT(n)" "STARTED(s)" "|" "DONE(d!/!)")
  40. (sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)" "MEETING"))))
  41. (setq org-todo-keyword-faces
  42. (quote (("TODO" :foreground "red" :weight bold)
  43. ("NEXT" :foreground "blue" :weight bold)
  44. ("STARTED" :foreground "yellow" :weight bold)
  45. ("DONE" :foreground "forest green" :weight bold)
  46. ("WAITING" :foreground "orange" :weight bold)
  47. ("SOMEDAY" :foreground "magenta" :weight bold)
  48. ("CANCELLED" :foreground "forest green" :weight bold)
  49. ("MEETING" :foreground "forest green" :weight bold))))
  50. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  51. ;; Org clock
  52. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  53. ;; Save the running clock and all clock history when exiting Emacs, load it on startup
  54. (setq org-clock-persistence-insinuate t)
  55. (setq org-clock-persist t)
  56. (setq org-clock-in-resume t)
  57. ;; Change task state to STARTED when clocking in
  58. (setq org-clock-in-switch-to-state "STARTED")
  59. ;; Save clock data and notes in the LOGBOOK drawer
  60. (setq org-clock-into-drawer t)
  61. ;; Removes clocked tasks with 0:00 duration
  62. (setq org-clock-out-remove-zero-time-clocks t)
  63. ;; Show clock sums as hours and minutes, not "n days" etc.
  64. (setq org-time-clocksum-format
  65. '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
  66. ;; Show the clocked-in task - if any - in the header line
  67. (defun sanityinc/show-org-clock-in-header-line ()
  68. (setq-default header-line-format '((" " org-mode-line-string " "))))
  69. (defun sanityinc/hide-org-clock-from-header-line ()
  70. (setq-default header-line-format nil))
  71. (add-hook 'org-clock-in-hook 'sanityinc/show-org-clock-in-header-line)
  72. (add-hook 'org-clock-out-hook 'sanityinc/hide-org-clock-from-header-line)
  73. (add-hook 'org-clock-cancel-hook 'sanityinc/hide-org-clock-from-header-line)
  74. (after-load 'org-clock
  75. (define-key org-clock-mode-line-map [header-line mouse-2] 'org-clock-goto)
  76. (define-key org-clock-mode-line-map [header-line mouse-1] 'org-clock-menu))
  77. (require-package 'org-pomodoro)
  78. (after-load 'org-agenda
  79. (define-key org-agenda-mode-map (kbd "P") 'org-pomodoro))
  80. (after-load 'org
  81. (define-key org-mode-map (kbd "C-M-<up>") 'org-up-element))
  82. (after-load 'org
  83. (org-babel-do-load-languages
  84. 'org-babel-load-languages
  85. '((R . t)
  86. (ditaa . t)
  87. (dot . t)
  88. (emacs-lisp . t)
  89. (gnuplot . t)
  90. (haskell . t)
  91. (latex . t)
  92. (ledger . t)
  93. (ocaml . nil)
  94. (octave . t)
  95. (python . t)
  96. (ruby . t)
  97. (screen . nil)
  98. (shell . t)
  99. (sql . t)
  100. (sqlite . t))))
  101. ;;
  102. ;; http://pragmaticemacs.com/emacs/org-mode-basics-vii-a-todo-list-with-schedules-and-deadlines/
  103. ;; http://pragmaticemacs.com/emacs/master-your-inbox-with-mu4e-and-org-mode/
  104. ;;capture todo items using C-c c t
  105. (define-key global-map (kbd "C-c c") 'org-capture)
  106. (setq org-capture-templates
  107. '(("t" "todo" entry (file+headline "~/Documents/org/main.org" "Tasks")
  108. "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")
  109. ("c" "crypto journal"
  110. entry (file+datetree "~/Documents/criptochuflas/_notes/crypto_journal.org")
  111. "* entry")
  112. ("d" "day time track"
  113. entry (file+datetree "~/Documents/org/time_tracker.org")
  114. "***
  115. **** Work
  116. ***** Keybase and catch up
  117. ***** Meetings:
  118. ***** Meta: check-ins
  119. **** Rest
  120. **** Eat
  121. ***** Lunch
  122. ***** Dinner
  123. **** Kids
  124. ***** Morning
  125. ***** Afternoon
  126. ***** Evening
  127. **** Workout
  128. **** Errands
  129. **** Learn
  130. ")))
  131. (provide 'init-org)
  132. ;;; init-org.el ends here