I'd like to be able to paste text into a buffer and have emacs give a visual confirmation by flashing the region (highlighting and unhighlighting) the text that was pasted in the buffer. Is there an example of how to do this?
There are three ways that I know of:
volatile-highlights: an external package which gives you visual feedback for many operations, including yanking.
pulse: a built-in library you can leverage to achieve what you want. You can advice
pulse-momentary-highlight-region, for instance.
goggles: another external package. This one uses
pulseto do the highlighting. From its README:
This library is the holy counterpart of
evil-goggles. Another comparable library is
volatile-highlights, which does not use pulse. By setting
goggles-modebehaves similarly to the