summaryrefslogtreecommitdiff
path: root/emacs-init.org
diff options
context:
space:
mode:
authorfpi2020-09-27 12:12:26 +0200
committerfpi2022-03-17 14:44:37 +0100
commit6c8c25aa4cd015d763ab892be8c0635035b650f6 (patch)
tree8f5862ae347a04d982e9a3a26a5ffc564deaaaed /emacs-init.org
parentRemove READLIST, WATCH tags in favor of read, watch (diff)
Add function to clock in on a refile target
Diffstat (limited to 'emacs-init.org')
-rw-r--r--emacs-init.org14
1 files changed, 14 insertions, 0 deletions
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