Avoid refining of entries into themselves.

Reported by Samuel Wales.
This commit is contained in:
Carsten Dominik 2008-12-16 10:16:16 +01:00
parent 67a50839e9
commit e967f71794
2 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2008-12-16 Carsten Dominik <carsten.dominik@gmail.com> 2008-12-16 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-refile): Avoid refiling to within the region to be
refiled.
* org-export-latex.el (org-export-latex-special-chars): Replace * org-export-latex.el (org-export-latex-special-chars): Replace
special characters also in tables. special characters also in tables.

View File

@ -7598,6 +7598,15 @@ operation has put the subtree."
(setq file (nth 1 it) (setq file (nth 1 it)
re (nth 2 it) re (nth 2 it)
pos (nth 3 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) (setq nbuf (or (find-buffer-visiting file)
(find-file-noselect file))) (find-file-noselect file)))
(if goto (if goto