emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Al Haji-Ali <abdo.haji.ali@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-refile-get-location a symlinked file [9.7-pre (release_9.6.29-1443-gb4d17c)]
Date: Wed, 19 Jun 2024 14:25:40 +0000	[thread overview]
Message-ID: <87v8259fh7.fsf@localhost> (raw)
In-Reply-To: <m2h6dqozf4.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

Al Haji-Ali <abdo.haji.ali@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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-refile-get-location-Fix-outline-path-to-a-symlin.patch --]
[-- Type: text/x-patch, Size: 1371 bytes --]

From 8e0c1dbaa54322029c6cf1389bf5a43340738da2 Mon Sep 17 00:00:00 2001
Message-ID: <8e0c1dbaa54322029c6cf1389bf5a43340738da2.1718806993.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@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.ali@gmail.com>
Link: https://orgmode.org/list/m2ed8vr2io.fsf@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


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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	other threads:[~2024-06-19 14:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 15:51 [BUG] org-refile-get-location a symlinked file [9.7-pre (release_9.6.29-1443-gb4d17c)] Al Haji-Ali
2024-06-17 17:26 ` Ihor Radchenko
2024-06-17 21:52   ` Al Haji-Ali
2024-06-18 12:56     ` Ihor Radchenko
2024-06-18 18:53       ` Al Haji-Ali
2024-06-19 14:25         ` Ihor Radchenko [this message]
2024-06-20  8:00           ` Al Haji-Ali
2024-06-20 14:56             ` Ihor Radchenko
2024-06-20 15:13               ` Al Haji-Ali
2024-06-20 15:26                 ` Ihor Radchenko

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=87v8259fh7.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=abdo.haji.ali@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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