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'.
This commit is contained in:
Bastien Guerry 2013-07-05 13:47:28 +02:00
parent 7f99950749
commit fdaa996e90
2 changed files with 14 additions and 2 deletions

View file

@ -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

View file

@ -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)