Skip to content

Instantly share code, notes, and snippets.

Created August 25, 2019 11:10
What would you like to do?

Org Mode


(require 'org-devonthink)
(require 'org-mailmate)
(require 'org-thebrain)


(use-package org
  :ensure org-plus-contrib
  :bind (("C-c l" . 'org-store-link)
         ("C-c a" . org-agenda)
         ("C-c c" . org-capture))
    (setq org-return-follows-link t
	  ;; force UTF-8
          org-export-coding-system 'utf-8
	  ;; start up showing images
          org-startup-with-inline-images t
	  ;; Mark entries as done when archiving
          org-archive-mark-done t

(setq org-M-RET-may-split-line nil
          '((sequence "TODO(t)" "NEXT(n)" "WAIT(w@/!)" "|" "DONE(d!)" "CANC(c@)"))
          org-icalendar-timezone "America/Detroit"
          org-log-into-drawer t
          org-use-tag-inheritance t
          org-tags-exclude-from-inheritance (list "crypt" "project")
          org-fontify-quote-and-verse-blocks t
          org-fontify-done-headline t
          org-fontify-whole-heading-line t
          org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id
	  org-hide-emphasis-markers t
	  org-html-validation-link nil
	  org-bullets-bullet-list '("·")
          header-line-format " "
          `((?a . ,(face-foreground 'error))
            (?b . ,(face-foreground 'warning))
            (?c . ,(face-foreground 'success))))

(set-face-attribute 'org-level-1 nil :height 1.0)  ; don't make level-1 headings bigger in doom-one


(use-package org-super-agenda
  :ensure t
 (setq org-super-agenda-groups '((:name "Today"
                                  :time-grid t
                                  :scheduled today)
                           (:name "Due today"
                                  :deadline today)
                           (:name "Important"
                                  :priority "A")
                           (:name "Overdue"
                                  :deadline past)
                           (:name "Due soon"
                                  :deadline future)
			   (:name "Waiting"
                                 :todo "WAIT"))))

(setq org-agenda-files '(  "~/org/"

  (setq org-agenda-include-diary t
        org-agenda-start-on-weekday nil
        org-agenda-start-day nil
        org-agenda-log-mode-items (quote (closed))
        org-startup-indented t
        org-agenda-persistent-filter t
        org-agenda-skip-scheduled-if-deadline-is-shown (quote not-today)
        org-agenda-skip-scheduled-if-done t
        org-agenda-skip-deadline-if-done t
        org-agenda-span (quote day)
	    org-deadline-warning-days 5
        org-agenda-tags-column -100
        org-tags-column 0
        org-log-done 'time
	    org-log-reschedule 'note
        org-log-redeadline 'note
        org-agenda-text-search-extra-files (quote (agenda-archives))
        org-agenda-todo-ignore-deadlines (quote near)
        org-agenda-todo-ignore-scheduled 'all
        org-agenda-window-setup (quote current-window)
        org-clock-into-drawer "CLOCKING"
        org-clock-out-remove-zero-time-clocks t
              '(:max-duration "4:00"
                              :min-duration 0
                              :max-gap 0
                              :gap-ok-around ("4:00")))

(setq org-agenda-custom-commands
    (("n" "Agenda and all TODOs"
      ((agenda "" nil)
       (todo "TODO|NEXT" nil))
     ("w" "Waiting"
      ((todo "WAIT" nil))
      nil nil)
     ("p" "Work Projects"
      ((tags "+project+wip"))
      nil nil)
     ("W" "Work TODOs"
      ((tags-todo "CATEGORY<>\"PERS\"+CATEGORY<>\"Repeat\""))
      nil nil)
     ("Q" . "Custom Queries")
     ("Qd" "Search Daybook" search ""
      ((org-agenda-files '("~/org/"))
       (org-agenda-text-search-extra-files nil)))
     ("Qn" "Search Notes" search ""
      ((org-agenda-files '("~/org/"))
              (org-agenda-text-search-extra-files nil)))
     ("R" "Agenda review" agenda "" ((org-agenda-archives-mode t)
                                     (org-agenda-start-with-clockreport-mode t)
                                     (org-agenda-start-with-log-mode t))))

  (setq org-agenda-clockreport-parameter-plist
          (:link t :maxlevel 4 :stepskip0 nil :fileskip0 t :compact nil)))
  (setq org-agenda-skip-deadline-prewarning-if-scheduled t)


  (setq org-capture-templates
     '(("t" "Todo to Inbox" entry
        (file+headline "~/org/" "Inbox")
	     "* TODO %?\n\n%i\n"
	     :empty-lines 1)
       ("T" "Todo and Clock In" entry
        (file+headline "~/org/" "Inbox")
        "* TODO %? \n %i\n" :clock-in t :clock-keep t)
       ("e" "Create Event" entry
        (file+olp+datetree "~/org/")
        "* %?\n%T" :time-prompt t)
       ("E" "Create Event and Clock In" entry
        (file+olp+datetree "~/org/")
        "* %?\n%T" :time-prompt t :clock-in t :clock-keep t)
       ("w" "Work Timesheet" entry
        (file+olp+datetree "~/org/")
        "* %? %^g\n%T")
	    ("p" "Journal TODO entry" entry (function org-journal-find-todo-location)
	     "* TODO %? \n%i")
       ("k" "Add a Tickler" entry
        (file+headline "~/org/" "Tickler")
        "* %i%? \n %U")
       ("l" "Current file log entry" entry
        (file+olp+datetree buffer-file-name)
        "* %? \n")
       ("d" "Daybook" entry
        (file+olp+datetree "~/org/")
        "* %?\n%T\n\n" :time-prompt t)
       ("F" "Fusionary Log" entry
        (file+olp+datetree "~/org/")
        "* %?\n%t\n\n")
       ("n" "Take a note" entry
        (file+headline "~/org/" "Notes")
        "* %i%? \n %U\n" :empty-lines 1 :prepend t)
       ("b" "Bookmark" entry
        (file+headline "~/org/" "Bookmarks")
        "* %i%? \n %U\n")
       ("m" "TODO from Mail" entry
        (file+headline "~/org/" "Inbox")
        "* TODO Followup%? (%:fromname about %:subject)  :email: \n%U\n%a\n")
       ("s" "Someday" entry (file+headline "~/org/" "Someday/Maybe")
        "* %?\n%U")))


;; Define "stuck" projects
(setq org-stuck-projects
	("NEXT" "TODO")
	nil ""))

;;(setq org-refile-targets '(("~/org/" :maxlevel . 2)
;;			   (nil :maxlevel . 2)
;;			   ("~/org/" :maxlevel . 1)))

(setq org-refile-targets '((org-agenda-files :maxlevel . 2)

  ;; Misc Org Configuration

(setq org-log-note-headings '((done        . "CLOSING NOTE %t")
                              (state       . "State %-12s from %-12S %t")
                              (note        . "Note taken on %t")
                              (reschedule  . "Schedule changed on %t: %S -> %s")
                              (delschedule . "Not scheduled, was %S on %t")
                              (redeadline  . "Deadline changed on %t: %S -> %s")
                              (deldeadline . "Removed deadline, was %S on %t")
                              (refile      . "Refiled on %t")
                              (clock-out   . "")))

  (setq org-latex-pdf-process
           ("xelatex -interaction nonstopmode  %f" "xelatex -interaction nonstopmode %f")))

  (setq org-link-abbrev-alist
          ("tsfile" . "~/org/memacs/files.org_archive::/\*.*%s/")

(setq org-agenda-tags-todo-honor-ignore-options t)

(set-face-attribute 'org-level-1 nil :height 1.0)  ; don't make level-1 headings bigger in doom-one

;; Make refiling easier
(eval-after-load "org-mode" '(progn
			       (define-key org-agenda-mode-map (kbd "r") 'org-agenda-refile)))

(use-package org-cliplink
  :bind ("C-x p i" . org-cliplink))

(setq org-use-speed-commands t
        '(("N" org-narrow-to-subtree)
          ("$" org-archive-subtree)
          ("A" org-archive-subtree)
          ("W" widen)
          ("d" org-down-element)
          ("m" org-mark-subtree)
          ("s" org-sort)
          ("x" smex-major-mode-commands)
          ("y" org-todo-yesterday)))

(defun jab/org-mode-hook ()
"Prevent org-level headers from being resized relative to other text."
  (dolist (face '(org-level-1
    (set-face-attribute face nil :weight 'normal :height 1.0))

(add-hook 'org-mode-hook #'jab/org-mode-hook)

(use-package org-download
  :ensure t
  (setq org-download-timestamp "-%Y-%m-%d"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment