How do I create an empty file in emacs?

前端 未结 15 695
轻奢々
轻奢々 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 03:55

    If you want Emacs to treat all new files as modified, you can automate the solution like this:

    (add-hook 'find-file-hooks 'assume-new-is-modified)
    (defun assume-new-is-modified ()
      (when (not (file-exists-p (buffer-file-name)))
        (set-buffer-modified-p t)))
    

提交回复
热议问题