all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ken <gebser@mousecar.com>
To: Alan Mackenzie <acm@muc.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: error in replace-match: "args out of range"
Date: Sun, 27 Mar 2011 16:12:55 -0400	[thread overview]
Message-ID: <4D8F9A47.6090104@mousecar.com> (raw)
In-Reply-To: <imo1u5$1gud$1@colin2.muc.de>

On 03/27/2011 03:07 PM Alan Mackenzie wrote:
> Hi, Ken.
> 
> ken <gebser@mousecar.com> 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: #("<a ... yes?  There's a lot of
>>> "(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 #("<a
>>> name=\"Testing-TOC-Header\"></a>" 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.






  reply	other threads:[~2011-03-27 20:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27 12:02 error in replace-match: "args out of range" ken
2011-03-27 18:25 ` ken
     [not found] ` <mailman.3.1301250397.12231.help-gnu-emacs@gnu.org>
2011-03-27 19:07   ` Alan Mackenzie
2011-03-27 20:12     ` ken [this message]
     [not found] <mailman.3.1301227401.14102.help-gnu-emacs@gnu.org>
2011-03-28 15:38 ` Stefan Monnier
2011-03-28 18:50   ` ken
2011-03-28 20:32     ` Stefan Monnier
2011-04-03 22:02       ` ken
2011-04-03 23:19         ` PJ Weisberg
2011-04-04 16:13           ` ken
     [not found]           ` <mailman.1.1301933608.12491.help-gnu-emacs@gnu.org>
2011-04-04 22:21             ` Tim X
2011-04-07 16:29               ` ken
     [not found]               ` <mailman.0.1302193756.25199.help-gnu-emacs@gnu.org>
2011-04-07 23:25                 ` Tim X
2011-04-09  4:56                   ` ken
2011-04-09  6:44                     ` PJ Weisberg
2011-04-09 12:35                       ` ken
     [not found]                       ` <mailman.2.1302352549.29796.help-gnu-emacs@gnu.org>
2011-04-09 12:57                         ` David Kastrup
2011-04-09 20:04                           ` PJ Weisberg
2011-04-09 21:25                             ` Perry Smith
2011-04-05  1:56             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D8F9A47.6090104@mousecar.com \
    --to=gebser@mousecar.com \
    --cc=acm@muc.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.