summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-07-01 01:16:38 +0200
committerBastien Guerry <bzg@altern.org>2013-07-01 01:16:38 +0200
commit5381ebd910e417571d0ce684f101c73132eb0fb8 (patch)
tree78254a0accdfbf047d9250c3ffa1ec28b7cbb223
parente3195550fc0e057124bbb9e35eb8adb96a6b0d48 (diff)
downloadorg-mode-5381ebd910e417571d0ce684f101c73132eb0fb8.tar.gz
org.el (org-refile): Fix refiling the active region within an list
* org.el (org-refile): Fix refiling the active region within an list. Thanks to Jeff Horn and Samuel Wales.
-rw-r--r--lisp/org.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el
index a876979..4266e27 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11471,7 +11471,6 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(regionp (org-region-active-p))
(region-start (and regionp (region-beginning)))
(region-end (and regionp (region-end)))
- (region-length (and regionp (- region-end region-start)))
(filename (buffer-file-name (buffer-base-buffer cbuf)))
pos it nbuf file re level reversed)
(setq last-command nil)
@@ -11482,7 +11481,9 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(unless (or (org-kill-is-subtree-p
(buffer-substring region-start region-end))
(prog1 org-refile-active-region-within-subtree
- (org-toggle-heading)))
+ (let ((s (point-at-eol)))
+ (org-toggle-heading)
+ (setq region-end (+ (- (point-at-eol) s) region-end)))))
(user-error "The region is not a (sequence of) subtree(s)")))
(if (equal goto '(16))
(org-refile-goto-last-stored)
@@ -11564,8 +11565,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(if (not (bolp)) (newline))
(org-paste-subtree level)
(when org-log-refile
- (org-add-log-setup 'refile nil nil 'findpos
- org-log-refile)
+ (org-add-log-setup 'refile nil nil 'findpos org-log-refile)
(unless (eq org-log-refile 'note)
(save-excursion (org-add-log-note))))
(and org-auto-align-tags
@@ -11583,7 +11583,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(run-hooks 'org-after-refile-insert-hook))))
(unless org-refile-keep
(if regionp
- (delete-region (point) (+ (point) region-length))
+ (delete-region (point) (+ (point) (- region-end region-start)))
(delete-region
(point-at-bol)
(min (buffer-size) (1+ (org-end-of-subtree t))))))