From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: [PATCH] C-3 C-c C-w to copy the subtree instead of moving it Date: Fri, 05 Jul 2013 14:45:43 +0200 Message-ID: <87siztfa4o.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uv5Oj-0004xj-39 for emacs-orgmode@gnu.org; Fri, 05 Jul 2013 08:46:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uv5Oh-0007LA-2r for emacs-orgmode@gnu.org; Fri, 05 Jul 2013 08:46:01 -0400 Received: from plane.gmane.org ([80.91.229.3]:39413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uv5Og-0007KQ-Pm for emacs-orgmode@gnu.org; Fri, 05 Jul 2013 08:45:58 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uv5Od-0003FW-SY for emacs-orgmode@gnu.org; Fri, 05 Jul 2013 14:45:55 +0200 Received: from vol75-5-82-226-35-66.fbx.proxad.net ([82.226.35.66]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Jul 2013 14:45:55 +0200 Received: from bzg by vol75-5-82-226-35-66.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Jul 2013 14:45:55 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain When taking notes in a meeting, I often need to refile a subtree by copying it (so that it stays in the meeting's notes.) For now you can do this by setting (setq org-refile-keep t) but having this on a temporary basis is nice. This patch does this. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org.el-org-refile-allow-to-only-copy-the-subtree-wit.patch >From d35926a24d3741453d9ee2bc837ec540cccfae09 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 5 Jul 2013 13:47:28 +0200 Subject: [PATCH] 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. --- lisp/org.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 7ba78f5..5a386a0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11485,7 +11485,11 @@ 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. RFLOC can be a refile location obtained in a different way. @@ -11508,6 +11512,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 @@ -11566,7 +11571,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) -- 1.8.2.2 --=-=-= Content-Type: text/plain -- Bastien --=-=-=--