Al Haji-Ali <abdo.haji....@gmail.com> writes:

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

Thanks. Although this is a different kind of patch. And it is doing too
much - we do not want to expand all the names via `file-truename'
because you may have a situation like

/path/to/file1.org
/path/to/symlinks/name-is-completely-different.org

Then, using `file-truename' may be confusing for people who expect the
symlink name to be displayed.

I am thus attaching an alternative patch.
May you please test if it fixes the problem on your side?

>From 8e0c1dbaa54322029c6cf1389bf5a43340738da2 Mon Sep 17 00:00:00 2001
Message-ID: <8e0c1dbaa54322029c6cf1389bf5a43340738da2.1718806993.git.yanta...@posteo.net>
From: Ihor Radchenko <yanta...@posteo.net>
Date: Wed, 19 Jun 2024 16:18:41 +0200
Subject: [PATCH] org-refile-get-location: Fix outline path to a symlink of
 current buffer

* lisp/org-refile.el (org-refile-get-location): When current buffer
file is a symlink to refile location, do not append the file name to
the outline path, just as we do when current buffer is the same as
refile location file.

Reported-by: Al Haji-Ali <abdo.haji....@gmail.com>
Link: https://orgmode.org/list/m2ed8vr2io....@gmail.com
---
 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..4a9cc8c01 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -670,8 +670,8 @@ (defun org-refile-get-location (&optional prompt default-buffer new-nodes)
 	 (tbl (mapcar
 	       (lambda (x)
 		 (if (and (not (member org-refile-use-outline-path
-				       '(file full-file-path title)))
-			  (not (equal filename (nth 1 x))))
+				     '(file full-file-path title)))
+			  (not (equal filename (file-truename (nth 1 x)))))
 		     (cons (concat (car x) extra " ("
 				   (file-name-nondirectory (nth 1 x)) ")")
 			   (cdr x))
-- 
2.45.1

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to