;;; my-org.el --- Configure org-mode -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: (require 'org) (require 'org-agenda) (require 'org-capture) (require 'org-archive) (require 'ox) (require 'ox-md) (defvar my/org-directory (if (memq window-system '(mac ns)) (expand-file-name "~/workspace/notebooks/") (expand-file-name "~/documents/notes/"))) (add-hook 'org-mode-hook 'org-indent-mode) (add-hook 'org-mode-hook 'org-hide-block-all) (add-hook 'org-mode-hook 'visual-line-mode) (add-hook 'org-capture-after-finalize-hook 'org-save-all-org-buffers) (add-hook 'org-capture-prepare-finalize-hook 'org-save-all-org-buffers) (global-set-key (kbd "C-c c") 'org-capture) (global-set-key (kbd "C-c a") 'org-agenda) (defvar load-language-list '((emacs-lisp . t) (python . t) (shell . t))) (setq org-directory my/org-directory) (setq org-hide-emphasis-markers t) ;; hide emphasis markup (setq org-archive-subtree-add-inherited-tags t) ;; when archiving, inherit the tags from the parent (setq org-pretty-entities t) ;; display unicode characters (setq org-log-done 'time) ;; log the time of completion (setq org-log-into-drawer t) ;; insert state change in the drawer (setq org-cycle-separator-lines 0) (setq org-startup-folded 'content) (setq org-todo-keywords '((sequence "TODO" "STARTED" "WAITING" "|" "DONE" "CANCELED"))) (setq org-priority-start-cycle-with-default nil) ;; Start one over/under default value. (setq org-highest-priority ?A) (setq org-lowest-priority ?D) (setq org-default-priority ?C) ;; Ensures unset tasks have low priority. (setq org-refile-use-cache nil) (setq org-refile-targets `((,(expand-file-name "tasks.org" org-directory) :maxlevel . 1) (,(expand-file-name "notes.org" org-directory) :maxlevel . 1) (,(expand-file-name "projects.org" org-directory) :tag . "project"))) (setq org-refile-use-outline-path 'file) (setq org-outline-path-complete-in-steps nil) (setq org-refile-allow-creating-parent-nodes 'confirm) ;; org babel related (setq org-src-fontify-natively t) (setq org-src-preserve-indentation t) ;; prevent the conversion of spaces into tabs (necessary for Python code exports) (setq org-edit-src-content-indentation t) (setq org-return-follows-link t) ;; I want to follow links on RET ;; some configurations for exporting document (setq org-export-with-toc nil) (setq org-export-with-section-numbers nil) ;; a few abbreviations I use regularly (setq org-link-abbrev-alist '(("src" . "~/workspace/%s") ("jira" . "https://jira.rbx.com/browse/%s") ("go" . "http://go/%s"))) (setq org-blank-before-new-entry (quote ((heading . nil) (plain-list-item . nil)))) (setq org-reverse-note-order t) (setq org-agenda-files `(,(expand-file-name "inbox.org" org-directory) ,(expand-file-name "notes.org" org-directory) ,(expand-file-name "tasks.org" org-directory) ,(expand-file-name "projects.org" org-directory) ,(expand-file-name "bookmarks.org" org-directory) ,(expand-file-name "journal.org" org-directory))) (setq org-agenda-show-all-dates t) (setq calendar-week-start-day 1) (setq org-agenda-custom-commands nil) (setq org-agenda-start-on-weekday 1) (add-to-list 'org-agenda-custom-commands '("A" "Agenda" ((agenda "" ((org-agenda-span 'week))) (todo "TODO" ((org-agenda-overriding-header "To Refile") (org-agenda-files `(,(expand-file-name "inbox.org" org-directory))))) (todo "STARTED" ((org-agenda-overriding-header "In Progress"))) (todo "WAITING" ((org-agenda-overriding-header "Blocked"))) (todo "TODO" ((org-agenda-overriding-header "Not yet started") (org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline 'scheduled))))))) (setq org-capture-templates `(("t" "Todo" entry (file "inbox.org") "* TODO [#D] %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n") ("n" "Note" entry (file "notes.org") "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n") ("j" "Journal" entry (file+olp+datetree "journal.org") "* %?\n:PROPERTIES:\n:CREATED: %T\n:END:\n" :tree-type day))) (provide 'my-org) ;;; my-org.el ends here