From 6c8c25aa4cd015d763ab892be8c0635035b650f6 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 27 Sep 2020 12:12:26 +0200 Subject: Add function to clock in on a refile target --- emacs-init.org | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'emacs-init.org') diff --git a/emacs-init.org b/emacs-init.org index e74a26b..1a8fb06 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3500,6 +3500,20 @@ Use imagemagick and standalone class for latex preview. (org-clock-persistence-insinuate) ) #+end_src +Even with the history clocking into the correct item is sometimes difficult. So why not clock in any refile target: +#+begin_src emacs-lisp +(defun fpi/org-clock-in-heading (&optional prompt) + (interactive) + (let* ((location (org-refile-get-location (or prompt "Clock in on"))) + (file (cadr location)) + (marker (car (last location)))) + (save-excursion + (save-restriction + (find-file file) + (goto-char marker) + (org-clock-in) + (current-buffer))))) +#+end_src **** Durations #+begin_src emacs-lisp (use-package org-duration -- cgit v1.2.3