;;; package --- Org mode configuration ;;; Commentary: ;;; see: http://doc.norang.ca/org-mode.html ;;; Code (when (< emacs-major-version 24) (require-package 'org)) (require-package 'org-plus-contrib) (define-key global-map (kbd "C-c l") 'org-store-link) (define-key global-map (kbd "C-c a") 'org-agenda) (define-key global-map (kbd "C-c b") 'org-iswitchb) ;; Various preferences (setq org-log-done t org-completion-use-ido t org-edit-timestamp-down-means-later t org-agenda-start-on-weekday nil org-agenda-span 14 org-agenda-include-diary t org-agenda-window-setup 'current-window org-fast-tag-selection-single-key 'expert org-html-validation-link nil org-export-kill-product-buffer-when-displayed t org-tags-column 80) ;; all files in this directories will contribute to the agenda (setq org-agenda-files (quote ("~/Documents/org" "~/org"))) ;;(add-to-list 'org-agenda-custom-commands ;; '("W" "Weekly review" ;; agenda "" ;; ((org-agenda-start-day "-7d") ;; (org-agenda-span 14) ;; (org-agenda-start-on-weekday 1)))) ; Refile targets include this file and any file contributing to the agenda - up to 5 levels deep (setq org-refile-targets (quote ((nil :maxlevel . 5) (org-agenda-files :maxlevel . 5)))) ; Targets start with the file name - allows creating level 1 tasks (setq org-refile-use-outline-path (quote file)) ; Targets complete in steps so we start with filename, TAB shows the next level of targets etc (setq org-outline-path-complete-in-steps t) (setq org-todo-keywords (quote ((sequence "TODO(t)" "NEXT(n)" "STARTED(s)" "|" "DONE(d!/!)") (sequence "WAITING(w@/!)" "SOMEDAY(S)" "|" "CANCELLED(c@/!)" "MEETING")))) (setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold) ("NEXT" :foreground "blue" :weight bold) ("STARTED" :foreground "yellow" :weight bold) ("DONE" :foreground "forest green" :weight bold) ("WAITING" :foreground "orange" :weight bold) ("SOMEDAY" :foreground "magenta" :weight bold) ("CANCELLED" :foreground "forest green" :weight bold) ("MEETING" :foreground "forest green" :weight bold)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Org clock ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Save the running clock and all clock history when exiting Emacs, load it on startup (setq org-clock-persistence-insinuate t) (setq org-clock-persist t) (setq org-clock-in-resume t) ;; Change task state to STARTED when clocking in (setq org-clock-in-switch-to-state "STARTED") ;; Save clock data and notes in the LOGBOOK drawer (setq org-clock-into-drawer t) ;; Removes clocked tasks with 0:00 duration (setq org-clock-out-remove-zero-time-clocks t) ;; Show clock sums as hours and minutes, not "n days" etc. (setq org-time-clocksum-format '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t)) ;; Show the clocked-in task - if any - in the header line (defun sanityinc/show-org-clock-in-header-line () (setq-default header-line-format '((" " org-mode-line-string " ")))) (defun sanityinc/hide-org-clock-from-header-line () (setq-default header-line-format nil)) (add-hook 'org-clock-in-hook 'sanityinc/show-org-clock-in-header-line) (add-hook 'org-clock-out-hook 'sanityinc/hide-org-clock-from-header-line) (add-hook 'org-clock-cancel-hook 'sanityinc/hide-org-clock-from-header-line) (after-load 'org-clock (define-key org-clock-mode-line-map [header-line mouse-2] 'org-clock-goto) (define-key org-clock-mode-line-map [header-line mouse-1] 'org-clock-menu)) (require-package 'org-pomodoro) (after-load 'org-agenda (define-key org-agenda-mode-map (kbd "P") 'org-pomodoro)) (after-load 'org (define-key org-mode-map (kbd "C-M-") 'org-up-element)) ;; https://superuser.com/a/570655/683536 ;; Previously bound to org-fill-paragraph ;;(define-key org-mode-map "\M-q" 'toggle-truncate-lines) (after-load 'org (define-key org-mode-map (kbd "M-q") 'toggle-truncate-lines)) (after-load 'org (org-babel-do-load-languages 'org-babel-load-languages '((R . t) (ditaa . t) (dot . t) (emacs-lisp . t) (gnuplot . t) (haskell . t) (latex . t) (ledger . t) (ocaml . nil) (octave . t) (python . t) (ruby . t) (screen . nil) (shell . t) (sql . t) (sqlite . t)))) ;; ;; http://pragmaticemacs.com/emacs/org-mode-basics-vii-a-todo-list-with-schedules-and-deadlines/ ;; http://pragmaticemacs.com/emacs/master-your-inbox-with-mu4e-and-org-mode/ ;;capture todo items using C-c c t (define-key global-map (kbd "C-c c") 'org-capture) (setq org-capture-templates '(("t" "todo" entry (file+headline "~/Documents/org/main.org" "Tasks") "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n") ("c" "crypto journal" entry (file+datetree "~/Documents/criptochuflas/_notes/crypto_journal.org") "* entry") ("d" "day time track" entry (file+datetree "~/Documents/org/time_tracker.org") "*** **** Work ***** Keybase and catch up ***** Meetings: ***** Meta: check-ins **** Rest **** Eat ***** Lunch ***** Dinner **** Kids ***** Morning ***** Afternoon ***** Evening **** Workout **** Errands **** Learn "))) (provide 'init-org) ;;; init-org.el ends here