unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: query-replace ']->].' with ']->' fails horribly: C++ c-version 5.31.1
       [not found] <1137216906.22193.27.camel@localhost.localdomain>
@ 2006-01-20 12:48 ` Alan Mackenzie
  0 siblings, 0 replies; only message in thread
From: Alan Mackenzie @ 2006-01-20 12:48 UTC (permalink / raw)
  Cc: Martin Schwenke

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)




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-20 12:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1137216906.22193.27.camel@localhost.localdomain>
2006-01-20 12:48 ` query-replace ']->].' with ']->' fails horribly: C++ c-version 5.31.1 Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).