From 468f3081146b863d421c1a51547b2cbf29c7f6ac Mon Sep 17 00:00:00 2001 From: Rick Lupton Date: Wed, 3 Mar 2021 04:48:42 +0000 Subject: [PATCH] Fix +org/refile-to-other-window in indirect buffer (#4721) * Fix +org/refile-to-other-window in indirect buffer * Extend fix to other refile commands Co-authored-by: Henrik Lissner --- modules/lang/org/autoload/org-refile.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/lang/org/autoload/org-refile.el b/modules/lang/org/autoload/org-refile.el index a9ac3aaf9..c54483fe7 100644 --- a/modules/lang/org/autoload/org-refile.el +++ b/modules/lang/org/autoload/org-refile.el @@ -19,7 +19,7 @@ (list current-prefix-arg (read-file-name "Select file to refile to: " default-directory - buffer-file-name + (buffer-file-name (buffer-base-buffer)) t nil (lambda (f) (string-match-p "\\.org$" f))))) (+org/refile-to-current-file arg file)) @@ -33,10 +33,11 @@ current-prefix-arg) (dolist (win (delq (selected-window) (window-list))) (with-selected-window win - (and (eq major-mode 'org-mode) - buffer-file-name - (cl-pushnew (cons buffer-file-name (cons :maxlevel 10)) - org-refile-targets)))) + (let ((file (buffer-file-name (buffer-base-buffer)))) + (and (eq major-mode 'org-mode) + file + (cl-pushnew (cons file (cons :maxlevel 10)) + org-refile-targets))))) (call-interactively #'org-refile))) ;;;###autoload @@ -47,10 +48,9 @@ org-refile-targets current-prefix-arg) (dolist (buf (delq (current-buffer) (doom-buffers-in-mode 'org-mode))) - (with-current-buffer buf - (and buffer-file-name - (cl-pushnew (cons buffer-file-name (cons :maxlevel 10)) - org-refile-targets)))) + (when-let (file (buffer-file-name (buffer-base-buffer buf))) + (cl-pushnew (cons file (cons :maxlevel 10)) + org-refile-targets))) (call-interactively #'org-refile))) ;;;###autoload