emacskeyboard-shortcutsselection

How to copy/select a whole file or buffer in Emacs?


Is there any command to select the whole file contents in Emacs?

For example, Control+a selects whole contents of a file in Notepad, Notepad++, etc.

I can select whole contents using the mouse, but it's inconvenient for large files. I found the basic Emacs commands here and here, but could not find what I am looking for.


Solution

  • C-x h will select the entire buffer.

    You can search for help within Emacs using the built-in help system.

    C-h f will look for help for specific functions. In this case, you could have searched for whole-buffer to find mark-whole-buffer.

    Other help commands of interest would be:

    Note that C-x h will only highlight all the text. To actually copy the selected text, you must use C-w for cut (kill-region) or M-w for copy (kill-ring-save).