help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a directory target for dired-do-copy


From: Kevin Rodgers
Subject: Re: Creating a directory target for dired-do-copy
Date: Wed, 02 Feb 2005 09:30:46 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

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

reply via email to

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