Browse Source

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....
Carsten Dominik 16 years ago
parent
commit
0728025585
2 changed files with 7 additions and 1 deletions
  1. 5 0
      lisp/ChangeLog
  2. 2 1
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-08-05  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-paste-subtree): Test the kill ring entry if it is
+	going to be used.
+
 2009-08-04  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-08-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org.el (org-table-map-tables): Make sure cursor is back at table
 	* org.el (org-table-map-tables): Make sure cursor is back at table

+ 2 - 1
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
 move back over whitespace before inserting, and move point to the end of
 the inserted text when done."
 the inserted text when done."
   (interactive "P")
   (interactive "P")
+  (setq tree (or tree (and kill-ring (current-kill 0))))
   (unless (org-kill-is-subtree-p tree)
   (unless (org-kill-is-subtree-p tree)
     (error "%s"
     (error "%s"
      (substitute-command-keys
      (substitute-command-keys
       "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway")))
       "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway")))
   (let* ((visp (not (org-invisible-p)))
   (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 "\\(" outline-regexp "\\)"))
 	 (re  (concat "\\(" outline-regexp "\\)"))
 	 (^re_ (concat "\\(\\*+\\)[  \t]*"))
 	 (^re_ (concat "\\(\\*+\\)[  \t]*"))