emacstextselection

How to do an invert selection in emacs?


I currently have a region of text selected. I want to kill/yank (or format in any other way) the whole buffer except the selected region. Is there any way in which I can do an invert selection in emacs and accomplish the same?


Solution

    1. C-w kill-region the text in the middle.
    2. C-x h mark-whole-buffer the rest of the text.
    3. do your thing.
    4. C-y yank the middle text.