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" [SOLVED] Date: Tue, 05 Apr 2011 23:39:39 -0400 Message-ID: <4D9BE07B.2060204@mousecar.com> References: <4D90D85C.5060805@mousecar.com> <4D98EE5B.4080108@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 1302061427 9159 80.91.229.12 (6 Apr 2011 03:43:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 6 Apr 2011 03:43:47 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 06 05:43:37 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 1Q7Jeb-0005KI-0Y for geh-help-gnu-emacs@m.gmane.org; Wed, 06 Apr 2011 05:43:37 +0200 Original-Received: from localhost ([127.0.0.1]:52719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7Jea-0003ZE-7z for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Apr 2011 23:43:36 -0400 Original-Received: from [140.186.70.92] (port=40539 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7Jau-0000tK-MH for help-gnu-emacs@gnu.org; Tue, 05 Apr 2011 23:39:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7Jat-0005MH-LB for help-gnu-emacs@gnu.org; Tue, 05 Apr 2011 23:39:48 -0400 Original-Received: from mout.perfora.net ([74.208.4.194]:57316) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7Jat-0005Lu-ER for help-gnu-emacs@gnu.org; Tue, 05 Apr 2011 23:39:47 -0400 Original-Received: from dellap.mousecar.net (dsl093-011-016.cle1.dsl.speakeasy.net [66.93.11.16]) by mrelay.perfora.net (node=mrus0) with ESMTP (Nemesis) id 0MFN5o-1QCnl40hdM-00FBI4; Tue, 05 Apr 2011 23:39:45 -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:HAy/9kxrRfAu5lCKt7ZzV0rS4TCJILoDqoWf07kaP3Y pCN3qkXL8H+YoCDrNK5JgYKyCEHRnjuoPmu9m4LOGMVSfHr10M RyHv0VfUX81HMo//LCCDJLtA8e7seSI2JCNv8YawRCyZDHaAVf IS98Sy8EVxKXgxcRtAC95X/xbwc7IUxN/NWSAxOHB3bT/On7am Ogefyg23qHF+0MAMQNU3VaGFwrX5/ZruaccRB1FKJg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.208.4.194 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:80624 Archived-At: On 04/04/2011 09:56 PM Stefan Monnier wrote: >> Here's the relevant code fragment: > >> (if (re-search-forward aname-re-str head-text-end-pt t) >> (progn >> (setq aname-str (match-string 2)) >> (setq head-text-nested (match-string 4)) >> (if (equal head-text-nested "") >> (progn >> (setq head-text-nested (create-heading-text)) >> (if (equal aname-str "") >> (progn >> (setq aname-str (create-aname head-text-nested)) >> (replace-match head-text-nested t nil nil 4) >> (replace-match aname-str t nil nil 2)) >> (replace-match head-text-nested t t nil 4))) ;ERROR: > > An obvious part to heck is create-heading-text: if it might ever call > a regexp-matching function, then you have a problem. > > > Stefan Stefan, You pointed to the right function... well, it was actually both. But the problem wasn't a search, but with the read-from-minibuffer function. For some reason, invoking that wipes out all the subexpressions.