Skip to content

Instantly share code, notes, and snippets.

@rksm
Created February 25, 2020 22:52
Show Gist options
  • Save rksm/f58dc963e2131a18e8d652cac0a2460c to your computer and use it in GitHub Desktop.
Save rksm/f58dc963e2131a18e8d652cac0a2460c to your computer and use it in GitHub Desktop.
Tag org-pomodoro entries
(defvar my/org-pomodoro-analyzer-tag "POMODORO"
"Tag to add to an org entry when org-pomodoro clocks in.")
(defun my/org-pomodoro-analyzer-advice (_)
"If a pomodoro is running we ensure that it has a tag
`my/org-pomodoro-analyzer-tag'."
(when (org-clock-is-active)
(save-window-excursion
(with-current-buffer (org-clock-is-active)
(org-clock-goto)
(org-toggle-tag my/org-pomodoro-analyzer-tag 'on)))))
(defun my/org-pomodoro-analyzer-enable ()
"Enable tagging org-pomodoro entries."
(interactive)
(message "org-pomodoro-analyzer tagging enabled")
(advice-add 'org-pomodoro :after 'my/org-pomodoro-analyzer-advice))
(defun my/org-pomodoro-analyzer-disable ()
"Disable tagging org-pomodoro entries."
(interactive)
(message "org-pomodoro-analyzer tagging disabled")
(advice-remove 'org-pomodoro 'my/org-pomodoro-analyzer-advice))
(use-package org-pomodoro
:ensure
:config
(my/org-pomodoro-analyzer-enable))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment