Frage

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.

  • Would it better to stop whitespace entries from ever getting into the kill ring in the first place, or to skip them on yank? I assumed the latter.

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)

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top