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: Q
Subject: bug#34092: Dired move file breaks relative symlinks
Date: Wed, 16 Jan 2019 09:07:39 +0800
User-agent: ZohoCN Mail

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)

There are some complicated examples of dealing with symlink :
https://www.emacswiki.org/emacs/symlink-fix.el
I am not sure if windows has relative shortcuts. This link show you can use symlinks in windows:
https://github.com/sensorflo/sensorflo-emacs/blob/master/site-lisp/w32-symlinks.el



reply via email to

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