summaryrefslogtreecommitdiff
path: root/modules/org-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-22 12:23:13 -0500
committerCraig Jennings <c@cjennings.net>2024-04-22 12:23:13 -0500
commit2dd3aed6971fe74915c1fc09b4de20a6c64e817b (patch)
treef9d896ebcfd0e6a2acb2684ff085a42324a9a638 /modules/org-config.el
parent5d18558615a127640d6b4e634997ee35a5fe1b77 (diff)
New Custom Functions, Org Updates, Agenda Updates, &c.
=== Functions === - add function cj/dired-convert-image-to-jpeg - add function cj/dired-copy-path-as-kill - add function cj/export-org-to-md-on-save function - add function cj/org-link-to-current-file === Agenda === - rework the f8 main agenda into custom agenda using Aaron Bieber's ideas - agenda lists now use standard agenda functions - updated packages to remove org-super-agenda and ts (a dependency) - file commentary text updated to reflect the change === Org === - add grocery and shopping list capture items - add missing tests for org-skip-subtree-if-habit - add support for org-habits, including checkboxes - fix issue with org-auto-export-to-md - modularize org-agenda - move todo settings to org-config - reformat org-roam-config === &c. === - add day to sortable date - add disablefastrenderer to hugo server flags - add fill column indicator when emacs lisping - add gpt buffers to the bury-alive-list - add keybinding for fixup-whitespace - add magit cloning settings - finish automatically on "Link" capture - fix company complaints about shutting up function - fix em, e, ff, and f eshell aliases - make fallback theme modus-vivendi - prune the compilation cache when applicable
Diffstat (limited to 'modules/org-config.el')
-rw-r--r--modules/org-config.el144
1 files changed, 102 insertions, 42 deletions
diff --git a/modules/org-config.el b/modules/org-config.el
index 0094cc9d..f084a8c0 100644
--- a/modules/org-config.el
+++ b/modules/org-config.el
@@ -18,25 +18,88 @@
;;; Code:
-;;;; --------------------------- Constants ---------------------------
+;; --------------------------------- Constants ---------------------------------
;; note: some constants used here are defined in init.el
(defvar org-archive-location (concat sync-dir "/archives/archive.org::datetree/")) ;; location of archive file
(defvar org-project-files (list schedule-file))
-;; ---------------------------- APT Sorting Function ---------------------------
+;; ---------------------------- Org General Settings ---------------------------
-(defun cj/org-reorder-list-apt ()
- "Sort the org header by three criteria: alpha, pri, then todo."
- (interactive)
- (save-excursion
- (ignore-errors
- (progn
- (org-sort-entries t ?a)
- (org-sort-entries t ?p)
- (org-sort-entries t ?t)
- (org-cycle)
- (org-cycle)))))
+(defun cj/org-general-settings ()
+ "All general \='org-mode\=' settings are grouped and set in this function."
+
+ ;; Unbind org-cycle-agenda-files keys for use elsewhere
+ (unbind-key "C-'" org-mode-map)
+ (unbind-key "C-," org-mode-map)
+
+ ;; ORG-MODULES
+ ;; enable recognition of org-protocol:// as a parameter
+ ;; add org-habits
+ (require 'org-protocol)
+ (setq org-modules '(org-protocol ol-eww ol-w3m ol-info org-habit))
+
+ ;; GENERAL
+ (setq org-startup-folded t) ;; all org files should start in the folded state
+ (setq org-cycle-open-archived-trees t) ;; re-enable opening headings with archive tags with TAB
+ (setq org-outline-path-complete-in-steps nil)
+ (setq org-return-follows-link t) ;; hit return to follow an org-link
+ (setq org-list-allow-alphabetical t) ;; allow alpha ordered lists (i.e., a), A), a., etc.)
+
+ ;; INDENTATION
+ (setq org-startup-indented t) ;; load org files indented
+ (setq org-adapt-indentation t) ;; adapt indentation to outline node level
+ (setq org-indent-indentation-per-level 2) ;; indent two character-widths per level
+
+ ;; INLINE IMAGES
+ (setq org-startup-with-inline-images t) ;; preview images by default
+ (setq org-image-actual-width '(500)) ;; keep image sizes in check
+
+ (setq org-bookmark-names-plist nil) ;; don't set org-capture bookmarks
+
+ ;; force pdfs exported from org to open in emacs
+ (add-to-list 'org-file-apps '("\\.pdf\\'" . emacs)))
+
+;; ----------------------------- Org TODO Settings ---------------------------
+
+(defun cj/org-todo-settings ()
+ "All org-todo related settings are grouped and set in this function."
+
+ ;; logging task creation, task start, and task resolved states
+ (setq org-todo-keywords '((sequence "TODO(t!)" "PROJECT(p)" "DOING(i!)"
+ "WAITING(w)" "VERIFY(v)" "STALLED(s)"
+ "DELEGATED(x)" "|"
+ "FAILED(f!)" "DONE(d!)" "CANCELLED(c!)")))
+
+ (setq org-todo-keyword-faces
+ '(("TODO" . "green")
+ ("PROJECT" . "blue")
+ ("DOING" . "yellow")
+ ("WAITING" . "white")
+ ("VERIFY" . "orange")
+ ("STALLED" . "light blue")
+ ("DELEGATED" . "green")
+ ("FAILED" . "red")
+ ("DONE" . "dark grey")
+ ("CANCELLED" . "dark grey")))
+
+ (setq org-highest-priority ?A)
+ (setq org-lowest-priority ?D)
+ (setq org-default-priority ?D)
+ (setq org-priority-faces '((?A . (:foreground "Cyan" :weight bold))
+ (?B . (:foreground "Yellow"))
+ (?C . (:foreground "Green"))
+ (?D . (:foreground "Grey"))))
+
+ (setq org-enforce-todo-dependencies t)
+ (setq org-enforce-todo-checkbox-dependencies t)
+ (setq org-deadline-warning-days 7) ;; warn me w/in a week of deadlines
+ (setq org-treat-insert-todo-heading-as-state-change t) ;; log task creation
+ (setq org-log-into-drawer t) ;; log into the drawer
+ (setq org-habit-graph-column 75) ;; allow space for task name
+
+ ;; inherit parents properties (sadly not schedules or deadlines)
+ (setq org-use-property-inheritance t))
;; ---------------------------------- Org Mode ---------------------------------
@@ -57,7 +120,6 @@
("C-\\" . org-match-sparse-tree)
("C-c t" . org-set-tags-command)
("C-c l" . org-store-link)
- ("C-c r" . cj/org-reorder-list-apt)
("C-c C-l" . org-insert-link)
("s-<up>" . org-priority-up)
("s-<down>" . org-priority-down)
@@ -112,40 +174,38 @@
(org-mode . (lambda () (interactive) (company-mode -1))) ;; no company-mode in org
:config
- ;; Unbind org-cycle-agenda-files keys for use elsewhere
- (unbind-key "C-'" org-mode-map)
- (unbind-key "C-," org-mode-map)
+ (cj/org-general-settings)
+ (cj/org-todo-settings))
- ;; ORG-PROTOCOL
- ;; enable recognition of org-protocol:// as a parameter
- (require 'org-protocol)
- (setq org-modules '(org-protocol ol-eww ol-w3m ol-info))
+;; ------------------------------- Org-Checklist -------------------------------
+;; needed for org-habits to reset checklists once task is complete
+;; this was a part of org-contrib which was deprecated
- ;; GENERAL
- (setq org-startup-folded t) ;; all org files should start in the folded state
- (setq org-cycle-open-archived-trees t) ;; re-enable opening headings with archive tags with TAB
- (setq org-outline-path-complete-in-steps nil)
- (setq org-return-follows-link t) ;; hit return to follow an org-link
- (setq org-list-allow-alphabetical t) ;; allow alpha ordered lists (i.e., a), A), a., etc.)
+(use-package org-checklist
+ :ensure nil ;; in custom folder
+ :after org
+ :load-path "custom/org-checklist.el")
- ;; INDENTATION
- (setq org-startup-indented t) ;; load org files indented
- (setq org-adapt-indentation t) ;; adapt indentation to outline node level
- (setq org-indent-indentation-per-level 2) ;; indent two character-widths per level
+;; -------------------------- Org Link To Current File -------------------------
+;; get a link to the file the current buffer is associated with.
- ;; INLINE IMAGES
- (setq org-startup-with-inline-images t) ;; preview images by default
- (setq org-image-actual-width '(500)) ;; keep image sizes in check
-
- (setq org-bookmark-names-plist nil) ;; don't set org-capture bookmarks
-
- ;; force pdfs exported from org to open in emacs
- (add-to-list 'org-file-apps '("\\.pdf\\'" . emacs)))
+(defun cj/org-link-to-current-buffer-file ()
+ "Create an Org mode link to the current file and copy it to the clipboard.
+The link is formatted as [[file:<file-path>][<file-name>]],
+where <file-path> is the full path to the current file and <file-name>
+is the name of the current file without any directory information.
-;; https://www.reddit.com/r/orgmode/comments/n56fcv/important_the_contrib_directory_now_lives_outside/
-;; (use-package org-contrib
-;; :after org)
+If the current buffer is not associated with a file, the function will throw an
+error."
+ (interactive)
+ (if (buffer-file-name)
+ (let* ((filename (buffer-file-name))
+ (description (file-name-nondirectory filename))
+ (link (format "[[file:%s][%s]]" filename description)))
+ (kill-new link)
+ (message "Copied Org link to current file to clipboard: %s" link))
+ (user-error "Buffer isn't associated with a file, so no link sent to clipboard")))
(provide 'org-config)
;;; org-config.el ends here