From 95f40889905a3ec0973de8d2503eb7391c5bf016 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 30 Mar 2009 17:36:55 +0200 Subject: [PATCH] Bugfix: Swapping the last two subtrees in a file. Rustom Mody writes: > The last two lines of my org file are > > *** Vishnu Sahasranam > *** Ram Navami > > without a newline at the end > > Trying to reorder these two lines I do a M-S-down on second last > line I get > > *** Ram Navami*** Vishnu Sahasranam --- lisp/ChangeLog | 2 ++ lisp/org.el | 1 + 2 files changed, 3 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f697d4f6..71ae90eb9 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * org.el (org-modules): Add org-inlinetasks.el (org-cycle): Implement limiting level on cycling. + (org-move-subtree-down): Fix bug with swapping subtrees at end of + buffer. * org-inlinetask.el: New file. diff --git a/lisp/org.el b/lisp/org.el index 253b22f12..af700f623 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5609,6 +5609,7 @@ is signaled in this case." (delete-region beg end) (or (= beg (point-min)) (outline-flag-region (1- beg) beg nil)) (or (bobp) (outline-flag-region (1- (point)) (point) nil)) + (and (not (bolp)) (looking-at "\n") (forward-char 1)) (let ((bbb (point))) (insert-before-markers txt) (org-reinstall-markers-in-region bbb)