Fey
Fey

Reputation: 71

How to clear all the content of a file in emacs?

This question may sound stupid. But I do search online and couldn't find a answer. So what's the emacs command to clear all the content in a file? I want to clear my error_log file.

Upvotes: 4

Views: 4673

Answers (2)

Stefan
Stefan

Reputation: 28531

Rather than erase-buffer, you can use C-x h C-w.

Upvotes: 11

Pedro Romano
Pedro Romano

Reputation: 11203

Is M-x erase-buffer what you are looking for? Note that it is disabled by default because new users find it confusing and you'll be asked about enabling it temporarily or permanently the first time you run it. You can then bind it to a keyboard shortcut for convenience.

Upvotes: 4

Related Questions