rice

personal dot files and scripts for linux and macOS
Log | Files | Refs | README | LICENSE

module-org.el (3761B)


      1 ;;; module-org.el
      2 
      3 ;; Author: Mark Feller <mark.feller@member.fsf.org>
      4 
      5 ;; This file is not part of GNU Emacs.
      6 
      7 ;; This file is free software; you can redistribute it and/or modify
      8 ;; it under the terms of the GNU General Public License as published by
      9 ;; the Free Software Foundation; either version 3, or (at your option)
     10 ;; any later version.
     11 
     12 ;; This file is distributed in the hope that it will be useful,
     13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 ;; GNU General Public License for more details.
     16 
     17 ;; You should have received a copy of the GNU General Public License
     18 ;; along with this file.  If not, see <http://www.gnu.org/licenses/>.
     19 
     20 ;;; Commentary:
     21 
     22 ;;; Code:
     23 
     24 (defun mjf/org-summary-todo (n-done n-not-done)
     25   "Switch entry to DONE when all subentries are done, to TODO otherwise."
     26   (let (org-log-done org-log-states)   ; turn off logging
     27     (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
     28 
     29 (use-package org
     30   :bind (("C-c l" . org-store-link)
     31          ("C-c a" . org-agenda)
     32          ("C-c c" . org-capture)
     33          :map org-src-mode-map
     34          ("C-x C-s" . org-edit-src-exit))
     35   :delight (org-indent-mode nil t)
     36   :config
     37   (require 'org-indent)
     38   (require 'org-src)
     39   (require 'ob-shell)
     40 
     41   (setq org-startup-indented t)
     42   (setq org-src-tab-acts-natively t)
     43   (setq org-src-fontify-natively t)
     44   (setq org-hide-emphasis-markers t)
     45 
     46   (add-hook 'org-after-todo-statistics-hook 'mjf/org-summary-todo)
     47   (add-hook 'org-mode-hook 'disable-line-numbers)
     48   (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
     49 
     50   (setq mjf/org-work-file (format "%s/work.org" (getenv "XDG_DOCUMENTS_DIR")))
     51   (setq mjf/org-life-file (format "%s/life.org" (getenv "XDG_DOCUMENTS_DIR")))
     52 
     53   ;; personal capture templates
     54   (setq org-capture-templates
     55         '(
     56           ;; unfiled work items
     57           ("w" "Work" entry (file+headline mjf/org-work-file "Unread")
     58            "* TODO %?\n  %i\n")
     59 
     60           ;; random thoughts I'd like to capture
     61           ("t" "Thought" entry (file+headline mjf/org-work-file "Thoughts")
     62            "* %?\n  %i\n")
     63 
     64           ;; unfiled work items in my life
     65           ("l" "Life" entry (file+headline mjf/org-life-file "Inbox")
     66            "* TODO %?\n  %i\n")
     67 
     68           ("j" "Journal" entry (file+datetree mjf/org-life-file)
     69            "* TODO %?\n")))
     70 
     71   ;; when refiling an org header don't search more than 3 levels deep
     72   (setq org-refile-targets
     73         '((nil :maxlevel . 3)
     74           (org-agenda-files :maxlevel . 3)))
     75 
     76   (setq org-todo-keywords
     77         '((sequence "TODO(t)" "BLOCKED(b)" "|" "DONE(d)" "CANCELLED(c)")
     78           (sequence "RECURRING(r)" "|" "DONE(d)")))
     79 
     80   ;; don't make the title big, I don't like that. Also remove those ugly
     81   ;; checkboxes
     82   (set-face-attribute 'org-document-title nil :height 1)
     83   (set-face-attribute 'org-checkbox nil :box nil))
     84 
     85 (use-package org-bullets
     86   :config
     87   (setq org-bullets-bullet-list '("●" "○" "◉" "•"))
     88 
     89   ;; bullets on lists
     90   (font-lock-add-keywords
     91    'org-mode
     92    '(("^ +\\([-*]\\) "
     93       (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))))
     94 
     95 (use-package org-fancy-priorities
     96   :ensure t
     97   :delight (org-fancy-priorities-mode)
     98   :hook (org-mode . org-fancy-priorities-mode)
     99   :config
    100   (setq org-fancy-priorities-list '("⬆" "➡" "⬇" "☕"))
    101   (setq org-priority-faces '((65 . "#dc322f")
    102                              (66 . "#cb4b16")
    103                              (67 . "#859900"))))
    104 
    105 (use-package deft
    106   :disabled
    107   :config
    108   (setq deft-directory "~/org"
    109         deft-extensions '("md" "org")
    110         deft-recursive t)
    111 
    112   (add-hook 'deft-mode-hook (lambda () (evil-emacs-state))))
    113 
    114 (provide 'module-org)
    115 
    116 ;;; module-org.el ends here