GNU Emacs
Emacs
Dashboard

12.1.4 Options for Killing

Some specialized buffers contain read-only text, which cannot be modified and therefore cannot be killed. The kill commands work specially in a read-only buffer: they move over text and copy it to the kill ring, without actually deleting it from the buffer. Normally, they also beep and display an error message when this happens. But if you set the variable kill-read-only-ok to a non- nil value, they just print a message in the echo area to explain why the text has not been erased.

Before saving the kill to the kill ring, you can transform the string using kill-transform-function. It’s called with the string to be killed, and it should return the string you want to be saved. It can also return nil, in which case the string won’t be saved to the kill ring. For instance, if you never want to save a pure white space string to the kill ring, you can say:

(setq kill-transform-function
      (lambda (string)
        (and (not (string-blank-p string))
             string)))

If you change the variable kill-do-not-save-duplicates to a non- nil value, identical subsequent kills yield a single kill-ring entry, without duplication.