bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34092: Dired move file breaks relative symlinks


From: Lars Ingebrigtsen
Subject: bug#34092: Dired move file breaks relative symlinks
Date: Wed, 18 May 2022 15:19:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]