Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using: GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-03-25 on allspice, modified by Debian

I am trying to do some simple find and replace. Not a big deal. I'm not even using regex. This is simple string replacement. META-%, String1, String2. Should be simple. Lately, I've been getting a really weird error that I don't understand. From Messages ;

Mark set
replace-match-maybe-edit: Args out of range: 597, 607

I have a longish .sql file open and I wanted to change some date strings. I entered both strings and then hit the exclamation point to tell emacs I want to change ALL of the strings available and I got this weird Args out of range error. I've gotten this several times lately. A few days ago I did play around with ECB, which I decided to not use but I'm pretty sure I've removed all of the ECB stuff from my init.el. There's some cruft in there, but nothing ridiculous and this error only started in the last couple of days.

I've done some Googling but I can't seem to find anything. Thoughts?

In my most recent example, I was replacing a date string:

Query replace (default 2012-04-01 -> 2001-01-01): 

In other instances over the past few days, I've done simpler find and replaces with similar results.

share|improve this question
I just tried the exact same search and replace on a smaller section of the .sql file and this time I tried to go through each instance of String1 and hit 'Y' to let emacs change it. The very first time I hit 'Y', I got the same error, down to the 597, 607 parts. So, it is not connected to me trying to replace all instanced of String1 with String2. – Choens Aug 22 '12 at 15:40
Can you give an example of the strings you are trying to match/replace? – terdon Aug 22 '12 at 15:42
I then reopened my init.elc, added a BLANK line, saved, and recompiled (and reloaded without leaving emacs). After that, I was able to return to my .sql file and successfully complete my find-and-replace command. – Choens Aug 22 '12 at 15:43
I added an example, but I've had this happen on both simple and complex find-and-replace attempts. I've been reading over my init.elc to see if something silly slipped in but I don't see anything odd. – Choens Aug 23 '12 at 16:10

Either something in (or loaded by) your init file is interfering with the normal replace.el code (e.g. advising it) or that code has a bug. You should never see an Args out of range error.

replace-match-maybe-edit is defined in library replace.el. In your init file, do (load-library "replace.el") and then (debug-on-entry 'replace-match-maybe-edit), then step through the debugger to see what goes wrong.

Alternatively, if you think something in your init file is causing the problem, bisect your init file recursively until you find the culprit code.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .