How do I create an empty file in emacs?

前端 未结 15 544
轻奢々
轻奢々 2020-12-13 03:20

How can I create an empty file from emacs, ideally from within a dired buffer?

For example, I\'ve just opened a Python module in dired mode, created a new directory,

相关标签:
15条回答
  • 2020-12-13 04:15

    Programatically and without any dependency on touch, it's quite easy:

    (with-temp-buffer (write-file "path/to/empty/file/"))
    
    0 讨论(0)
  • 2020-12-13 04:16

    After this thread, Emacs has added two new commands:

    1. make-empty-file
    2. dired-create-empty-file

    These commands will be available in the emacs 27.1 release.

    0 讨论(0)
  • 2020-12-13 04:16

    In addition to other answers on the page, you can use f.el's function f-touch:

    M-:(f-touch "__init__.py")RET

    0 讨论(0)
提交回复
热议问题