emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: satotake <doublequotation@gmail.com>
To: emacs-orgmode@gnu.org
Cc: satotake <doublequotation@gmail.com>
Subject: [PATCH 2/2] org-refile.el: Fix test case
Date: Mon, 10 May 2021 01:02:08 +0900	[thread overview]
Message-ID: <20210509160208.26778-1-doublequotation@gmail.com> (raw)

* 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'.

 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))
 		(goto-char (point-min))
@@ -341,10 +340,9 @@ converted to a headline before refiling."
 				 (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))))))
 				    (list (buffer-file-name

             reply	other threads:[~2021-05-09 16:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-09 16:02 satotake [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-05-09 14:47 [PATCH] org-refile.el: Fix the case of emtpy buffer name satotake
2021-05-09 15:55 ` satotake
2021-05-09 15:55   ` [PATCH 2/2] org-refile.el: Fix test case satotake
2021-05-09 16:05   ` satotake
2021-05-11 11:45     ` Maxim Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210509160208.26778-1-doublequotation@gmail.com \
    --to=doublequotation@gmail.com \
    --cc=20210509155531.26615-1-doublequotation@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).