Wednesday, April 13, 2011

Emacs: how to delete text without kill ring?

Hi,

I'd like to just delete some text so I can yank some other text instead of it. How can I do that? C-w cuts the selected text to kill ring and I end up without the text I wanted to yank.

Also, is it possible to yank text directly instead of some text without even pressing buttons to kill it?

From stackoverflow
  • You can use M-y after C-y to insert previous item from the kill ring, or use browse-kill-ring package.

    As for the second question, see DeleteSelectionMode.

  • I type M-x delete-region quite often, but you can bind it it to a key.

    I don't understand the second question. Do you mean kill-ring-save with M-w?

  • For your second question, alternatively to DeleteSelectionMode you can enable CUA Mode which additionally gives you a nice rectangle selection mode enabled by C-Return. CUA mode is part of emacs since 22.1.

  • M-x eval-expression (setq kill-ring (cdr kill-ring)) - removes last item from kill-ring

0 comments:

Post a Comment