Subject: bug#5805: 23.3 abbrev-insert needs a limited save-excursion

From: Stefan Monnier <[email-masked]>
Date: Thu, 07 Jul 2011 16:59:13 -0400

tags 5805 patch
thanks

> I agree with the original poster that a save-excursion is needed in
> abbrev-expand and by making its scope limited (see below) it will not
> interfere with abbrevs that want to change point. The reason I find it
> annoying the way it is now is that some modes (e.g., idlwave) use
> abbrev's extensively to change keywords (e.g. capitalize them). These
> are defined without the leading "\". So if I am any number of lines
> with only whitespace below a keyword defined in this way (e.g. endfor)
> and run expand-abbrev then the point moves even if no visible change
> takes place. This is a VERY common occurrence for me since in viper
> mode changing from insert to vi mode runs expand-abbrev! Placing the
> save-excursion just around the part of abbrev-insert that actually
> expands the abbrev fixes this problem and does not limit abbrev's from
> moving the point (idlwave does this extensively as well and I've
> tested that it is not impacted).

Hmm... sounds like an interesting solution.  I'll take a closer look and
get back to you.  Thank you.

> Here is the diff against the
> abbrev.el in emacs 23.3 (note that whitespace not adjusted).

Highly appreciated.

        Stefan