Skip to content

Instantly share code, notes, and snippets.

@lamdor
Created November 13, 2013 16:51
Show Gist options
  • Save lamdor/7452346 to your computer and use it in GitHub Desktop.
Save lamdor/7452346 to your computer and use it in GitHub Desktop.
(global-set-key (kbd "C-c g j") 'mine-org-clock-goto)
(global-set-key (kbd "C-c g o") 'mine-open-clocked-in-task-link)
(defun mine-org-clock-goto ()
(interactive)
(org-clock-goto (not (org-clocking-p))))
(defun mine-get-clocked-in-task-link (&optional recent)
(if (or recent (org-clocking-p))
(save-excursion
(org-clock-goto recent)
(org-up-heading-all 1)
(let* ((heading-text (cl-fifth (org-heading-components)))
(link (if (string-match "\\[\\[\\(.+?\\)\\]" heading-text)
(match-string 1 heading-text))))
(switch-to-buffer (other-buffer))
link))))
(defun mine-insert-clocked-in-task-link (recent)
(interactive "P")
(let ((current-link (mine-get-clocked-in-task-link recent)))
(if current-link
(insert current-link))))
(defun mine-insert-recent-clocked-in-task-link ()
(interactive)
(mine-insert-clocked-in-task-link t))
(defun mine-open-clocked-in-task-link ()
(interactive)
(browse-url (mine-get-clocked-in-task-link (not (org-clocking-p)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment