0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-16 15:16:26 +00:00

org-refile-get-targets: Barf when target is not an Org buffer

* lisp/org-refile.el (org-refile-get-targets): Display error when
target buffer is not in Org mode.  If we do not manually throw an
error, local variables like `org-complex-heading-regexp' will not be
defined, and the user would see a lot more cryptic error.
This commit is contained in:
Ihor Radchenko 2023-08-15 13:54:00 +03:00
parent dcd2ba4a02
commit 1d04af59b6
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -307,6 +307,8 @@ converted to a headline before refiling."
(t (error "Bad refiling target description %s" desc)))
(dolist (f files)
(with-current-buffer (if (bufferp f) f (org-get-agenda-file-buffer f))
(unless (derived-mode-p 'org-mode)
(error "Major mode in refile target buffer \"%s\" must be `org-mode'" f))
(or
(setq tgs (org-refile-cache-get (buffer-file-name) descre))
(progn