unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Q <qiang.fang@zoho.com.cn>
Cc: 34092@debbugs.gnu.org
Subject: bug#34092: Dired move file breaks relative symlinks
Date: Wed, 18 May 2022 15:19:24 +0200	[thread overview]
Message-ID: <871qwrc71f.fsf@gnus.org> (raw)
In-Reply-To: <16854331264.e785034111347.1332308217951283139@zoho.com.cn> (Q.'s message of "Wed, 16 Jan 2019 09:07:39 +0800")

Q <qiang.fang@zoho.com.cn> writes:

> Dired move file breaks relative symlinks. Maybe we can call this a
> bug. I find a workaround with this advice.  I use this to move files
> (rel symlinks) around in a git-annex repo without brokening it.  I am
> quite new to emacs, I am not sure if that has any side effect.
>
>     (defun my-rename-file (file newname &optional ok-if-already-exists)
>     "fix path for relative symlink"
>     (if (file-symlink-p newname)
>     (let ((target (expand-file-name (file-symlink-p newname) (file-name-directory
> file))))
>           (if (and target (string-equal system-type "gnu/linux") (not (file-exists-p
> newname)))
>               (dired-make-relative-symlink target newname t)))))
>     (advice-add #'rename-file :after #'my-rename-file)

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I'm unable to reproduce this in Emacs 29.  I did:

touch file
ln -s file symfile

And then moved the file and the relative symlink with `R' in Dired, and
they were moved as expected (i.e., still relative).

Do you have a recipe for the problem you were seeing, or has this been
fixed in the years since it was reported?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2022-05-18 13:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  1:07 bug#34092: Dired move file breaks relative symlinks Q
2022-05-18 13:19 ` Lars Ingebrigtsen [this message]
2022-06-17 12:06   ` Lars Ingebrigtsen
     [not found]   ` <181c6cd6aa6.11db7c83a9832.6239095410226312522@zoho.com.cn>
2022-07-04 10:16     ` Lars Ingebrigtsen

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=871qwrc71f.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=34092@debbugs.gnu.org \
    --cc=qiang.fang@zoho.com.cn \
    /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.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).