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 <accounts@v0.io>
This commit is contained in:
Rick Lupton 2021-03-03 04:48:42 +00:00 committed by GitHub
parent 9a5f860cd0
commit 468f308114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,7 @@
(list current-prefix-arg (list current-prefix-arg
(read-file-name "Select file to refile to: " (read-file-name "Select file to refile to: "
default-directory default-directory
buffer-file-name (buffer-file-name (buffer-base-buffer))
t nil t nil
(lambda (f) (string-match-p "\\.org$" f))))) (lambda (f) (string-match-p "\\.org$" f)))))
(+org/refile-to-current-file arg file)) (+org/refile-to-current-file arg file))
@ -33,10 +33,11 @@
current-prefix-arg) current-prefix-arg)
(dolist (win (delq (selected-window) (window-list))) (dolist (win (delq (selected-window) (window-list)))
(with-selected-window win (with-selected-window win
(and (eq major-mode 'org-mode) (let ((file (buffer-file-name (buffer-base-buffer))))
buffer-file-name (and (eq major-mode 'org-mode)
(cl-pushnew (cons buffer-file-name (cons :maxlevel 10)) file
org-refile-targets)))) (cl-pushnew (cons file (cons :maxlevel 10))
org-refile-targets)))))
(call-interactively #'org-refile))) (call-interactively #'org-refile)))
;;;###autoload ;;;###autoload
@ -47,10 +48,9 @@
org-refile-targets org-refile-targets
current-prefix-arg) current-prefix-arg)
(dolist (buf (delq (current-buffer) (doom-buffers-in-mode 'org-mode))) (dolist (buf (delq (current-buffer) (doom-buffers-in-mode 'org-mode)))
(with-current-buffer buf (when-let (file (buffer-file-name (buffer-base-buffer buf)))
(and buffer-file-name (cl-pushnew (cons file (cons :maxlevel 10))
(cl-pushnew (cons buffer-file-name (cons :maxlevel 10)) org-refile-targets)))
org-refile-targets))))
(call-interactively #'org-refile))) (call-interactively #'org-refile)))
;;;###autoload ;;;###autoload