* lisp/org.el: (org-refile) Don't call org-back-to-heading with goto argument. This fixes an error that results when calling org-refile with the GOTO argument in a non-org buffer.
@@ -10487,7 +10487,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(setq goto nil)))
(setq it (or rfloc
(save-excursion
- (org-back-to-heading t)
+ (unless goto (org-back-to-heading t))
(org-refile-get-location
(cond (goto "Goto")
(regionp "Refile region to")