Emacs - Skip Spaces

I'm trying to get the kill ring to essentially ignore only whitespace entries (tabs, newlines, just spaces, etC), I'm pretty new to elisp and I'm sure the way to do this is to do defadvice, but I have a few questions.

  • Would it be better to stop recording whitespace ever falling into the killing ring, or skip them on yank? I assumed the latter.

In this case, I completely lost what function I should advise about, between the current-kill, yank and insert-for-yank - but I'm not entirely sure that I should manipulate so as not to tear out the gaps from killing the ring.

Thanks!

EDIT: I'm sure the way to do this is to manipulate the `current-kill 'to keep calling until it reaches the record without spaces? (or the end of the ring, whichever comes first)

+4
source share
1 answer

From the comments it seems that you are having problems with spaces in your kill-ring, since you are killing whitespace. My solution was to avoid destroying whitespace lines and instead use the delete-blank-line ( Cx Co ) function. This reduces the group of blank lines (including spaces and tabs) to one blank line.

+5
source

All Articles