如何从Emacs中创建目录? [英] How do I create a directory from within Emacs?

查看:702
本文介绍了如何从Emacs中创建目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何使用Emacs创建一个新目录?我使用什么命令? (如果可以,请提供示例)

解决方案


  • 创建目录 dir / to / create ,键入:

      to / create RET 


  • 创建目录 dir / parent1 / node dir / parent2 / node ,键入:

      M-! mkdir -p dir / parent {1,2} / node RET 

    假设Emacs的下级shell bash / zsh 或其他兼容shell。


  • p>或模式

      / code> 



    它不会创建不存在的父目录。



      Cx d * .py RET;在Dired模式中显示CWD中的python源文件
    + test RET;在CWD中创建`test`目录

    CWD 代表当前工作目录。


  • 或者使用 Cx Cf 并输入:

      Mx make-directory RET RET 




Emacs要求在最近的Emacs版本中保存新文件时自动创建父目录。对于旧版本,请参阅如何在保存文件时使Emacs创建中间文件夹?


How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)

解决方案

  • to create the directory dir/to/create, type:

    M-x make-directory RET dir/to/create RET
    

  • to create directories dir/parent1/node and dir/parent2/node, type:

    M-! mkdir -p dir/parent{1,2}/node RET
    

    It assumes that Emacs's inferior shell is bash/zsh or other compatible shell.

  • or in a Dired mode

    +
    

    It doesn't create nonexistent parent directories.

    Example:

    C-x d *.py RET ; shows python source files in the CWD in `Dired` mode
    + test RET     ; create `test` directory in the CWD
    

    CWD stands for Current Working Directory.

  • or just create a new file with non-existing parent directories using C-x C-f and type:

    M-x make-directory RET RET
    

Emacs asks to create the parent directories automatically while saving a new file in recent Emacs versions. For older version, see How to make Emacs create intermediate dirs - when saving a file?

这篇关于如何从Emacs中创建目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆