GNU bug report logs - #25075
26.0.50; [PATCH] Dired can now dereference symlinks when copying

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Wed, 30 Nov 2016 18:05:02 UTC

Severity: wishlist

Tags: fixed, patch

Found in version 26.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25075 in the body.
You can then email your comments to 25075 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Wed, 30 Nov 2016 18:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kaushal Modi <kaushal.modi <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 30 Nov 2016 18:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 26.0.50; [PATCH] Dired can now dereference symlinks when copying
Date: Wed, 30 Nov 2016 18:04:17 +0000
[Message part 1 (text/plain, inline)]
Hello,

Can you review and comment on the below patch. I came up with a necessity
to copy symlinks from one dired buffer to another dired buffer as a
dereferenced copy of that symlink.

In terminal, I would use the -L option of the cp command to do the same.

The current default behavior is unchanged as the new defcustom
dired-copy-dereference is set to nil.

From 4c4185b9d4df2dcbbb6e1e7fa8a21b75e84ca79f Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi <at> gmail.com>
Date: Wed, 30 Nov 2016 12:52:42 -0500
Subject: [PATCH] Dired can now dereference symlinks when copying

* lisp/dired.el (dired-copy-dereference): New defcustom, defaults to
nil.

* lisp/dired-aux.el (dired-copy-file-recursive): Add new optional
argument `dereference'.

* lisp/dired-aux.el (dired-copy-file): Use `dired-copy-dereference' as
the `dereference' argument to `dired-copy-file-recursive'.
---
 lisp/dired-aux.el | 8 +++++---
 lisp/dired.el     | 6 ++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index f94e053..149c540 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1507,12 +1507,13 @@ dired-handle-overwrite
 (defun dired-copy-file (from to ok-flag)
   (dired-handle-overwrite to)
   (dired-copy-file-recursive from to ok-flag dired-copy-preserve-time t
-     dired-recursive-copies))
+     dired-recursive-copies dired-copy-dereference))

 (declare-function make-symbolic-link "fileio.c")

 (defun dired-copy-file-recursive (from to ok-flag &optional
-       preserve-time top recursive)
+       preserve-time top recursive
+                                       dereference)
   (when (and (eq t (car (file-attributes from)))
      (file-in-directory-p to from))
     (error "Cannot copy `%s' into its subdirectory `%s'" from to))
@@ -1524,7 +1525,8 @@ dired-copy-file-recursive
  (copy-directory from to preserve-time)
       (or top (dired-handle-overwrite to))
       (condition-case err
-  (if (stringp (car attrs))
+  (if (and (not dereference)
+                   (stringp (car attrs)))
       ;; It is a symlink
       (make-symbolic-link (car attrs) to ok-flag)
     (copy-file from to ok-flag preserve-time))
diff --git a/lisp/dired.el b/lisp/dired.el
index daa6d77..ca7ab28 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -191,6 +191,12 @@ dired-copy-preserve-time
   :type 'boolean
   :group 'dired)

+(defcustom dired-copy-dereference nil
+  "If non-nil, Dired dereferences symlinks when copying them.
+This is similar to the \"-L\" option for the \"cp\" shell command."
+  :type 'boolean
+  :group 'dired)
+                                        ;
 ; These variables were deleted and the replacements are on files.el.
 ; We leave aliases behind for back-compatibility.
 (defvaralias 'dired-free-space-program 'directory-free-space-program)
-- 
2.10.0

-- 

Kaushal Modi
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Wed, 30 Nov 2016 18:40:02 GMT) Full text and rfc822 format available.

Message #8 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 25075 <at> debbugs.gnu.org
Subject: Re: bug#25075: 26.0.50;
 [PATCH] Dired can now dereference symlinks when copying
Date: Wed, 30 Nov 2016 20:38:55 +0200
> From: Kaushal Modi <kaushal.modi <at> gmail.com>
> Date: Wed, 30 Nov 2016 18:04:17 +0000
> 
> Can you review and comment on the below patch. I came up with a necessity
> to copy symlinks from one dired buffer to another dired buffer as a
> dereferenced copy of that symlink.
> 
> In terminal, I would use the -L option of the cp command to do the same.
> 
> The current default behavior is unchanged as the new defcustom
> dired-copy-dereference is set to nil.

Shouldn't the doc string of dired-do-copy be updated with a reference
to the new variable?

Likewise the Emacs User manual should be updated.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Wed, 30 Nov 2016 18:43:02 GMT) Full text and rfc822 format available.

Message #11 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25075 <at> debbugs.gnu.org
Subject: Re: bug#25075: 26.0.50; [PATCH] Dired can now dereference symlinks
 when copying
Date: Wed, 30 Nov 2016 18:42:02 +0000
[Message part 1 (text/plain, inline)]
Hi Eli,

Thanks, I will work on that next and submit an updated patch. My first
patch was just so that it gets reviewed for functionality.

On Wed, Nov 30, 2016, 1:39 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Kaushal Modi <kaushal.modi <at> gmail.com>
> > Date: Wed, 30 Nov 2016 18:04:17 +0000
> >
> > Can you review and comment on the below patch. I came up with a necessity
> > to copy symlinks from one dired buffer to another dired buffer as a
> > dereferenced copy of that symlink.
> >
> > In terminal, I would use the -L option of the cp command to do the same.
> >
> > The current default behavior is unchanged as the new defcustom
> > dired-copy-dereference is set to nil.
>
> Shouldn't the doc string of dired-do-copy be updated with a reference
> to the new variable?
>
> Likewise the Emacs User manual should be updated.
>
> Thanks.
>
-- 

Kaushal Modi
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Thu, 01 Dec 2016 00:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 25075 <at> debbugs.gnu.org
Subject: Re: bug#25075: 26.0.50;
 [PATCH] Dired can now dereference symlinks when copying
Date: Wed, 30 Nov 2016 19:38:55 -0500
Kaushal Modi wrote:

> +(defcustom dired-copy-dereference nil
> +  "If non-nil, Dired dereferences symlinks when copying them.

I can't imagine anyone needing this as an option they can set for all
future uses. Surely what someone might need is a way to make one
specific copy command dereference? As a prefix argument or a separate
command, or whatever.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Thu, 01 Dec 2016 03:40:02 GMT) Full text and rfc822 format available.

Message #17 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 25075 <at> debbugs.gnu.org, kaushal.modi <at> gmail.com
Subject: Re: bug#25075: 26.0.50;
 [PATCH] Dired can now dereference symlinks when copying
Date: Thu, 01 Dec 2016 05:39:40 +0200
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Wed, 30 Nov 2016 19:38:55 -0500
> Cc: 25075 <at> debbugs.gnu.org
> 
> Kaushal Modi wrote:
> 
> > +(defcustom dired-copy-dereference nil
> > +  "If non-nil, Dired dereferences symlinks when copying them.
> 
> I can't imagine anyone needing this as an option they can set for all
> future uses. Surely what someone might need is a way to make one
> specific copy command dereference? As a prefix argument or a separate
> command, or whatever.

That was my first thought as well, but we use the same approach as
Kaushal proposed for the equivalent of the -p switch to 'cp'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Thu, 01 Dec 2016 04:13:02 GMT) Full text and rfc822 format available.

Message #20 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 25075 <at> debbugs.gnu.org
Subject: Re: bug#25075: 26.0.50; [PATCH] Dired can now dereference symlinks
 when copying
Date: Thu, 01 Dec 2016 04:12:31 +0000
[Message part 1 (text/plain, inline)]
On Wed, Nov 30, 2016 at 7:38 PM Glenn Morris <rgm <at> gnu.org> wrote:

>
> I can't imagine anyone needing this as an option they can set for all
> future uses. Surely what someone might need is a way to make one
> specific copy command dereference? As a prefix argument or a separate
> command, or whatever.
>

Hi Glenn,

I thought of various options:

Option 1: Make a prefix do copy with dereferencing. But for `dired-do-copy'
(bound to 'C' by default in dired-mode), numeric ARG already has a
meaning.. M-4 C will copy the next ARG files. Is the dired-copy-dereference
option special enough for a "C-u" prefix? I don't know.

Option 2: Let-bind dired-copy-dereference to t in a separate command and
have that call `dired-do-copy'. But then the single-letter binding space is
pretty crowded in dired-mode-map, and probably not worthy for this niche
command.

Option 3 (is what I did): Have a defcustom available. User can choose to
either set it to a t by default, or use it in a wrapper command and bind
that to a binding of their liking.

---

Re-visiting option 1: Do you think it would be a better idea to have C-u C
toggle the global value of `dired-copy-dereference' in a let binding and
then proceed with the copy? So if `dired-copy-dereference' is nil by
default, plain 'C' will copy symbolic links as links. But "C-u C" will copy
after dereferencing. Similarly if the user has set `dired-copy-dereference'
to t, the behavior of "C" and "C-u C" will reverse.

On a separate note, if you look at the dired-do-copy definition, why is the
global value of dired-recursive-copies assigned to the let-bound variable?
Does this do anything different than not having that let form altogether?

  (let ((dired-recursive-copies dired-recursive-copies))         ;
<---------------------------------
    (dired-do-create-files 'copy (function dired-copy-file)
  "Copy"
  arg dired-keep-marker-copy
  nil dired-copy-how-to-fn))

The commit history says:

(dired-do-copy): Bind `dired-recursive-copies' to preserve it.
    Use dired-copy-how-to-fn as how-to argument to dired-do-create-files.

But I did not understand that.

Here's the vc region history for that line:

commit ba1acd68768ac49d98afbf781851ab95c0263048
Author: Richard M. Stallman <rms <at> gnu.org>
Date:   Thu Sep 16 19:29:30 1999 +0000

    (dired-recursive-copies): New custom variable.
    (dired-handle-overwrite): Broke a long line.
    (dired-copy-file): Call `dired-copy-file-recursive' instead of
`copy-file'.
    (dired-copy-file-recursive): New function.  Copy directories
recursively.
    (dired-do-create-files): Added support for generalized directory
    target.  How-to function may now return a function.  New fluid
    variable `dired-one-file'.
    (dired-copy-how-to-fn): New variable.
    (dired-do-copy): Bind `dired-recursive-copies' to preserve it.
    Use dired-copy-how-to-fn as how-to argument to dired-do-create-files.
    (dired-do-copy-regexp): No recursive copies.

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1261,3 +1315,1 @@
-  (dired-do-create-files 'copy (function dired-copy-file)
-   (if dired-copy-preserve-time "Copy [-p]" "Copy")
-   arg dired-keep-marker-copy))
+n  (let ((dired-recursive-copies dired-recursive-copies))

-- 

Kaushal Modi
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Thu, 01 Dec 2016 06:07:01 GMT) Full text and rfc822 format available.

Message #23 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 25075 <at> debbugs.gnu.org
Subject: Re: bug#25075: 26.0.50; [PATCH] Dired can now dereference symlinks
 when copying
Date: Thu, 01 Dec 2016 06:06:21 +0000
[Message part 1 (text/plain, inline)]
Copying with symlinks dereferenced is almost always the case for me,
because of the version control system we use. It is a central VCS. So we
need to check out the files before editing them. In checked-in state, all
files are just symlinks to the physical versions in a central cache server.
So almost always "cp -L" is what I want to do when copying files from one
place to another without checking them out. My cp is aliased to "cp -L".

That said, here's the revised patch with updated documentation and
"Revisited Option 1" I mentioned above. This allows the flexibility of
*not* dereferencing symlinks for few selected cases when I would have set
dired-copy-dereference to t by default in my config.

From 28b9a7c41c168daec6645638c06d5333e8b642aa Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi <at> gmail.com>
Date: Wed, 30 Nov 2016 12:52:42 -0500
Subject: [PATCH] Dired can now dereference symlinks when copying

* lisp/dired.el (dired-copy-dereference): New defcustom, defaults to
nil.

* lisp/dired-aux.el (dired-copy-file-recursive): Add new optional
argument `dereference'.

* lisp/dired-aux.el (dired-copy-file): Use `dired-copy-dereference' as
the `dereference' argument to `dired-copy-file-recursive'.

* lisp/dired-aux.el (dired-do-copy): Invert the value of
  `dired-copy-dereference' in lexical scope when prefix argument is
  '(4). Update function documentation for the new defcustom.

* doc/emacs/dired.texi (Operating on Files): Mention the new defcustom.
---
 doc/emacs/dired.texi |  8 ++++++++
 lisp/dired-aux.el    | 25 +++++++++++++++++++------
 lisp/dired.el        |  6 ++++++
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 2cda51a82f..62042c5c1e 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -638,6 +638,14 @@ Operating on Files
 directories recursively (like @samp{cp -r}).  The default is
 @code{top}, which means to ask before recursively copying a directory.

+@vindex dired-copy-dereference
+@cindex follow symbolic links
+@cindex dereference symbolic links
+The variable @code{dired-copy-dereference} controls whether to copy
+symbolic links as links or after dereferencing (like @samp{cp -L}).
+The default is @code{nil}, which means that the symbolic links are
+copied by creating new ones.
+
 @item D
 @findex dired-do-delete
 @kindex D @r{(Dired)}
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index f94e0537aa..1b9009c744 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1507,12 +1507,13 @@ dired-handle-overwrite
 (defun dired-copy-file (from to ok-flag)
   (dired-handle-overwrite to)
   (dired-copy-file-recursive from to ok-flag dired-copy-preserve-time t
-     dired-recursive-copies))
+     dired-recursive-copies dired-copy-dereference))

 (declare-function make-symbolic-link "fileio.c")

 (defun dired-copy-file-recursive (from to ok-flag &optional
-       preserve-time top recursive)
+       preserve-time top recursive
+                                       dereference)
   (when (and (eq t (car (file-attributes from)))
      (file-in-directory-p to from))
     (error "Cannot copy `%s' into its subdirectory `%s'" from to))
@@ -1524,7 +1525,8 @@ dired-copy-file-recursive
  (copy-directory from to preserve-time)
       (or top (dired-handle-overwrite to))
       (condition-case err
-  (if (stringp (car attrs))
+  (if (and (not dereference)
+                   (stringp (car attrs)))
       ;; It is a symlink
       (make-symbolic-link (car attrs) to ok-flag)
     (copy-file from to ok-flag preserve-time))
@@ -1963,6 +1965,9 @@ dired-copy-how-to-fn
 ;;;###autoload
 (defun dired-do-copy (&optional arg)
   "Copy all marked (or next ARG) files, or copy the current file.
+ARG has to be numeric for above functionality.  See
+`dired-get-marked-files' for more details.
+
 When operating on just the current file, prompt for the new name.

 When operating on multiple or marked files, prompt for a target
@@ -1976,10 +1981,18 @@ dired-do-copy
 the modification time of each old file in the copy, similar to
 the \"-p\" option for the \"cp\" shell command.

-This command copies symbolic links by creating new ones, similar
-to the \"-d\" option for the \"cp\" shell command."
+This command copies symbolic links by creating new ones,
+similar to the \"-d\" option for the \"cp\" shell command.
+But if `dired-copy-dereference' is non-nil, the symbolic
+links are dereferenced and then copied, similar to the \"-L\"
+option for the \"cp\" shell command.  If ARG is a cons with
+element 4 (`\\[universal-argument]'), inverted value of
+`dired-copy-dereference' will be used."
   (interactive "P")
-  (let ((dired-recursive-copies dired-recursive-copies))
+  (let ((dired-recursive-copies dired-recursive-copies)
+        (dired-copy-dereference (if (equal arg '(4))
+                                    (not dired-copy-dereference)
+                                  dired-copy-dereference)))
     (dired-do-create-files 'copy (function dired-copy-file)
    "Copy"
    arg dired-keep-marker-copy
diff --git a/lisp/dired.el b/lisp/dired.el
index daa6d776a9..ca7ab2813b 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -191,6 +191,12 @@ dired-copy-preserve-time
   :type 'boolean
   :group 'dired)

+(defcustom dired-copy-dereference nil
+  "If non-nil, Dired dereferences symlinks when copying them.
+This is similar to the \"-L\" option for the \"cp\" shell command."
+  :type 'boolean
+  :group 'dired)
+                                        ;
 ; These variables were deleted and the replacements are on files.el.
 ; We leave aliases behind for back-compatibility.
 (defvaralias 'dired-free-space-program 'directory-free-space-program)
-- 
2.11.0


On Wed, Nov 30, 2016 at 11:12 PM Kaushal Modi <kaushal.modi <at> gmail.com>
wrote:

> On Wed, Nov 30, 2016 at 7:38 PM Glenn Morris <rgm <at> gnu.org> wrote:
>
>
> I can't imagine anyone needing this as an option they can set for all
> future uses. Surely what someone might need is a way to make one
> specific copy command dereference? As a prefix argument or a separate
> command, or whatever.
>
>
> Hi Glenn,
>
> I thought of various options:
>
> Option 1: Make a prefix do copy with dereferencing. But for
> `dired-do-copy' (bound to 'C' by default in dired-mode), numeric ARG
> already has a meaning.. M-4 C will copy the next ARG files. Is the
> dired-copy-dereference option special enough for a "C-u" prefix? I don't
> know.
>
> Option 2: Let-bind dired-copy-dereference to t in a separate command and
> have that call `dired-do-copy'. But then the single-letter binding space is
> pretty crowded in dired-mode-map, and probably not worthy for this niche
> command.
>
> Option 3 (is what I did): Have a defcustom available. User can choose to
> either set it to a t by default, or use it in a wrapper command and bind
> that to a binding of their liking.
>
> ---
>
> Re-visiting option 1: Do you think it would be a better idea to have C-u C
> toggle the global value of `dired-copy-dereference' in a let binding and
> then proceed with the copy? So if `dired-copy-dereference' is nil by
> default, plain 'C' will copy symbolic links as links. But "C-u C" will copy
> after dereferencing. Similarly if the user has set `dired-copy-dereference'
> to t, the behavior of "C" and "C-u C" will reverse.
>
> On a separate note, if you look at the dired-do-copy definition, why is
> the global value of dired-recursive-copies assigned to the let-bound
> variable? Does this do anything different than not having that let form
> altogether?
>
>   (let ((dired-recursive-copies dired-recursive-copies))         ;
> <---------------------------------
>     (dired-do-create-files 'copy (function dired-copy-file)
>   "Copy"
>   arg dired-keep-marker-copy
>   nil dired-copy-how-to-fn))
>
> The commit history says:
>
> (dired-do-copy): Bind `dired-recursive-copies' to preserve it.
>     Use dired-copy-how-to-fn as how-to argument to dired-do-create-files.
>
> But I did not understand that.
>
> Here's the vc region history for that line:
>
> commit ba1acd68768ac49d98afbf781851ab95c0263048
> Author: Richard M. Stallman <rms <at> gnu.org>
> Date:   Thu Sep 16 19:29:30 1999 +0000
>
>     (dired-recursive-copies): New custom variable.
>     (dired-handle-overwrite): Broke a long line.
>     (dired-copy-file): Call `dired-copy-file-recursive' instead of
> `copy-file'.
>     (dired-copy-file-recursive): New function.  Copy directories
> recursively.
>     (dired-do-create-files): Added support for generalized directory
>     target.  How-to function may now return a function.  New fluid
>     variable `dired-one-file'.
>     (dired-copy-how-to-fn): New variable.
>     (dired-do-copy): Bind `dired-recursive-copies' to preserve it.
>     Use dired-copy-how-to-fn as how-to argument to dired-do-create-files.
>     (dired-do-copy-regexp): No recursive copies.
>
> diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
> --- a/lisp/dired-aux.el
> +++ b/lisp/dired-aux.el
> @@ -1261,3 +1315,1 @@
> -  (dired-do-create-files 'copy (function dired-copy-file)
> -   (if dired-copy-preserve-time "Copy [-p]" "Copy")
> -   arg dired-keep-marker-copy))
> +n  (let ((dired-recursive-copies dired-recursive-copies))
>
> --
>
> Kaushal Modi
>
-- 

Kaushal Modi
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Mon, 24 Jun 2019 23:18:01 GMT) Full text and rfc822 format available.

Message #26 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 25075 <at> debbugs.gnu.org, Kaushal Modi <kaushal.modi <at> gmail.com>
Subject: Re: bug#25075: 26.0.50;
 [PATCH] Dired can now dereference symlinks when copying
Date: Tue, 25 Jun 2019 01:17:51 +0200
Glenn Morris <rgm <at> gnu.org> writes:

> Kaushal Modi wrote:
>
>> +(defcustom dired-copy-dereference nil
>> +  "If non-nil, Dired dereferences symlinks when copying them.
>
> I can't imagine anyone needing this as an option they can set for all
> future uses. Surely what someone might need is a way to make one
> specific copy command dereference? As a prefix argument or a separate
> command, or whatever.

Yeah, I'm not very enthusiastic about that option, either.  Sometimes I
want to copy symlinks, and sometimes I want to dereference them, but
setting a variable first isn't very good user experience.

I do agree with Kaushal's assessment that the single-key keymap in dired
is pretty crowded...  but perhaps introduce a new multi-key keymap?  :-/

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25075; Package emacs. (Tue, 11 Aug 2020 13:18:01 GMT) Full text and rfc822 format available.

Message #29 received at 25075 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 25075 <at> debbugs.gnu.org
Subject: Re: bug#25075: 26.0.50; [PATCH] Dired can now dereference symlinks
 when copying
Date: Tue, 11 Aug 2020 15:17:18 +0200
Kaushal Modi <kaushal.modi <at> gmail.com> writes:

> Copying with symlinks dereferenced is almost always the case for me,
> because of the version control system we use. It is a central VCS. So
> we need to check out the files before editing them. In checked-in
> state, all files are just symlinks to the physical versions in a
> central cache server. So almost always "cp -L" is what I want to do
> when copying files from one place to another without checking them
> out. My cp is aliased to "cp -L".

Thanks; I've now applied this patch to Emacs 28, since Eli said:

> That was my first thought as well, but we use the same approach as
> Kaushal proposed for the equivalent of the -p switch to 'cp'.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 11 Aug 2020 13:18:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 25075 <at> debbugs.gnu.org and Kaushal Modi <kaushal.modi <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 11 Aug 2020 13:18:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Sep 2020 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.