From: Kaushal Modi <kaushal.modi@gmail.com>
To: Glenn Morris <rgm@gnu.org>
Cc: 25075@debbugs.gnu.org
Subject: bug#25075: 26.0.50; [PATCH] Dired can now dereference symlinks when copying
Date: Thu, 01 Dec 2016 04:12:31 +0000 [thread overview]
Message-ID: <CAFyQvY2s4+XTLYbZE_AQwaR_Gm8QuZG9sRsvDk_JYh_Ogw=TJw@mail.gmail.com> (raw)
In-Reply-To: <k0fum8a3fk.fsf@fencepost.gnu.org>
[-- Attachment #1: Type: text/plain, Size: 3295 bytes --]
On Wed, Nov 30, 2016 at 7:38 PM Glenn Morris <rgm@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@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
[-- Attachment #2: Type: text/html, Size: 4955 bytes --]
next prev parent reply other threads:[~2016-12-01 4:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 18:04 bug#25075: 26.0.50; [PATCH] Dired can now dereference symlinks when copying Kaushal Modi
2016-11-30 18:38 ` Eli Zaretskii
2016-11-30 18:42 ` Kaushal Modi
2016-12-01 0:38 ` Glenn Morris
2016-12-01 3:39 ` Eli Zaretskii
2016-12-01 4:12 ` Kaushal Modi [this message]
2016-12-01 6:06 ` Kaushal Modi
2020-08-11 13:17 ` Lars Ingebrigtsen
2019-06-24 23:17 ` 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='CAFyQvY2s4+XTLYbZE_AQwaR_Gm8QuZG9sRsvDk_JYh_Ogw=TJw@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=25075@debbugs.gnu.org \
--cc=rgm@gnu.org \
/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).