org-config.el Wed, Mar 4, 2026

;;; org-config.el --- Org mode configuration -*- lexical-binding: t -*-

;;; Commentary:
;; Configuration for Org mode and related features

;;; Code:

(use-package org
  :commands (org-agenda org-switchb org-capture)
  :bind (("C-c a" . org-agenda)
         ("C-c b" . org-switchb)
         ("M-c" . org-capture)
         ("M-t". org-set-tags-command))
  :mode ("\\.org\\'" . org-mode)
  :custom
  (org-stuck-projects
   '("+LEVEL=2/-DONE"
     ("TODO" "WAITING" "DONE")
     ("FLAGGED")
     ""))
  (org-adapt-indentation nil)
  (org-fontify-whole-heading-line t)
  (org-log-done 'time)
  (org-log-into-drawer t)
  (org-agenda-files '("~/Sync/v/kf/todo.org"
					  "~/Sync/org/gtd.org"
                      "~/Sync/org/blog.org"
                      "~/Sync/org/guitar.org"))
  (org-return-follows-link t)
  (org-refile-use-outline-path 'file)
  (org-outline-path-complete-in-steps nil)
  (org-agenda-include-diary t)
  :config
  (setq org-refile-targets
        '((org-agenda-files . (:maxlevel . 4))))
  
  (defun dws/org-mode-hook ()
    "Setup for org mode."
    (visual-line-mode 1)
    (flyspell-mode 1)
    (auto-fill-mode 1))
  (add-hook 'org-mode-hook 'dws/org-mode-hook)

  (defun dws/journal-here ()
	"Build the Year/Month/Day hierarchy in the current buffer and jump to it."
	(interactive)
	;; This "unlocks" the functions you couldn't find
	(require 'org-datetree)
	;; This builds the tree for today
	(org-datetree-find-date-create (calendar-current-date))
	;; This moves you to the bottom of today's entry
	(org-end-of-subtree t))
  
  (setq org-capture-templates
        '(("j" "Journal" entry
           (file+olp+datetree "~/Sync/org/journal.org" "Journal")
           "***** %^{Description}\n%?\n")
          ("n" "Notes - in journal" entry
           (file+olp+datetree "~/Sync/org/journal.org" "Notes")
           "***** %^{Description}\n%?\n")
          ("g" "gtd" entry
           (file+olp "~/Sync/org/gtd.org" "Inbox")
           "** %^{Description}\n%?\n\n")
		  ("t" "kf todo" entry
		   (file+olp "~/Sync/v/kf/todo.org" "Current")
		   "** %^{Description}\n%?\n\n")
          ("b" "Blog" entry
           (file+olp "~/Sync/org/blog.org" "Ideas")
           "** %?\n*** concept\n***draft\n\n"))))

(provide 'org-config)
;;; org-config.el ends here