Skip to content

Instantly share code, notes, and snippets.

@jackbaty
Created August 25, 2019 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackbaty/a7df6524c547f2503cfb732e78ba6de8 to your computer and use it in GitHub Desktop.
Save jackbaty/a7df6524c547f2503cfb732e78ba6de8 to your computer and use it in GitHub Desktop.

Org Mode

Packages

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

Configuration

(use-package org
  :ensure org-plus-contrib
  :bind (("C-c l" . 'org-store-link)
         ("C-c a" . org-agenda)
         ("C-c c" . org-capture))
  :config
  (progn
    (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
          org-todo-keywords
          '((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 " "
          org-priority-faces
          `((?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

Agenda

(use-package org-super-agenda
  :ensure t
  :config
 (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/tasks.org"
			   "~/org/timesheet.org"
			   "~/org/inbox.org"
                           "~/org/gcal.org"
                           "~/org/events.org"
			   "~/org/projects"
			   "~/org/daybook.org"
			   "~/org/clients"
                           "~/org/tickler.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
        org-agenda-clock-consistency-checks
              '(:max-duration "4:00"
                              :min-duration 0
                              :max-gap 0
                              :gap-ok-around ("4:00")))


(setq org-agenda-custom-commands
   (quote
    (("n" "Agenda and all TODOs"
      ((agenda "" nil)
       (todo "TODO|NEXT" nil))
      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/daybook.org"))
       (org-agenda-text-search-extra-files nil)))
     ("Qn" "Search Notes" search ""
      ((org-agenda-files '("~/org/notes.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
        (quote
          (:link t :maxlevel 4 :stepskip0 nil :fileskip0 t :compact nil)))
  (setq org-agenda-skip-deadline-prewarning-if-scheduled t)

Capture

  (setq org-capture-templates
     '(("t" "Todo to Inbox" entry
        (file+headline "~/org/tasks.org" "Inbox")
	     "* TODO %?\n\n%i\n"
	     :empty-lines 1)
       ("T" "Todo and Clock In" entry
        (file+headline "~/org/tasks.org" "Inbox")
        "* TODO %? \n %i\n" :clock-in t :clock-keep t)
       ("e" "Create Event" entry
        (file+olp+datetree "~/org/events.org")
        "* %?\n%T" :time-prompt t)
       ("E" "Create Event and Clock In" entry
        (file+olp+datetree "~/org/events.org")
        "* %?\n%T" :time-prompt t :clock-in t :clock-keep t)
       ("w" "Work Timesheet" entry
        (file+olp+datetree "~/org/timesheet.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.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/daybook.org")
        "* %?\n%T\n\n" :time-prompt t)
       ("F" "Fusionary Log" entry
        (file+olp+datetree "~/org/fusionary.org")
        "* %?\n%t\n\n")
       ("n" "Take a note" entry
        (file+headline "~/org/notes.org" "Notes")
        "* %i%? \n %U\n" :empty-lines 1 :prepend t)
       ("b" "Bookmark" entry
        (file+headline "~/org/notes.org" "Bookmarks")
        "* %i%? \n %U\n")
       ("m" "TODO from Mail" entry
        (file+headline "~/org/tasks.org" "Inbox")
        "* TODO Followup%? (%:fromname about %:subject)  :email: \n%U\n%a\n")
       ("s" "Someday" entry (file+headline "~/org/someday.org" "Someday/Maybe")
        "* %?\n%U")))

Other

;; Define "stuck" projects
(setq org-stuck-projects
      '("+project+wip/-MAYBE-DONE"
	("NEXT" "TODO")
	nil ""))

;;(setq org-refile-targets '(("~/org/tickler.org" :maxlevel . 2)
;;			   (nil :maxlevel . 2)
;;			   ("~/org/someday.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
        (quote
           ("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
        org-speed-commands-user
        '(("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
                  org-level-2
                  org-level-3
                  org-level-4
                  org-level-5))
    (set-face-attribute face nil :weight 'normal :height 1.0))
  (org-super-agenda-mode))

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


(use-package org-download
  :ensure t
  :init
  (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