Browse Source

Make `C-2 C-c C-w' refile to the current clock

Carsten Dominik 15 years ago
parent
commit
0b156b94a7
3 changed files with 20 additions and 5 deletions
  1. 2 0
      doc/org.texi
  2. 3 0
      lisp/ChangeLog
  3. 15 5
      lisp/org.el

+ 2 - 0
doc/org.texi

@@ -6151,6 +6151,8 @@ Use the refile interface to jump to a heading.
 @kindex C-u C-u C-c C-w
 @item C-u C-u C-c C-w
 Jump to the location where @code{org-refile} last moved a tree to.
+@item C-2 C-c C-w
+Refile as the child of the tiem currently being clocked.
 @end table
 
 @node Archiving,  , Refiling notes, Capture - Refile - Archive

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-11-03  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-refile): Make prefix argument 2 refile to current
+	clock.
+
 	* org-remember.el (org-remember-apply-template): Don't depend on
 	buffer name being like file name.
 

+ 15 - 5
lisp/org.el

@@ -8866,6 +8866,7 @@ With prefix arg GOTO, the command will only visit the target location,
 not actually move anything.
 With a double prefix `C-u C-u', go to the location where the last refiling
 operation has put the subtree.
+With a prefix argument of `2', refile to the running clock.
 
 RFLOC can be a refile location obtained in a different way.
 
@@ -8887,11 +8888,20 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
 	(error "The region is not a (sequence of) subtree(s)")))
     (if (equal goto '(16))
 	(org-refile-goto-last-stored)
-      (when (setq it (or rfloc
-			 (save-excursion
-			   (org-refile-get-location
-			    (if goto "Goto: " "Refile to: ") default-buffer
-			    org-refile-allow-creating-parent-nodes))))
+      (when (or
+	     (and org-clock-hd-marker (marker-buffer org-clock-hd-marker)
+		  (prog1
+		      (setq it (list (or org-clock-heading "running clock")
+				     (buffer-file-name
+				      (marker-buffer org-clock-hd-marker))
+				     ""
+				     (marker-position org-clock-hd-marker)))
+		    (setq goto nil)))
+	     (setq it (or rfloc
+			  (save-excursion
+			    (org-refile-get-location
+			     (if goto "Goto: " "Refile to: ") default-buffer
+			     org-refile-allow-creating-parent-nodes)))))
 	(setq file (nth 1 it)
 	      re (nth 2 it)
 	      pos (nth 3 it))