> > Actually, my "clever" idea was that you don't read any word at all: just > go though the existing abbreviations, and check for each one of the if > the text before point matches the expansion. > > Admittedly, I don't think we currently have a fast implementation of the > equivalent of (looking-back (regexp-quote expansion)), so I don't know > how well it will perform. > My simple function `asug-get-previous-words' function performs quite well, it seems. I could not get `looking-back' to work across lines. It was very quick though, when words was on the same line. Also, collecting all active abbrev expansions was also very fast (1000 runs takes 0.1 on my not very hot PC) so I did not bother with that optimization. But perhaps I will experiment a bit with that too. All in all this seems to turn out quite nicely. I will try to integrate it properly in abbrev.el and add some option there to toggle this feature on. Thanks for the pointers!