From c4252d86c1c4b09a914af3ef67fed835109499d0 Mon Sep 17 00:00:00 2001 From: justinlime Date: Wed, 15 May 2024 17:29:17 -0500 Subject: [PATCH 1/2] Add support for symlinks, relative symlinks, and hardlinks --- dired-ranger.el | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/dired-ranger.el b/dired-ranger.el index 93634a3..b82b027 100644 --- a/dired-ranger.el +++ b/dired-ranger.el @@ -170,6 +170,47 @@ instead of copying them." #'dired-ranger--name-constructor ?M) (unless arg (ring-remove dired-ranger-copy-ring 0)))) +;;;###autoload +(defun dired-ranger-symlink (arg) + "Symlink the items from copy ring to current directory. + +This behaves like `dired-ranger-paste' but symlinks the files +instead of copying them." + (interactive "P") + (let* ((index (if (numberp arg) arg 0)) + (data (ring-ref dired-ranger-copy-ring index)) + (files (cdr data))) + (dired-create-files #'make-symbolic-link "Symlink" files + #'dired-ranger--name-constructor ?S) + (unless arg (ring-remove dired-ranger-copy-ring 0)))) + +;;;###autoload +(defun dired-ranger-symlink-relative (arg) + "Create a relative symlink for the items from copy ring to current directory. + +This behaves like `dired-ranger-paste' but symlinks the files +instead of copying them." + (interactive "P") + (let* ((index (if (numberp arg) arg 0)) + (data (ring-ref dired-ranger-copy-ring index)) + (files (cdr data))) + (dired-create-files #'dired-make-relative-symlink "Symlink Relative" files + #'dired-ranger--name-constructor ?R) + (unless arg (ring-remove dired-ranger-copy-ring 0)))) + +;;;###autoload +(defun dired-ranger-hardlink (arg) + "Create a hardlink for the items from copy ring to current directory. + +This behaves like `dired-ranger-paste' but hardlinks the files +instead of copying them." + (interactive "P") + (let* ((index (if (numberp arg) arg 0)) + (data (ring-ref dired-ranger-copy-ring index)) + (files (cdr data))) + (dired-create-files #'dired-hardlink "Hardlink" files + #'dired-ranger--name-constructor ?H) + (unless arg (ring-remove dired-ranger-copy-ring 0)))) ;; bookmarks (defcustom dired-ranger-bookmark-reopen 'ask From 48510f4cd7cc9fd4b1f081a4341a983c75971fa7 Mon Sep 17 00:00:00 2001 From: justinlime Date: Wed, 15 May 2024 19:26:07 -0500 Subject: [PATCH 2/2] Update README --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 520be56..650d256 100644 --- a/README.md +++ b/README.md @@ -488,8 +488,10 @@ prefix argument, add the marked files to the current clipboard. Past clipboards are stored in `dired-ranger-copy-ring` so you can repeat the past pastes. -Call `dired-ranger-paste` or `dired-ranger-move` to copy or move -the files in the current clipboard to the current dired buffer. +Call `dired-ranger-paste`, `dired-ranger-move`, `dired-ranger-hardlink`, +`dired-ranger-symlink`, or `dired-ranger-symlink-relative` to +paste, move, hardlink, symlink, or create a reliative symlink from +the files in the current clipboard to the current dired buffer respectively. With raw prefix argument (usually C-u), the clipboard is not cleared, so you can repeat the copy operation in another dired buffer.