On 18/06/2024, Ihor Radchenko wrote:
> Hmm. Thanks, but the patch does not apply on my side.
> May you instead create a patch as a separate file, add the commit
> message, and attach that patch file in the email reply?

See attached.

Best regards,
-- Al

>From 0efafc38b404bace9ff87e38349a6c64fc7be903 Mon Sep 17 00:00:00 2001
From: Al Haji-Ali <a.haji...@hw.ac.uk>
Date: Tue, 18 Jun 2024 19:27:56 +0100
Subject: [PATCH] Use file-truename for files of refile targets.

Ensures that comparing filenames works even when symlinks are used.
---
 lisp/org-refile.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 20b5fbd02..7c463bc67 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -324,7 +324,7 @@ When `org-refile-use-cache' is nil, just return POS."
 	     (progn
 	       (when (bufferp f)
 		 (setq f (buffer-file-name (buffer-base-buffer f))))
-	       (setq f (and f (expand-file-name f)))
+	       (setq f (and f (file-truename f)))
 	       (when (eq org-refile-use-outline-path 'file)
 		 (push (list (and f (file-name-nondirectory f)) f nil nil) tgs))
 	       (when (eq org-refile-use-outline-path 'buffer-name)
@@ -666,7 +666,7 @@ this function appends the default value from
 		  #'completing-read))
 	 (extra (if org-refile-use-outline-path "/" ""))
 	 (cbnex (concat (buffer-name) extra))
-	 (filename (and cfn (expand-file-name cfn)))
+	 (filename (and cfn (file-truename cfn)))
 	 (tbl (mapcar
 	       (lambda (x)
 		 (if (and (not (member org-refile-use-outline-path
-- 
2.39.3 (Apple Git-145)

Reply via email to