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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4356 in the body.
You can then email your comments to 4356 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4356; Package emacs. (Sun, 06 Sep 2009 10:35:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincent Belaïche <vincent.b.1 <at> hotmail.fr>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 06 Sep 2009 10:35:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Vincent Belaïche <vincent.b.1 <at> hotmail.fr>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.1.50; expand-abbrev changes point erroneously
Date: Sun, 06 Sep 2009 12:30:26 +0200
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.

BR,
   Vincent.


-----------------------------------------------------------------------


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
d:/Programme/GNU/Emacs/etc/DEBUG for instructions.


In GNU Emacs 23.1.50.1 (i386-mingw-nt5.0.2195)
 of 2009-07-25 on COCOTTE
Windowing system distributor `Microsoft Corp.', version 5.0.2195
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: FRA
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  recentf-mode: t
  mail-abbrevs-mode: t
  iswitchb-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<left> <return> C-x 1 <down> <down> C-SPC <end> <left> 
<C-insert> C-x b * s c <tab> ( r e q u i r e SPC ' 
c a l c - e x t ) <return> ( l a t SPC ( <backspace> 
<backspace> <backspace> <backspace> e t SPC ( c a l 
c - c o m m a n d ) <C-left> <C-left> C-h f C-g C-h 
v c a l c - c <tab> o <tab> <backspace> <backspace> 
<backspace> <tab> <backspace> <backspace> <backspace> 
<backspace> <backspace> C-g <end> <return> <tab> ( 
c a l c - r a d i x SPC 1 <backspace> 7 ) <return> 
<tab> ( c a l c - e v a l SPC 1 0 à ) <backspace> <backspace> 
) <left> <left> <left> " " SPC <left> <left> $ <end> 
) M-x e v a l - b u f <tab> <return> C-x C-e <C-left> 
<C-left> <C-left> C-h f <return> C-h i m d <backspace> 
c a l <tab> <return> C-x 1 <C-end> <up> <up> <up> <up> 
<up> <up> <right> <right> <right> <down> <return> C-s 
c a l c <kp-subtract> e v <C-end> <up> <C-home> m e 
v a l <return> C-x b <return> <end> <C-left> <C-left> 
<C-right> <right> <right> <delete> <kp-1> <kp-0> <right> 
<delete> <delete> <delete> <end> C-x C-e <up> <up> 
<up> <down> <up> <return> C-y <up> <home> C-k C-k <down> 
<up> <tab> <down> C-k C-k C-k C-k <tab> <end> <backspace> 
<home> ( m e s s a g z e SPC <backspace> <backspace> 
<backspace> e SPC " 1 0 SPC e n SPC b a s e SPC 7 = 
% s " SPC <end> ) M-x <up> <return> <up> <up> <home> 
C-SPC <C-end> <C-insert> <help-echo> M-x r e p o r 
<tab> b <tab> <tab> e m <tab> <return>

Recent messages:
Composing main Info directory...done
Mark set
Mark saved where search started
Mark set [2 times]
Number radix is 7
"7#13"
Mark set
10 en base 7=7#13
Mark set
Making completion list...

Load-path shadows:
d:/Programme/GNU/emacs-extension/cedet/speedbar/speedbar hides d:/Programme/GNU/Emacs/lisp/speedbar
d:/Programme/GNU/emacs-extension/cedet/speedbar/sb-image hides d:/Programme/GNU/Emacs/lisp/sb-image
d:/Programme/GNU/emacs-extension/cedet/common/ezimage hides d:/Programme/GNU/Emacs/lisp/ezimage
d:/Programme/GNU/emacs-extension/cedet/speedbar/dframe hides d:/Programme/GNU/Emacs/lisp/dframe
c:/Documents and Settings/Vincent/Application Data/.emacs.d/etc/custom hides d:/Programme/GNU/Emacs/lisp/custom





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4356; Package emacs. (Wed, 16 Sep 2009 02:55:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 16 Sep 2009 02:55:08 GMT) Full text and rfc822 format available.

Message #10 received at 4356 <at> emacsbugs.donarmstrong.com (full text, mbox):

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: Re: 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





Added tag(s) wontfix. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 06 Oct 2011 03:54:02 GMT) Full text and rfc822 format available.

Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 06 Oct 2011 03:54:02 GMT) Full text and rfc822 format available.

Notification sent to Vincent Belaïche <vincent.b.1 <at> hotmail.fr>:
bug acknowledged by developer. (Thu, 06 Oct 2011 03:54:02 GMT) Full text and rfc822 format available.

Message #17 received at 4356-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 4356-done <at> debbugs.gnu.org
Subject: Re: bug#4356: 23.1.50; expand-abbrev changes point erroneously
Date: Wed, 05 Oct 2011 23:52:54 -0400
tags 4356 wontfix
stop

Closing based on this:

> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Nov 2011 11:24:06 GMT) Full text and rfc822 format available.

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

Previous Next


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