emacs-devel
[Top][All Lists]
Advanced

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

Re: query-replace ']->].' with ']->' fails horribly: C++ c-version 5.31.


From: Alan Mackenzie
Subject: Re: query-replace ']->].' with ']->' fails horribly: C++ c-version 5.31.1
Date: Fri, 20 Jan 2006 12:48:23 +0000 (GMT)

Hi, Rusty, Hi, Emacs!

On Sat, 14 Jan 2006, Rusty Russell wrote:

>GNU Emacs 21.4.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
>2005-10-03 on trouble, modified by Debian

>foo.cpp:

>int foo()
>{
>       u[i]->].hp = 0;
>}


>M-% ]->]. ]-> gives:

>int foo()
>{
>       u[i]->>].hp = 0;
>}

>This is really odd!

Agreed!

With Emacs 21.3, CC Mode 5.28, I don't get the bug.

With Emacs 21.3, CC Mode 5.31.n, the bug hits me.

Rusty, it appears to be an obscure, complicated bug involving
the interaction of two (or several) distinct parts of Emacs, one of them
definitely being CC Mode.  I'm confident we can track it down, though.

The rest of this post is directed mainly at the geniuses in emacs-devel.
:-)

>Works on C files, though.  Go figure.  I had to install c-mode 5.31.1
>because the font-locking the following chews 100% of CPU using the
>default C mode, on certain things.  This is fixed in 5.31.1.

With 21.3/5.31.n, going through the various modes in CC mode, it seems to
work OK for C, Java, Pike, and Awk, but fails for C++, Objective C, and
IDL (where we get "u[i]->->].hp")

With Emacs 22 (CVS), the bug doesn't show at all.  (I'm not convinced
it's been fixed, though: see below).

#########################################################################

Emacs 21.3, CC Mode 5.31.n, Rusty's file in C++ Mode: Instrument
`perform-replace' (replace.el) for Edebug.

Step through to Line 1048:

  ((eq def 'act)
   (or replaced
       (progn
         (replace-match next-replacement nocasify literal)  ;<==== L1048
         (setq replace-count (1+ replace-count))))
   (setq done t replaced t))

Just before executing `replace-match', evaluate (match-data):

    e (match-data) => (20 25)

Just after executing `replace-match', evaluate (match-data) again:

    e (match-data) => (#<marker at 21 in foo.cpp> #<marker at 23 in foo.cpp>)

This is surely a bug - replace-match should not change match-data at all,
should it?  Is this a known bug, and has it been fixed for Emacs 22 yet?
I've skimmed through the CVS log for search.c, but haven't seen anything
looking like a fix to `replace-match'.

>Cheers!
>Rusty.

-- 
Alan Mackenzie (Munich, Germany)






reply via email to

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