GNU bug report logs - #4356
23.1.50; expand-abbrev changes point erroneously

Previous Next

Package: emacs;

Reported by: Vincent Belaïche <vincent.b.1 <at> hotmail.fr>

Date: Sun, 6 Sep 2009 10:35:04 UTC

Severity: normal

Tags: wontfix

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Vincent Belaïche <vincent.b.1 <at> hotmail.fr>
Cc: 4356 <at> debbugs.gnu.org
Subject: bug#4356: 23.1.50; expand-abbrev changes point erroneously
Date: Tue, 15 Sep 2009 22:46:00 -0400
> 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 <at> 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





This bug report was last modified 13 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.