emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] org-refile.el: Fix test case


From: satotake
Subject: [PATCH 2/2] org-refile.el: Fix test case
Date: Mon, 10 May 2021 01:02:08 +0900

* lisp/org-refile.el (org-refile-get-targets): Check
`buffer-file-name' return value instead of `buffer-base-buffer'.

To pass the related tests, we need to check `buffer-file-name'.

TINYCHANGE
---
 lisp/org-refile.el | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 6f5b8acee..2900be27e 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -310,13 +310,12 @@ converted to a headline before refiling."
                 (setq f (buffer-file-name (buffer-base-buffer f))))
               (setq f (and f (expand-file-name f)))
               (when (eq org-refile-use-outline-path 'file)
-                (push (list (if f (file-name-nondirectory f) nil) f nil nil) 
tgs))
+                (push (list (and f (file-name-nondirectory f)) f nil nil) tgs))
               (when (eq org-refile-use-outline-path 'buffer-name)
                 (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
               (when (eq org-refile-use-outline-path 'full-file-path)
-                (push (list (if (buffer-base-buffer)
-                                 (file-truename (buffer-file-name 
(buffer-base-buffer)))
-                               nil)
+                (push (list (and (buffer-file-name (buffer-base-buffer))
+                                  (file-truename (buffer-file-name 
(buffer-base-buffer))))
                              f nil nil) tgs))
               (org-with-wide-buffer
                (goto-char (point-min))
@@ -341,10 +340,9 @@ converted to a headline before refiling."
                                (append
                                 (pcase org-refile-use-outline-path
                                   (`file (list
-                                           (if (buffer-base-buffer)
-                                               (file-name-nondirectory
-                                                (buffer-file-name 
(buffer-base-buffer)))
-                                                  nil)))
+                                           (and (buffer-file-name 
(buffer-base-buffer))
+                                                (file-name-nondirectory
+                                                 (buffer-file-name 
(buffer-base-buffer))))))
                                   (`full-file-path
                                    (list (buffer-file-name
                                           (buffer-base-buffer))))
-- 
2.30.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]