diff options
| author | Raúl Benencia <id@rbenencia.name> | 2026-01-09 08:47:51 -0300 |
|---|---|---|
| committer | Raúl Benencia <id@rbenencia.name> | 2026-01-09 08:47:51 -0300 |
| commit | 142c8a5275078931cddc886495cceb002281573b (patch) | |
| tree | 03e6680a40a9e7b45e47bcd2735635cff0ffb824 | |
| parent | 6e612bd64a2a8e6470a84e4dcdb639be9b953d55 (diff) | |
fix: reorganize code to avoid free variables
| -rw-r--r-- | org-tempus.el | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/org-tempus.el b/org-tempus.el index 7ee267f..edcbdf3 100644 --- a/org-tempus.el +++ b/org-tempus.el @@ -100,6 +100,9 @@ Debug logs are appended to the *Org-Tempus-Debug* buffer." (defvar org-tempus--last-dconf-value nil "Last string posted to dconf, to avoid redundant updates.") +(defvar org-tempus--notification-state nil + "Plist storing notification state for notifications.") + (declare-function notifications-notify "notifications" (&rest args)) (defun org-tempus--debug (format-string &rest args) @@ -117,19 +120,6 @@ FORMAT-STRING and ARGS follow `format'." (min (point-max) (- (buffer-size) max-bytes)))))))) -(defun org-tempus--notification-status-string () - "Return a debug string with notification rate-limit status." - (let* ((state org-tempus--notification-state) - (count (or (plist-get state :count) 0)) - (last (plist-get state :last-time)) - (cooldown org-tempus-notification-cooldown-seconds) - (since (and last (float-time (time-subtract (current-time) last))))) - (format "count %s/%s, cooldown %ss, since %s" - count - org-tempus-notification-max-count - cooldown - (if since (format "%.1fs" since) "n/a")))) - (defcustom org-tempus-dconf-path nil "When non-nil, post the Org Tempus mode line string to this dconf path. The value is a string like: @@ -188,6 +178,19 @@ When nil, start session tracking on clock-in." :type 'integer :group 'org-tempus) +(defun org-tempus--notification-status-string () + "Return a debug string with notification rate-limit status." + (let* ((state org-tempus--notification-state) + (count (or (plist-get state :count) 0)) + (last (plist-get state :last-time)) + (cooldown org-tempus-notification-cooldown-seconds) + (since (and last (float-time (time-subtract (current-time) last))))) + (format "count %s/%s, cooldown %ss, since %s" + count + org-tempus-notification-max-count + cooldown + (if since (format "%.1fs" since) "n/a")))) + (defun org-tempus--stop-timers () "Stop Org Tempus timers." (when (timerp org-tempus--timer) @@ -345,9 +348,6 @@ Known providers are `emacs' (activity inside Emacs), (defvar org-tempus--session-start-time nil "Internal session start time as a value returned by `current-time'.") -(defvar org-tempus--notification-state nil - "Plist storing notification state for notifications.") - (defvar org-tempus--total-threshold-notified-date nil "Date string of last total threshold notification.") |
