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

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

bug#36328: 26.2; Args out of range on search-and-replace of *.cc file


From: Alan Mackenzie
Subject: bug#36328: 26.2; Args out of range on search-and-replace of *.cc file
Date: Sun, 23 Jun 2019 12:22:07 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Jayden.

On Sat, Jun 22, 2019 at 15:38:25 -0700, Jayden Navarro wrote:
> I've figured out the trigger! I setup a CentOS 7 VM and installed Emacs
> 26.2.90 and couldn't repro on it. So I compared all the environment
> variables between Cygwin and the VM and performed some tests, and
> discovered the issue is triggered by my "TERM" environment variable being
> set to "xterm-256color".

Well done!

> I could reproduce on the clean VM using: TERM="xterm-256color" emacs -Q
> test.cc

In my X-Windows setup, an xterm has the setting of TERM anyway.  So I was
able to reproduce the failure with emacs -Q -nw.  -nw means "no windows",
i.e. run in the terminal, not as a GUI application.  (Normally, I run
Emacs in a linux virtual terminal.)

> Launching Emacs in that way, and following the other steps given above,
> should allow you to reproduce.

Yes.  It didn't take me too long to track down where it's going wrong.
`perform-replace' calls `replace-highlight' to highlight the "foo", and
this calls `isearch-lazy-highlight-new-loop'.  This in its turn performs
a redisplay (which is probably where CC Mode affects things).  It seems
too much to expect that the "match-data" will be preserved over all this
activity, but `perform-replace' does expect this.

To fix this will involve putting a `save-match-data' around some form
somewhere.  Please allow us some time to decide where this would be best.

> On Sat, Jun 22, 2019 at 2:27 PM Jayden Navarro <jayden@yugabyte.com> wrote:

> > Hi Alan,

> > Yes, you are completely correct :-) Posted one thing but unintentionally
> > took a "shortcut" when producing the backtrace (not a smart thing to do
> > when trying to get people to repro...).

> > Here's the backtrace when doing doing M-% foo <RET> bar <RET> (note that
> > it's still 0, 1 not 0, 3!):

I still have no specific idea what's generating that 0 and 1.  Will
probably never find out.

> > Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
> >   buffer-substring-no-properties(0 1)
> >   perform-replace("foo" "bar" t nil nil nil nil nil nil nil nil)
> >   query-replace("foo" "bar" nil nil nil nil nil)
> >   funcall-interactively(query-replace "foo" "bar" nil nil nil nil nil)
> >   call-interactively(query-replace nil nil)
> >   command-execute(query-replace)

> Best,
> Jayden

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

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