* Re: Creating a directory target for dired-do-copy
[not found] <mailman.14988.1106600827.27204.help-gnu-emacs@gnu.org>
@ 2005-01-28 15:09 ` Kevin Rodgers
2005-01-30 18:17 ` Luis O. Silva
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2005-01-28 15:09 UTC (permalink / raw)
Luis O. Silva wrote:
> Let us suppose that you are in dired mode without any marked
> files and you type `C', that is (`dired-do-copy'). You're
> asked for the directory to copy into or the new file
> name. What do you have to do if you want to copy the file to a
> nonexistent directory? Is there an easy way to create the
> target directory without doing this separately?
Could it be as simple as;
(defadvice dired-mark-read-file-name (after make-directory activate)
"Create non-existent directories for the result, as necessary.
If the returned file name is a directory name (e.g. ends in slash on Unix),
create it."
(let ((directory (file-name-directory ad-return-value)))
(unless (file-directory-p directory)
(make-directory directory t)))
(when (equal (file-name-as-directory ad-return-value) ad-return-value)
(make-directory ad-return-value)))
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Creating a directory target for dired-do-copy
2005-01-28 15:09 ` Creating a directory target for dired-do-copy Kevin Rodgers
@ 2005-01-30 18:17 ` Luis O. Silva
2005-01-31 17:07 ` Luis O. Silva
[not found] ` <mailman.178.1107188275.2841.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 6+ messages in thread
From: Luis O. Silva @ 2005-01-30 18:17 UTC (permalink / raw)
Thank you for your message (Fri, 28 Jan 2005 08:09:26 -0700),
in which, among other things, you wrote[1]:
KR> Could it be as simple as;
KR> (defadvice dired-mark-read-file-name (after make-directory activate)
KR> "Create non-existent directories for the result, as necessary.
KR> If the returned file name is a directory name (e.g. ends in slash on Unix),
KR> create it."
KR> (let ((directory (file-name-directory ad-return-value)))
KR> (unless (file-directory-p directory)
KR> (make-directory directory t)))
KR> (when (equal (file-name-as-directory ad-return-value) ad-return-value)
KR> (make-directory ad-return-value)))
I'm very grateful for your help, unfortunately it doesn't work
for me. I put the previous snippet in my .emacs file and, after
reloading, I typed `C' within dired. Then in the minibuffer I
typed after Copy [-p] file-test to:
~/temporary/non-existing-file/
where non-existing-file is a non-existing file. Emacs says
File exists: /home/silva/temporary/non-existing-file/
Actually after loading the snippet, Emacs says the same even
for an existing directory!
I tried to correct the code, but it seems that I don't
understand it. Any hint will be enormously appreciated.
Best regards,
luis
Footnotes:
[1] The excerpts of your message are prefixed by "KR>".
--
Luis Octavio Silva Pereyra.
IIMAS-UNAM
Depto. de Métodos Matemáticos y Numéricos
Apdo. postal 20-726
01000 México, D.F.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Creating a directory target for dired-do-copy
2005-01-30 18:17 ` Luis O. Silva
@ 2005-01-31 17:07 ` Luis O. Silva
[not found] ` <mailman.178.1107188275.2841.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Luis O. Silva @ 2005-01-31 17:07 UTC (permalink / raw)
Hi Kevin,
On Sun, 30 Jan 2005 12:17:25 -0600, "Luis O. Silva" <l.o.silva@mail.ru> said:
LS> I'm very grateful for your help, unfortunately it
LS> doesn't work for me. I put the previous snippet in my
LS> .emacs file and, after reloading, I typed `C' within
LS> dired. Then in the minibuffer I typed after Copy [-p]
LS> file-test to:
LS> ~/temporary/non-existing-file/
Sorry for answering my own post, but it was written
incorrectly.
LS> where non-existing-file is a non-existing file.
Here I mean non-existing directory.
LS> Emacs says
LS> File exists: /home/silva/temporary/non-existing-file/
LS> Actually after loading the snippet, Emacs says the
LS> same even for an existing directory!
LS> I tried to correct the code, but it seems that I
LS> don't understand it. Any hint will be enormously
LS> appreciated.
Thank you again for any help.
luis
--
Luis Octavio Silva Pereyra.
IIMAS-UNAM
Depto. de Métodos Matemáticos y Numéricos
Apdo. postal 20-726
01000 México, D.F.
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.178.1107188275.2841.help-gnu-emacs@gnu.org>]
* Re: Creating a directory target for dired-do-copy
[not found] ` <mailman.178.1107188275.2841.help-gnu-emacs@gnu.org>
@ 2005-02-02 16:30 ` Kevin Rodgers
2005-02-03 22:06 ` Luis O. Silva
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2005-02-02 16:30 UTC (permalink / raw)
Luis O. Silva wrote:
> On Sun, 30 Jan 2005 12:17:25 -0600, "Luis O. Silva"
<l.o.silva@mail.ru> said:
>
> LS> I'm very grateful for your help, unfortunately it
> LS> doesn't work for me. I put the previous snippet in my
> LS> .emacs file and, after reloading, I typed `C' within
> LS> dired. Then in the minibuffer I typed after Copy [-p]
> LS> file-test to:
>
> LS> ~/temporary/non-existing-file/
>
> Sorry for answering my own post, but it was written
> incorrectly.
>
> LS> where non-existing-file is a non-existing file.
>
> Here I mean non-existing directory.
Right, I'd guessed that.
> LS> Emacs says
>
> LS> File exists: /home/silva/temporary/non-existing-file/
>
> LS> Actually after loading the snippet, Emacs says the
> LS> same even for an existing directory!
>
> LS> I tried to correct the code, but it seems that I
> LS> don't understand it. Any hint will be enormously
> LS> appreciated.
It turns out the code tries to be too smart and do too much. Just
delete the second form in the advice (and the second sentence of its doc
string), leaving:
(defadvice dired-mark-read-file-name (after make-directory activate)
"Create non-existent directories for the result, as necessary."
(let ((directory (file-name-directory ad-return-value)))
(unless (file-directory-p directory)
(make-directory directory t))))
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Creating a directory target for dired-do-copy
2005-02-02 16:30 ` Kevin Rodgers
@ 2005-02-03 22:06 ` Luis O. Silva
0 siblings, 0 replies; 6+ messages in thread
From: Luis O. Silva @ 2005-02-03 22:06 UTC (permalink / raw)
Hi,
On Wed, 02 Feb 2005 09:30:46 -0700, Kevin Rodgers writes:
KR> It turns out the code tries to be too smart and do too
KR> much. Just delete the second form in the advice (and
KR> the second sentence of its doc string), leaving:
KR> ...
Thank you. It works exactly as I wished.
Best regards,
luis
--
Luis Octavio Silva Pereyra.
IIMAS-UNAM
Depto. de Métodos Matemáticos y Numéricos
Apdo. postal 20-726
01000 México, D.F.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Creating a directory target for dired-do-copy
@ 2005-01-24 21:32 Luis O. Silva
0 siblings, 0 replies; 6+ messages in thread
From: Luis O. Silva @ 2005-01-24 21:32 UTC (permalink / raw)
Dear Emacs community,
Let us suppose that you are in dired mode without any marked
files and you type `C', that is (`dired-do-copy'). You're
asked for the directory to copy into or the new file
name. What do you have to do if you want to copy the file to a
nonexistent directory? Is there an easy way to create the
target directory without doing this separately?
Thank you very much in advance
luis
--
Luis Octavio Silva Pereyra.
IIMAS-UNAM
Depto. de Métodos Matemáticos y Numéricos
Apdo. postal 20-726
01000 México, D.F.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-02-03 22:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.14988.1106600827.27204.help-gnu-emacs@gnu.org>
2005-01-28 15:09 ` Creating a directory target for dired-do-copy Kevin Rodgers
2005-01-30 18:17 ` Luis O. Silva
2005-01-31 17:07 ` Luis O. Silva
[not found] ` <mailman.178.1107188275.2841.help-gnu-emacs@gnu.org>
2005-02-02 16:30 ` Kevin Rodgers
2005-02-03 22:06 ` Luis O. Silva
2005-01-24 21:32 Luis O. Silva
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.