From 0728025585df3f6ca4807bf10785cccb59b42ff6 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 5 Aug 2009 12:08:42 +0200 Subject: [PATCH] Refile: Fix horrible bug This bug would make refiling complain about the tree not being a tree unless the *previous* content of the tree was a tree. Pretty bad.... --- lisp/ChangeLog | 5 +++++ lisp/org.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e25920a58..ff5b56ebe 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-08-05 Carsten Dominik + + * org.el (org-paste-subtree): Test the kill ring entry if it is + going to be used. + 2009-08-04 Carsten Dominik * org.el (org-table-map-tables): Make sure cursor is back at table diff --git a/lisp/org.el b/lisp/org.el index d971f7d1e..5cd53ddf2 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6184,12 +6184,13 @@ When FOR-YANK is set, this is called by `org-yank'. In this case, do not move back over whitespace before inserting, and move point to the end of the inserted text when done." (interactive "P") + (setq tree (or tree (and kill-ring (current-kill 0)))) (unless (org-kill-is-subtree-p tree) (error "%s" (substitute-command-keys "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway"))) (let* ((visp (not (org-invisible-p))) - (txt (or tree (and kill-ring (current-kill 0)))) + (txt tree) (^re (concat "^\\(" outline-regexp "\\)")) (re (concat "\\(" outline-regexp "\\)")) (^re_ (concat "\\(\\*+\\)[ \t]*"))