Browse Source

Make cloning entries work at the end of the buffer

David Maus writes:

> By accident I noticed that if you clone a subtree using C-c C-x c who
> or whose content is the last line of the file orgmode inserts the
> clone without the desired newline.
>
> example.org
> ,----
> | * Just a test
> `----
>
> If you move the point behind test and press C-c C-x c 1 <RET> <RET>
> the clone is inserted right behind "test".
>
> example.org
> ,----
> | * Just a test*Just a test
> `----
>
> Instead orgmode should insert a newline before inserting the clone
> when the file misses an empty line at the end.
Carsten Dominik 15 years ago
parent
commit
eea7bf8d3f
2 changed files with 4 additions and 0 deletions
  1. 3 0
      lisp/ChangeLog
  2. 1 0
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-11-12  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-clone-subtree-with-time-shift): Make it work at the
+	end of the buffer.
+
 	* org-mobile.el (org-mobile-write-checksums): Specify coding
 	system.
 	(org-mobile-timestamp-buffer): Keep local variable/mode line at

+ 1 - 0
lisp/org.el

@@ -6735,6 +6735,7 @@ and still retain the repeater to cover future instances of the task."
     (org-back-to-heading t)
     (setq beg (point))
     (org-end-of-subtree t t)
+    (or (bolp) (insert "\n"))
     (setq end (point))
     (setq template (buffer-substring beg end))
     (when (and doshift