From e967f717948a37d9fd8066a5268a9bec77a31b42 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 16 Dec 2008 10:16:16 +0100 Subject: [PATCH] Avoid refining of entries into themselves. Reported by Samuel Wales. --- lisp/ChangeLog | 3 +++ lisp/org.el | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e81904295..59911b35f 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2008-12-16 Carsten Dominik + * org.el (org-refile): Avoid refiling to within the region to be + refiled. + * org-export-latex.el (org-export-latex-special-chars): Replace special characters also in tables. diff --git a/lisp/org.el b/lisp/org.el index 43928ce3a..1460f861d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7598,6 +7598,15 @@ operation has put the subtree." (setq file (nth 1 it) re (nth 2 it) pos (nth 3 it)) + (if (and (equal (buffer-file-name) file) + (if regionp + (and (>= pos region-start) + (<= pos region-end)) + (and (>= pos (point)) + (< pos (save-excursion + (org-end-of-subtree t t)))))) + (error "Cannot refile to position inside the tree or region")) + (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file))) (if goto