[Top][All Lists]

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

Re: substring and search

From: Greg Hill
Subject: Re: substring and search
Date: Mon, 28 Jan 2002 13:07:45 -0800


The 431 is the position in the current buffer of the "c" found by the search-forward command. The 7 is the length of the string "abcdefg". The error message is trying to tell you that you are asking for the substring starting with the 431st character in a 7-character string, which obviously makes no sense.

Apparently you are trying to use the substring function to do something it is not intended to do. See section 4.3 of the GNU Emacs List Reference Manual for a description of the substring function and how it is intended to be used.

What ARE you trying to do, anyway? If you can tell us that, we can point you to the correct function.


At 2:16 PM +0100 1/28/02, Stephen Berman wrote:
Evalling the following expression:

(substring "abcdefg" (progn (beginning-of-line) (search-forward "c")))

yields the error "Args out of range: "abcdefg", 16, 7" (assuming the
expression is on the first line of a buffer).  Why is this?  And what
does "7" in the error message refer to?  It appears no matter where
the above sexp is evalled, e.g.:

(substring "abcdefg" (progn (beginning-of-line) (search-forward "c")))
=> Args out of range: "abcdefg", 431, 7

(search-backward also yields a corresponding error message, as do the
re-search functions.)

--Steve Berman

Help-gnu-emacs mailing list

reply via email to

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