summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-07-05 13:47:28 +0200
committerBastien Guerry <bzg@altern.org>2013-07-08 10:19:03 +0200
commitfdaa996e90b20ff7a052736d2d7bda5140cbb861 (patch)
tree06cfe7ea81cae2290a689ed2370dd2e688e59ddb
parent7f9995074997d32a00fa32ca5d1e5ce082d3b721 (diff)
downloadorg-mode-fdaa996e90b20ff7a052736d2d7bda5140cbb861.tar.gz
org.el (org-refile): Allow to only copy the subtree without moving it
* org.el (org-refile): With a numeric prefix argument of `3', emulate (setq org-refile-keep t) and copy the subtree to the target location, don't delete it. * org.texi (Refile and copy): Document `C-3 C-c C-w' and add an index entry for `org-refile-keep'.
-rw-r--r--doc/org.texi5
-rw-r--r--lisp/org.el11
2 files changed, 14 insertions, 2 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 5eb7cfa..edaf096 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -7383,6 +7383,7 @@ Copying works like refiling, except that the original note is not deleted.
@vindex org-refile-allow-creating-parent-nodes
@vindex org-log-refile
@vindex org-refile-use-cache
+@vindex org-refile-keep
Refile the entry or region at point. This command offers possible locations
for refiling the entry and lets you select one with completion. The item (or
all items in the region) is filed below the target heading as a subitem.
@@ -7406,6 +7407,10 @@ Use the refile interface to jump to a heading.
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 item currently being clocked.
+@item C-3 C-c C-w
+Refile and keep the entry in place. Also see @code{org-refile-keep} to make
+this the default behavior, and beware that this may result in duplicated
+@code{ID} properties.
@orgcmdtkc{C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w,C-0 C-c C-w,org-refile-cache-clear}
Clear the target cache. Caching of refile targets can be turned on by
setting @code{org-refile-use-cache}. To make the command see new possible
diff --git a/lisp/org.el b/lisp/org.el
index 4f5af5a..a9eea36 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11493,7 +11493,13 @@ and not actually move anything.
With a double prefix arg \\[universal-argument] \\[universal-argument], \
go to the location where the last refiling operation has put the subtree.
-With a prefix argument of `2', refile to the running clock.
+
+With a numeric prefix argument of `2', refile to the running clock.
+
+With a numeric prefix argument of `3', emulate `org-refile-keep'
+being set to `t' and copy to the target location, don't move it.
+Beware that keeping refiled entries may result in duplicated ID
+properties.
RFLOC can be a refile location obtained in a different way.
@@ -11516,6 +11522,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(region-start (and regionp (region-beginning)))
(region-end (and regionp (region-end)))
(filename (buffer-file-name (buffer-base-buffer cbuf)))
+ (org-refile-keep (if (equal goto 3) t org-refile-keep))
pos it nbuf file re level reversed)
(setq last-command nil)
(when regionp
@@ -11574,7 +11581,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(setq nbuf (or (find-buffer-visiting file)
(find-file-noselect file)))
- (if goto
+ (if (and goto (not (equal goto 3)))
(progn
(org-pop-to-buffer-same-window nbuf)
(goto-char pos)