refactor: rename my-*/my- prefix to gortium/*; org-add-note for metric log
This commit is contained in:
@@ -48,14 +48,14 @@ they are implemented.
|
|||||||
(setq fancy-splash-image (expand-file-name "hermes_logo_ascii.png" doom-user-dir))
|
(setq fancy-splash-image (expand-file-name "hermes_logo_ascii.png" doom-user-dir))
|
||||||
|
|
||||||
;; 2. Define the quote function
|
;; 2. Define the quote function
|
||||||
(defun my-dashboard-quote ()
|
(defun gortium/dashboard-quote ()
|
||||||
(insert "\n" (+dashboard--center +dashboard--width "Simplicity is the ultimate sophistication.") "\n"))
|
(insert "\n" (+dashboard--center +dashboard--width "Simplicity is the ultimate sophistication.") "\n"))
|
||||||
|
|
||||||
;; 3. Override the functions list using the correct variable from the docs
|
;; 3. Override the functions list using the correct variable from the docs
|
||||||
(after! doom-dashboard
|
(after! doom-dashboard
|
||||||
(setq +dashboard-functions
|
(setq +dashboard-functions
|
||||||
'(+dashboard-widget-banner
|
'(+dashboard-widget-banner
|
||||||
my-dashboard-quote
|
gortium/dashboard-quote
|
||||||
+dashboard-widget-loaded
|
+dashboard-widget-loaded
|
||||||
+dashboard-widget-shortmenu
|
+dashboard-widget-shortmenu
|
||||||
+dashboard-widget-footer)))
|
+dashboard-widget-footer)))
|
||||||
@@ -2766,7 +2766,7 @@ only injects when the project's context-tag matches current mu4e context."
|
|||||||
(rx (or (: "http" (? "s") "://" (* nonl) "youtube.com" (* nonl))
|
(rx (or (: "http" (? "s") "://" (* nonl) "youtube.com" (* nonl))
|
||||||
(: "http" (? "s") "://" (* nonl) "youtu.be" (* nonl))))))
|
(: "http" (? "s") "://" (* nonl) "youtu.be" (* nonl))))))
|
||||||
|
|
||||||
(defun my-elfeed-tube-add-to-emms ()
|
(defun gortium/elfeed-tube-add-to-emms ()
|
||||||
"Add the currently selected Elfeed video(s) to the EMMS playlist."
|
"Add the currently selected Elfeed video(s) to the EMMS playlist."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((entries (if (eq major-mode 'elfeed-show-mode)
|
(let ((entries (if (eq major-mode 'elfeed-show-mode)
|
||||||
@@ -2782,10 +2782,10 @@ only injects when the project's context-tag matches current mu4e context."
|
|||||||
|
|
||||||
;; Bind the function to 'e' in both elfeed views
|
;; Bind the function to 'e' in both elfeed views
|
||||||
(map! :map elfeed-search-mode-map
|
(map! :map elfeed-search-mode-map
|
||||||
:n "e" #'my-elfeed-tube-add-to-emms)
|
:n "e" #'gortium/elfeed-tube-add-to-emms)
|
||||||
|
|
||||||
(map! :map elfeed-show-mode-map
|
(map! :map elfeed-show-mode-map
|
||||||
:n "e" #'my-elfeed-tube-add-to-emms)
|
:n "e" #'gortium/elfeed-tube-add-to-emms)
|
||||||
#+end_src
|
#+end_src
|
||||||
* EAF
|
* EAF
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
@@ -3384,15 +3384,13 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
nil 'tree)))
|
nil 'tree)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
: gortium/add-ids-to-subtree
|
|
||||||
** Maintenance Engine
|
** Maintenance Engine
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(after! org
|
(after! org
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
;; 1. THE REUSABLE ENGINE (Domain Agnostic)
|
;; 1. THE REUSABLE ENGINE (Domain Agnostic)
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
(defun my/org-metric-sync-engine (&key prop-name value-current prop-last-done prop-interval target-tag log-label)
|
(defun gortium/org-metric-sync-engine (&key prop-name value-current prop-last-done prop-interval target-tag log-label)
|
||||||
"Core logic to sync parent metrics to sub-tasks and log changes.
|
"Core logic to sync parent metrics to sub-tasks and log changes.
|
||||||
PROP-NAME: The property triggering the change (e.g., LAST_KM).
|
PROP-NAME: The property triggering the change (e.g., LAST_KM).
|
||||||
VALUE-CURRENT: The new value being set.
|
VALUE-CURRENT: The new value being set.
|
||||||
@@ -3403,7 +3401,7 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
(save-excursion
|
(save-excursion
|
||||||
;; A. Log the update to the Logbook with a timestamp
|
;; A. Log the update to the Logbook with a timestamp
|
||||||
(when log-label
|
(when log-label
|
||||||
(org-add-log-setup 'note (format "%s: %s" log-label value-current) nil 'findpos))
|
(org-add-note (format "%s: %s" log-label value-current)))
|
||||||
|
|
||||||
;; B. Narrow scope to current header and scan sub-tasks
|
;; B. Narrow scope to current header and scan sub-tasks
|
||||||
(org-narrow-to-subtree)
|
(org-narrow-to-subtree)
|
||||||
@@ -3420,7 +3418,7 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
target-tag)
|
target-tag)
|
||||||
(widen)))
|
(widen)))
|
||||||
|
|
||||||
(defun my/org-metric-prompt-engine (&key state tag prop-parent-metric prop-task-done label-prompt)
|
(defun gortium/org-metric-prompt-engine (&key state tag prop-parent-metric prop-task-done label-prompt)
|
||||||
"Core logic to prompt for values when a task is marked DONE.
|
"Core logic to prompt for values when a task is marked DONE.
|
||||||
STATE: The new TODO state (e.g., DONE).
|
STATE: The new TODO state (e.g., DONE).
|
||||||
TAG: The tag identifying relevant tasks.
|
TAG: The tag identifying relevant tasks.
|
||||||
@@ -3446,48 +3444,48 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
;; 2. THE DISPATCHERS (The Switchboard)
|
;; 2. THE DISPATCHERS (The Switchboard)
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
(defun my/org-property-change-handler (prop value)
|
(defun gortium/org-property-change-handler (prop value)
|
||||||
"Routes property changes to the correct sync parameters."
|
"Routes property changes to the correct sync parameters."
|
||||||
(cond
|
(cond
|
||||||
;; Case: F-150 Odometer
|
;; Case: F-150 Odometer
|
||||||
((string= prop "LAST_KM")
|
((string= prop "LAST_KM")
|
||||||
(my/org-metric-sync-engine
|
(gortium/org-metric-sync-engine
|
||||||
:prop-name prop :value-current value :prop-last-done "LAST_DONE_KM"
|
:prop-name prop :value-current value :prop-last-done "LAST_DONE_KM"
|
||||||
:prop-interval "INTERVAL_KM" :target-tag "SERVICE" :log-label "Odometer Update"))))
|
:prop-interval "INTERVAL_KM" :target-tag "SERVICE" :log-label "Odometer Update")))))
|
||||||
|
|
||||||
;; Case: Equipment/Industrial Hours
|
;; Case: Equipment/Industrial Hours
|
||||||
;; ((string= prop "LAST_HOURS")
|
;; ((string= prop "LAST_HOURS")
|
||||||
;; (my/org-metric-sync-engine
|
;; (gortium/org-metric-sync-engine
|
||||||
;; :prop-name prop :value-current value :prop-last-done "LAST_DONE_HOURS"
|
;; :prop-name prop :value-current value :prop-last-done "LAST_DONE_HOURS"
|
||||||
;; :prop-interval "INTERVAL_HOURS" :target-tag "MAINTENANCE" :log-label "Usage Hours Logged"))))
|
;; :prop-interval "INTERVAL_HOURS" :target-tag "MAINTENANCE" :log-label "Usage Hours Logged"))))
|
||||||
|
|
||||||
(defun my/org-todo-state-handler ()
|
(defun gortium/org-todo-state-handler ()
|
||||||
"Safely routes DONE completions, catching any argument errors."
|
"Safely routes DONE completions, catching any argument errors."
|
||||||
(interactive)
|
(interactive)
|
||||||
(condition-case err
|
(condition-case err
|
||||||
(when (string= org-state "DONE")
|
(when (string= org-state "DONE")
|
||||||
(my/org-metric-prompt-engine
|
(gortium/org-metric-prompt-engine
|
||||||
:state "DONE"
|
:state "DONE"
|
||||||
:tag "SERVICE"
|
:tag "SERVICE"
|
||||||
:prop-parent-metric "LAST_KM"
|
:prop-parent-metric "LAST_KM"
|
||||||
:prop-task-done "LAST_DONE_KM"
|
:prop-task-done "LAST_DONE_KM"
|
||||||
:label-prompt "Current Odometer"))
|
:label-prompt "Current Odometer"))
|
||||||
(error (message "Handler suppressed error: %s" (error-message-string err)))))
|
(error (message "Handler suppressed error: %s" (error-message-string err)))))
|
||||||
)
|
|
||||||
;; (my/org-metric-prompt-engine
|
;; (gortium/org-metric-prompt-engine
|
||||||
;; :state org-state :tag "MAINTENANCE" :prop-parent-metric "LAST_HOURS"
|
;; :state org-state :tag "MAINTENANCE" :prop-parent-metric "LAST_HOURS"
|
||||||
;; :prop-task-done "LAST_DONE_HOURS" :label-prompt "Equipment Hours"))
|
;; :prop-task-done "LAST_DONE_HOURS" :label-prompt "Equipment Hours"))
|
||||||
|
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
;; 3. THE HOOKS
|
;; 3. THE HOOKS
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
(add-hook 'org-after-prop-change-hook #'my/org-property-change-handler)
|
(add-hook 'org-after-prop-change-hook #'gortium/org-property-change-handler)
|
||||||
(add-hook 'org-after-todo-state-change-hook #'my/org-todo-state-handler)
|
(add-hook 'org-after-todo-state-change-hook #'gortium/org-todo-state-handler)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Rescheduling task later
|
** Rescheduling task later
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun my/org-smart-advance-date ()
|
(defun gortium/org-smart-advance-date ()
|
||||||
"Jump to next repeater occurrence or add 1 day.
|
"Jump to next repeater occurrence or add 1 day.
|
||||||
Suppresses all logging, notes, and custom odometer hooks."
|
Suppresses all logging, notes, and custom odometer hooks."
|
||||||
(interactive)
|
(interactive)
|
||||||
@@ -3519,9 +3517,9 @@ Suppresses all logging, notes, and custom odometer hooks."
|
|||||||
|
|
||||||
(map! :after org
|
(map! :after org
|
||||||
(:map org-mode-map
|
(:map org-mode-map
|
||||||
:localleader "L" #'my/org-smart-advance-date)
|
:localleader "L" #'gortium/org-smart-advance-date)
|
||||||
(:map org-agenda-mode-map
|
(:map org-agenda-mode-map
|
||||||
:localleader "L" #'my/org-smart-advance-date))
|
:localleader "L" #'gortium/org-smart-advance-date))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Open link in other frame
|
** Open link in other frame
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
(setq fancy-splash-image (expand-file-name "hermes_logo_ascii.png" doom-user-dir))
|
(setq fancy-splash-image (expand-file-name "hermes_logo_ascii.png" doom-user-dir))
|
||||||
|
|
||||||
;; 2. Define the quote function
|
;; 2. Define the quote function
|
||||||
(defun my-dashboard-quote ()
|
(defun gortium/dashboard-quote ()
|
||||||
(insert "\n" (+dashboard--center +dashboard--width "Simplicity is the ultimate sophistication.") "\n"))
|
(insert "\n" (+dashboard--center +dashboard--width "Simplicity is the ultimate sophistication.") "\n"))
|
||||||
|
|
||||||
;; 3. Override the functions list using the correct variable from the docs
|
;; 3. Override the functions list using the correct variable from the docs
|
||||||
(after! doom-dashboard
|
(after! doom-dashboard
|
||||||
(setq +dashboard-functions
|
(setq +dashboard-functions
|
||||||
'(+dashboard-widget-banner
|
'(+dashboard-widget-banner
|
||||||
my-dashboard-quote
|
gortium/dashboard-quote
|
||||||
+dashboard-widget-loaded
|
+dashboard-widget-loaded
|
||||||
+dashboard-widget-shortmenu
|
+dashboard-widget-shortmenu
|
||||||
+dashboard-widget-footer)))
|
+dashboard-widget-footer)))
|
||||||
@@ -1906,7 +1906,7 @@ only injects when the project's context-tag matches current mu4e context."
|
|||||||
(rx (or (: "http" (? "s") "://" (* nonl) "youtube.com" (* nonl))
|
(rx (or (: "http" (? "s") "://" (* nonl) "youtube.com" (* nonl))
|
||||||
(: "http" (? "s") "://" (* nonl) "youtu.be" (* nonl))))))
|
(: "http" (? "s") "://" (* nonl) "youtu.be" (* nonl))))))
|
||||||
|
|
||||||
(defun my-elfeed-tube-add-to-emms ()
|
(defun gortium/elfeed-tube-add-to-emms ()
|
||||||
"Add the currently selected Elfeed video(s) to the EMMS playlist."
|
"Add the currently selected Elfeed video(s) to the EMMS playlist."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((entries (if (eq major-mode 'elfeed-show-mode)
|
(let ((entries (if (eq major-mode 'elfeed-show-mode)
|
||||||
@@ -1922,10 +1922,10 @@ only injects when the project's context-tag matches current mu4e context."
|
|||||||
|
|
||||||
;; Bind the function to 'e' in both elfeed views
|
;; Bind the function to 'e' in both elfeed views
|
||||||
(map! :map elfeed-search-mode-map
|
(map! :map elfeed-search-mode-map
|
||||||
:n "e" #'my-elfeed-tube-add-to-emms)
|
:n "e" #'gortium/elfeed-tube-add-to-emms)
|
||||||
|
|
||||||
(map! :map elfeed-show-mode-map
|
(map! :map elfeed-show-mode-map
|
||||||
:n "e" #'my-elfeed-tube-add-to-emms)
|
:n "e" #'gortium/elfeed-tube-add-to-emms)
|
||||||
|
|
||||||
(use-package! eaf
|
(use-package! eaf
|
||||||
:load-path "~/.config/emacs/.local/straight/repos/emacs-application-framework"
|
:load-path "~/.config/emacs/.local/straight/repos/emacs-application-framework"
|
||||||
@@ -2478,7 +2478,7 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
;; 1. THE REUSABLE ENGINE (Domain Agnostic)
|
;; 1. THE REUSABLE ENGINE (Domain Agnostic)
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
(defun my/org-metric-sync-engine (&key prop-name value-current prop-last-done prop-interval target-tag log-label)
|
(defun gortium/org-metric-sync-engine (&key prop-name value-current prop-last-done prop-interval target-tag log-label)
|
||||||
"Core logic to sync parent metrics to sub-tasks and log changes.
|
"Core logic to sync parent metrics to sub-tasks and log changes.
|
||||||
PROP-NAME: The property triggering the change (e.g., LAST_KM).
|
PROP-NAME: The property triggering the change (e.g., LAST_KM).
|
||||||
VALUE-CURRENT: The new value being set.
|
VALUE-CURRENT: The new value being set.
|
||||||
@@ -2489,7 +2489,7 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
(save-excursion
|
(save-excursion
|
||||||
;; A. Log the update to the Logbook with a timestamp
|
;; A. Log the update to the Logbook with a timestamp
|
||||||
(when log-label
|
(when log-label
|
||||||
(org-add-log-setup 'note (format "%s: %s" log-label value-current) nil 'findpos))
|
(org-add-note (format "%s: %s" log-label value-current)))
|
||||||
|
|
||||||
;; B. Narrow scope to current header and scan sub-tasks
|
;; B. Narrow scope to current header and scan sub-tasks
|
||||||
(org-narrow-to-subtree)
|
(org-narrow-to-subtree)
|
||||||
@@ -2506,7 +2506,7 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
target-tag)
|
target-tag)
|
||||||
(widen)))
|
(widen)))
|
||||||
|
|
||||||
(defun my/org-metric-prompt-engine (&key state tag prop-parent-metric prop-task-done label-prompt)
|
(defun gortium/org-metric-prompt-engine (&key state tag prop-parent-metric prop-task-done label-prompt)
|
||||||
"Core logic to prompt for values when a task is marked DONE.
|
"Core logic to prompt for values when a task is marked DONE.
|
||||||
STATE: The new TODO state (e.g., DONE).
|
STATE: The new TODO state (e.g., DONE).
|
||||||
TAG: The tag identifying relevant tasks.
|
TAG: The tag identifying relevant tasks.
|
||||||
@@ -2532,45 +2532,45 @@ and ensure the standard property drawer exists without overwriting existing data
|
|||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
;; 2. THE DISPATCHERS (The Switchboard)
|
;; 2. THE DISPATCHERS (The Switchboard)
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
(defun my/org-property-change-handler (prop value)
|
(defun gortium/org-property-change-handler (prop value)
|
||||||
"Routes property changes to the correct sync parameters."
|
"Routes property changes to the correct sync parameters."
|
||||||
(cond
|
(cond
|
||||||
;; Case: F-150 Odometer
|
;; Case: F-150 Odometer
|
||||||
((string= prop "LAST_KM")
|
((string= prop "LAST_KM")
|
||||||
(my/org-metric-sync-engine
|
(gortium/org-metric-sync-engine
|
||||||
:prop-name prop :value-current value :prop-last-done "LAST_DONE_KM"
|
:prop-name prop :value-current value :prop-last-done "LAST_DONE_KM"
|
||||||
:prop-interval "INTERVAL_KM" :target-tag "SERVICE" :log-label "Odometer Update"))))
|
:prop-interval "INTERVAL_KM" :target-tag "SERVICE" :log-label "Odometer Update")))))
|
||||||
|
|
||||||
;; Case: Equipment/Industrial Hours
|
;; Case: Equipment/Industrial Hours
|
||||||
;; ((string= prop "LAST_HOURS")
|
;; ((string= prop "LAST_HOURS")
|
||||||
;; (my/org-metric-sync-engine
|
;; (gortium/org-metric-sync-engine
|
||||||
;; :prop-name prop :value-current value :prop-last-done "LAST_DONE_HOURS"
|
;; :prop-name prop :value-current value :prop-last-done "LAST_DONE_HOURS"
|
||||||
;; :prop-interval "INTERVAL_HOURS" :target-tag "MAINTENANCE" :log-label "Usage Hours Logged"))))
|
;; :prop-interval "INTERVAL_HOURS" :target-tag "MAINTENANCE" :log-label "Usage Hours Logged"))))
|
||||||
|
|
||||||
(defun my/org-todo-state-handler ()
|
(defun gortium/org-todo-state-handler ()
|
||||||
"Safely routes DONE completions, catching any argument errors."
|
"Safely routes DONE completions, catching any argument errors."
|
||||||
(interactive)
|
(interactive)
|
||||||
(condition-case err
|
(condition-case err
|
||||||
(when (string= org-state "DONE")
|
(when (string= org-state "DONE")
|
||||||
(my/org-metric-prompt-engine
|
(gortium/org-metric-prompt-engine
|
||||||
:state "DONE"
|
:state "DONE"
|
||||||
:tag "SERVICE"
|
:tag "SERVICE"
|
||||||
:prop-parent-metric "LAST_KM"
|
:prop-parent-metric "LAST_KM"
|
||||||
:prop-task-done "LAST_DONE_KM"
|
:prop-task-done "LAST_DONE_KM"
|
||||||
:label-prompt "Current Odometer"))
|
:label-prompt "Current Odometer"))
|
||||||
(error (message "Handler suppressed error: %s" (error-message-string err)))))
|
(error (message "Handler suppressed error: %s" (error-message-string err)))))
|
||||||
)
|
|
||||||
;; (my/org-metric-prompt-engine
|
;; (gortium/org-metric-prompt-engine
|
||||||
;; :state org-state :tag "MAINTENANCE" :prop-parent-metric "LAST_HOURS"
|
;; :state org-state :tag "MAINTENANCE" :prop-parent-metric "LAST_HOURS"
|
||||||
;; :prop-task-done "LAST_DONE_HOURS" :label-prompt "Equipment Hours"))
|
;; :prop-task-done "LAST_DONE_HOURS" :label-prompt "Equipment Hours"))
|
||||||
|
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
;; 3. THE HOOKS
|
;; 3. THE HOOKS
|
||||||
;; ---------------------------------------------------------
|
;; ---------------------------------------------------------
|
||||||
(add-hook 'org-after-prop-change-hook #'my/org-property-change-handler)
|
(add-hook 'org-after-prop-change-hook #'gortium/org-property-change-handler)
|
||||||
(add-hook 'org-after-todo-state-change-hook #'my/org-todo-state-handler)
|
(add-hook 'org-after-todo-state-change-hook #'gortium/org-todo-state-handler)
|
||||||
|
|
||||||
(defun my/org-smart-advance-date ()
|
(defun gortium/org-smart-advance-date ()
|
||||||
"Jump to next repeater occurrence or add 1 day.
|
"Jump to next repeater occurrence or add 1 day.
|
||||||
Suppresses all logging, notes, and custom odometer hooks."
|
Suppresses all logging, notes, and custom odometer hooks."
|
||||||
(interactive)
|
(interactive)
|
||||||
@@ -2602,9 +2602,9 @@ Suppresses all logging, notes, and custom odometer hooks."
|
|||||||
|
|
||||||
(map! :after org
|
(map! :after org
|
||||||
(:map org-mode-map
|
(:map org-mode-map
|
||||||
:localleader "L" #'my/org-smart-advance-date)
|
:localleader "L" #'gortium/org-smart-advance-date)
|
||||||
(:map org-agenda-mode-map
|
(:map org-agenda-mode-map
|
||||||
:localleader "L" #'my/org-smart-advance-date))
|
:localleader "L" #'gortium/org-smart-advance-date))
|
||||||
|
|
||||||
;; Open link in another frame
|
;; Open link in another frame
|
||||||
(defun gortium/org-open-link-in-other-frame ()
|
(defun gortium/org-open-link-in-other-frame ()
|
||||||
|
|||||||
Reference in New Issue
Block a user