Subject: bug#5805: 23.1; abbrev-insert does not protext itself with save-excursion

From: Stefan Monnier <[email-masked]>
Date: Sat, 10 Apr 2010 15:10:13 -0400

> Create a global abbrev, abbrv => abbrev
> Type the following, ^ indicating point location.

>   abbrv ()
>           ^
> Then press C-x ' to expand the abbrev on the line.
>   abbrev ()
>         ^
> Observe that point ^ is now before the ()s.

Right.  The question now is: why is that a problem?

I ask because for some abbrevs, moving point isa feature, e.g. an abbrev
that uses skeletons to expand

    begi
        ^
into

    \begin{itemize}  \end{itemize}
                    ^

so maybe the problem is that your code makes unwarranted assumptions
about what abbrevs can do, or maybe your code knows that it won't
encounter such abbreviations or that it wouldn't care about their
point-placement feature, so it could/should use save-excursion.

> ;; Emacs 23 has a lisp implementation for abbrevs.

BTW, the problem is not that the implementation is in Lisp, but that it
behaves differently.

        Stefan