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,
Programatically and without any dependency on touch
, it's quite easy:
(with-temp-buffer (write-file "path/to/empty/file/"))
After this thread, Emacs has added two new commands:
These commands will be available in the emacs 27.1 release.
In addition to other answers on the page, you can use f.el's function f-touch:
M-:(f-touch "__init__.py")
RET