bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stefan Monnier
Subject: bug#4356: 23.1.50; expand-abbrev changes point erroneously
Date: Tue, 15 Sep 2009 22:46:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> 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 (monnier@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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]