I'm trying to make the kill ring essentially ignore whitespace only entries (tabs, newlines, just spaces, etC), I'm fairly new to elisp and I'm pretty sure the way to do is by doing defadvice but I have a few questions.
In which case, I'm completely lost on which function I should advise, its between current-kill, yank, and insert-for-yank - but am not entirely sure which I should manipulate to not yank whitespace from the kill ring.
Thanks!
EDIT: I'm pretty sure the way to do this is to manipulate `current-kill' to keep calling itself until it reaches a non whitespace entry? (or the end of the ring, whichever comes first)
From the comments it seems that you are having problems with whitespaces in your kill-ring since you kill whitespace lines. My solution would be to avoid killing whitespace lines and to use the function delete-blank-line
(C-x C-o) instead. This reduces a group a blank lines (including whitespaces and tabs) to a single blank line.
I wrote a package clean-kill-ring.el that provides functionality for controlling what is allowed in the kill ring.
By default enabling clean-kill-ring-mode
prevents blank strings from entering the kill ring, but further customization is possible as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With