Org Mode Enhancements
This commit is contained in:
parent
c8e8ea71c7
commit
dc727a4992
1 changed files with 62 additions and 11 deletions
73
config.el
73
config.el
|
|
@ -484,7 +484,7 @@
|
|||
|
||||
(add-hook 'org-mode-hook #'sbinfo/org-mode-setup)
|
||||
(setq org-directory "~/org/"
|
||||
org-agenda-files '("agenda.org" "goals_2026.org")
|
||||
org-agenda-files '("agenda.org" "goals_2026.org" "Pillbox.org")
|
||||
org-agenda-start-with-follow-mode t
|
||||
org-default-notes-file (expand-file-name "notes.org" org-directory)
|
||||
org-ellipsis " ▼ "
|
||||
|
|
@ -521,35 +521,51 @@
|
|||
" [ ] %?\n")
|
||||
("h" "Templates for hockey games")
|
||||
("hp" "Playoff Game" entry
|
||||
(file "~/org/dalvsedmwcf2025.org")
|
||||
(file "~/org/dalvsminrd12026.org")
|
||||
(file "~/org/templates/playoffcapture.orgtmpl") :unnarrowed t)
|
||||
("hr" "Regular Game" entry
|
||||
(file "~/org/dallasstars20252026.org")
|
||||
(file+headline "~/org/dallasstars20262027.org" "Dallas Stars 2026-2027 Season")
|
||||
(file "~/org/templates/regular.orgtmpl") :unnarrowed t)
|
||||
("i" "IT Request" checkitem
|
||||
(file+headline "~/org/notes.org" "Future IT Requests")
|
||||
" [ ] %?\n")
|
||||
("n" "Personal Notes")
|
||||
("nn" "Captured notes" entry
|
||||
(file+headline "~/org/notes.org" "Inbox")
|
||||
"* %u %?\n%i\n%a" :prepend t)
|
||||
("np" "Note via org-protocol" entry
|
||||
(file+headline "~/org/notes.org" "Web Clipper")
|
||||
(file "~/org/templates/webclipper.orgtmpl") :immediate-finish nil)
|
||||
("s" "Shopping Item" checkitem
|
||||
(file+headline "~/org/Shopping.org" "Needs")
|
||||
" [ ] %?\n")
|
||||
("t" "Personal todo" entry
|
||||
(file "~/org/agenda.org")
|
||||
"* TODO %?\n%i\n")
|
||||
("n" "Personal notes" entry
|
||||
(file+headline "~/org/notes.org" "Inbox")
|
||||
"* %u %?\n%i\n%a" :prepend t)
|
||||
("u" "Urinary Tracker" table-line
|
||||
(file+headline "~/org/urinary_tracker.org" "Urinary Tracker")
|
||||
"| %<%Y-%m-%d> | %<%I:%M %p> | %? | | |"))
|
||||
"* TODO %?\n%i\n"))
|
||||
org-roam-capture-ref-templates
|
||||
'(("w" "ref" plain "%(org-web-tools--url-as-readable-org \"${ref}\")"
|
||||
:target (file+head "clips/${slug}.org" "#+title: ${title}\n")
|
||||
:unnarrowed t)))
|
||||
:unnarrowed t))
|
||||
)
|
||||
|
||||
;;("j" "Journal" entry
|
||||
;;(file+olp+datetree +org-capture-journal-file)
|
||||
;;"* %U %?\n%i\n%a" :prepend t)))
|
||||
(sbinfo/org-font-setup))
|
||||
|
||||
(setq org-agenda-custom-commands
|
||||
'(("d" "Today's Agenda"
|
||||
(
|
||||
(tags-todo "+afterfocus+SCHEDULED<\"<tomorrow>\""
|
||||
((org-agenda-overriding-header "After Focus Items")))
|
||||
(agenda "" ((org-agenda-span 3)
|
||||
(org-agenda-start-day "-1d")))))
|
||||
("p" "Pills Against the Ageless Ills" (
|
||||
(agenda "" ((org-agenda-files '("/home/shawnb/org/Pillbox.org"))
|
||||
(org-agenda-entry-types '(:scheduled))
|
||||
(org-scheduled-past-days 0)
|
||||
(org-agenda-overriding-header "Pills Against the Ageles Ills")))))))
|
||||
|
||||
(use-package! org-modern
|
||||
:hook (org-mode . org-modern-mode)
|
||||
:config
|
||||
|
|
@ -686,3 +702,38 @@
|
|||
(advice-add 'org-hugo-link :around #'my/org-hugo-link-advice)
|
||||
|
||||
;; (advice-remove 'org-hugo-link #'my/org-hugo-link-advice)
|
||||
|
||||
;; https://jamesendreshowell.com/2026-04-04-my-first-advice-in-emacs-lisp.html
|
||||
(defun sbinfo/file-to-string (file)
|
||||
"Return a string that is the contents of FILE."
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(buffer-string)))
|
||||
|
||||
;; Keeping count of pills/puffs in the Pillbox. Designed to mark a Pillbox task as CANCELLED
|
||||
;; if the supply runs out.
|
||||
;; Thanks, Claude
|
||||
(defun sbinfo/decrement-org-property (property)
|
||||
"Decrement PROPERTY on current heading by 1, clamping at zero.
|
||||
When the value reaches zero, mark the task as CANCELLED."
|
||||
(let* ((val (org-entry-get nil property))
|
||||
(num (and val (string-to-number val))))
|
||||
(when num
|
||||
(cond
|
||||
((> num 1)
|
||||
(org-entry-put nil property (number-to-string (1- num))))
|
||||
((= num 1)
|
||||
(org-entry-put nil property "0")
|
||||
(org-todo "CANCELLED")) ;; Already at zero — do nothing
|
||||
))))
|
||||
|
||||
(defun sbinfo/on-recurring-task-done ()
|
||||
"Decrement :REMAINING: when a recurring task is completed."
|
||||
(when (and (string= org-state "DONE")
|
||||
(org-entry-get nil "REMAINING"))
|
||||
(sbinfo/decrement-org-property "REMAINING")))
|
||||
|
||||
(add-hook 'org-after-todo-state-change-hook #'sbinfo/on-recurring-task-done)
|
||||
(defun sbinfo/org-capture-frame ()
|
||||
(set-frame-parameter nil 'name "org-capture")
|
||||
(org-capture))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue