Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:58:17+00:00 2026-06-13T02:58:17+00:00

Does anyone have an emacs lisp hack that would allow the creation of a

  • 0

Does anyone have an emacs lisp hack that would allow the creation of a new directory on the fly during dired-do-copy or dired-do-rename? I understand that it can be created prior to running one of these two commands. Extra points for some type of “Are you sure…” prompt.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:58:17+00:00Added an answer on June 13, 2026 at 2:58 am

    It look like a case of applying an advice. The question being: what to
    advice. Looking at the dired code, it seem that the correct target is
    dired-mark-read-file-name that is used to read the destination
    file-name. This will work:

    (defadvice dired-mark-read-file-name (after rv:dired-create-dir-when-needed (prompt dir op-symbol arg files &optional default) activate)
      (when (member op-symbol '(copy move))
        (let ((directory-name (if (< 1 (length files))
                                  ad-return-value
                                  (file-name-directory ad-return-value))))
          (when (and (not (file-directory-p directory-name))
                     (y-or-n-p (format "directory %s doesn't exist, create it?" directory-name)))
            (make-directory directory-name t)))))
    

    Note that maybe the first when (when (member op-symbol '(copy move))) could be removed for this to apply to more case of file creation in dired. But I’m not sure of when dired-mark-read-file-name is called, So I let this test there to reduce potential unwanted side-effect

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have some code that will take a TimeZoneInfo field from .NET and
Does anyone have a free text-editor that works well in Windows 7? I'm currently
I'm a developer making the transition from Linux/Emacs to OSX/Xcode. Does anyone have any
Does anyone have a regex in ruby that can match and replace a tab
Does anyone have an Emacs macro for indenting (and unindenting) blocks of text? And
Does anyone have a code example that follows best practices of using MongoDB Official
Does anyone have a working setup for hunspell and Emacs ? Simply setting ispell-program-name
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone have a translate function for x/y positions after rotation in javascript? for
Does anyone have recommendations on the best Online Store for non-technical users of Joomla?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.