From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: error in replace-match: "args out of range" Date: Sun, 27 Mar 2011 16:12:55 -0400 Message-ID: <4D8F9A47.6090104@mousecar.com> References: <4D8F2752.2070604@mousecar.com> Reply-To: gebser@mousecar.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1301256864 25561 80.91.229.12 (27 Mar 2011 20:14:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 Mar 2011 20:14:24 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Alan Mackenzie Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 27 22:14:20 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q3wLp-0008H6-Jz for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Mar 2011 22:14:17 +0200 Original-Received: from localhost ([127.0.0.1]:54040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q3wLp-0004nN-1o for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Mar 2011 16:14:17 -0400 Original-Received: from [140.186.70.92] (port=53667 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q3wLS-0004n7-Ja for help-gnu-emacs@gnu.org; Sun, 27 Mar 2011 16:13:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q3wLQ-00031r-Vi for help-gnu-emacs@gnu.org; Sun, 27 Mar 2011 16:13:54 -0400 Original-Received: from mout.perfora.net ([74.208.4.195]:61560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q3wLQ-00031U-Pt for help-gnu-emacs@gnu.org; Sun, 27 Mar 2011 16:13:52 -0400 Original-Received: from dellap.mousecar.net (dsl093-011-016.cle1.dsl.speakeasy.net [66.93.11.16]) by mrelay.perfora.net (node=mrus2) with ESMTP (Nemesis) id 0Mg3mH-1QOcWM0o2H-00Ny4H; Sun, 27 Mar 2011 16:13:50 -0400 User-Agent: Thunderbird 2.0.0.24 (X11/20101213) In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=5AD091E7 X-Provags-ID: V02:K0:e0cBkl/xN0IJ2alzVPNHkBnmGxMWHxtKdeh5xpzgRuE U2JKCsgRFNAGe45z3k2hXvpT/Fm6V4ll8IZQGtZpUL+E1sIma0 h0x0Qn2ZA+qFJlsLgomkqLDO6dl5UJXpFpjvrEhW8FIXSLPtSk B9mB6uFlzdzA1X7Vc8yOM0xhhWohy2e6ooZaYq5S84mRmzH9Rb mjKR6aLD+aboxyOAegL+8KFRl5ScyqGZyeXe2wD1jM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.208.4.195 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80479 Archived-At: On 03/27/2011 03:07 PM Alan Mackenzie wrote: > Hi, Ken. > > ken wrote: >> On 03/27/2011 08:02 AM ken wrote: >>> replace-match works fine in a couple instances in one function, but this >>> instance (in the same function) it doesn-- 't. I get the error msg below >>> about the arguments being out of range. I'm guessing the problem is >>> with the 4th arg, the one beginning: #(">> "(fontified ..." cruft in it... is that confusing replace-match...? Or >>> might I have just the totally wrong type arg there? > >>> Debugger entered--Lisp error: (args-out-of-range -1 -1) >>> replace-match("Text for Heading" t nil #(">> name=\"Testing-TOC-Header\">" 0 1 (fontified t face >>> font-lock-function-name-face) 1 2 (fontified t face html-tag-face) 2 3 >>> (fontified t) 3 8 (fontified t face font-lock-variable-name-face) 8 9 >>> (fontified t face font-lock-string-face) 9 27 (fontified t face >>> font-lock-string-face) 27 28 (fontified t face font-lock-string-face) 28 >>> 29 (fontified t face font-lock-function-name-face) 29 30 (fontified t >>> face font-lock-function-name-face) 30 32 (fontified t face >>> html-tag-face) 32 33 (fontified t face font-lock-function-name-face)) 4) >>> eval((replace-match head-text-nested t nil head-text 4)) > > >> Still groping for a resolution.... Here's something that might be >> relevant. > >> The immediately preceding re-search-forward was successful. However, >> the subexpression which matched (#4) is a null string, i.e., "". So the >> question: Will replace-match replace an empty string with specified >> text...? in effect *inserting* text at the location of the specified >> (albeit nil) subexpression? > Hi, Alan, Sorry, I forget that you guys aren't here in my livingroom and uptodate on what I'm doing. So, yeah, there's a bit of context I should have given. > You'll be far more likely to get help if you give some basic details. > WhIch Emacs version are you using (M-x emacs-version)? v.23.1.1 YSU, I know. > What major mode > are you in? What minor modes (if any) are active? What did you ACTUALLY > DO (exactly which keys did you press) to cause the error. This is an emacs script I'm writing (so in emacs-lisp mode); sometimes I run this in edebug. The script is meant to run on HTML files of whatever mode; I'm not requiring that it be run in any particular mode, just valid html. I use html-helper-mode, but that's probably irrelevant to this problem. > Can you make > the error happen in a small enough buffer to post? If so, do it! > > The idea is to help somebody reproduce the error with the minimum amount > of work. That would be hard. The little bit of code above is buried in the middle of a function with enough going on inside that it would take too much explanation... people would run away from all I'd have to write about it. > > Incidentally, there's a section on bug reporting in the Emacs Manual on > page "Bugs". To get to it, do C-h i, m emacs, g bugs. Thanks, I'll keep that in mind. I'm not saying this is a bug though. I don't know if what I'm getting is normal behavior or not. I'm more asking after non-documented behavior of replace-match. Or maybe I should be using a different function. Thanks for the pointers.