Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug#4356: 23.1.50; expand-abbrev changes point erroneously

1 view
Skip to first unread message

Stefan Monnier

unread,
Sep 15, 2009, 10:46:00 PM9/15/09
to Vincent Belaïche, 43...@emacsbugs.donarmstrong.com
> Here is the bug description. I found this editing some Visual Basic file
> with using http://www.emacswiki.org/emacs/visual-basic-mode.el

> If for instance I type <RET> after (--!-- showing point when I type <RET>):

> MyVar = MyFun(1,True)--!--

> Then in visual basic mode visual-basic-newline-and-indent is called,
> which in turn calls (expand-abbrev). After (expand-abbrev) is called,
> point will be moved as follows:

> MyVar = MyFun(1,True--!--)

> because `True' is one abbreviation. I have patched visual-basic mode, so
> that a save-excursion encloses the call of expand-abbrev, otherwise I
> would get:

> MyVar = MyFun(1,True
> --!--)

> which is not wanted. Stefan Monnier (mon...@IRO.UMontreal.CA) confirmed
> this is a bug of expand-abbrev, and asked me to repport it.

> The wanted behaviour would be that after expanding `True', point would
> come back to after the `)' where it originally was.

Having looked into it some more, I'm not 100% convinced it's a bug
any more. Here's why:

`expand-abbrev' may run arbitrary code, and some abbrevs don't just
replace text with something else but also prompt and/or move point
(e.g. skeletons). So running expand-abbrev from
visual-basic-newline-and-indent just doesn't sound right since it may
conflict with user-defined abbreviations.

I.e. the problem you're seeing can also happen in Emacs-22 depending on
the user's own abbreviations. So the VBM code either needs
a save-excursion, or needs to refrain from calling expand-abbrev from
visual-basic-newline-and-indent.


Stefan

Glenn Morris

unread,
Oct 5, 2011, 11:52:54 PM10/5/11
to 4356...@debbugs.gnu.org
tags 4356 wontfix
stop

Closing based on this:

0 new messages