How do I create an empty file in emacs?

前端 未结 15 496
轻奢々
轻奢々 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:00

    I've modified answer from MrBones and created custom function with keybinding:

    ; create empty __init__.py at the place
    (defun create-empty-init-py()
      (interactive)
      (shell-command "touch __init__.py")
    )
    (global-set-key (kbd "C-c p i") 'create-empty-init-py)
    

    This is very useful to not spend time on recurring action of creating init.py everywhere in new Python project folder.

提交回复
热议问题