From: Stephen Berman <stephen.berman@gmx.net>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: insert gives args out of range
Date: Sat, 17 Aug 2024 00:26:56 +0200 [thread overview]
Message-ID: <87ttfkkssv.fsf@gmx.net> (raw)
In-Reply-To: <CtSHGb31T_nVfYbFzelKJridg0C5BxyfNlyJBjnlv-16FXFIoy2gfU2LNL8oM1WjhYk6PioC2DGTGuXl6J2Ee3zFcq8TDjud2avuJHdcuJE=@protonmail.com> (Heime's message of "Fri, 16 Aug 2024 21:47:07 +0000")
On Fri, 16 Aug 2024 21:47:07 +0000 Heime <heimeborgia@protonmail.com> wrote:
> On Saturday, August 17th, 2024 at 9:29 AM, Stephen Berman
> <stephen.berman@gmx.net> wrote:
>
>> On Fri, 16 Aug 2024 17:32:49 +0000 Heime heimeborgia@protonmail.com wrote:
>>
>> > On Saturday, August 17th, 2024 at 3:34 AM, Stephen Berman
>> > stephen.berman@gmx.net wrote:
>> >
>> > > On Fri, 16 Aug 2024 15:21:12 +0000 Heime heimeborgia@protonmail.com wrote:
>>
>> [...]
>>
>> > > > I have solved the problem by adding (forward-line 1) after setting
>> > > > blank-lines
>> > > >
>> > > > (while (and (< blank-lines 2)
>> > > > (re-search-forward "^\\s-*$" nil t))
>> > > > (setq blank-lines (1+ blank-lines))
>> > > > ;; Move point forward to avoid re-matching the same blank line
>> > > > (forward-line 1))
>> > > >
>> > > > Could this fail on some circumstances ?
>> > >
>> > > Depends on what you consider failure: with the buffer "test" I gave as
>> > > an example above, output-buffer contains not just two but three empty
>> > > lines between the two defuns, and not just one but two empty lines at
>> > > the end; is that what you want?
>> > >
>> > > Steve Berman
>> >
>> > By failure, I mean this: Could Emacs fire an error buffer based on
>> > some unforeseen structure of the file when re-search-forward
>> > executes ?
>>
>>
>> Yes. Steve Berman
>
> Perhaps you can help me write an improved, more robust implementation,
> if the problem is evident.
If you post code and I see problems with it I can point them out and may
be able to suggest improvements, but I can make no useful response to
vague questions like whether the code could fail in "some circumstances"
or "based on some unforeseen structure of the file".
Steve Berman
next prev parent reply other threads:[~2024-08-16 22:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 9:24 insert gives args out of range Heime
2024-08-16 9:54 ` Stephen Berman
2024-08-16 10:20 ` Heime
2024-08-16 10:59 ` Heime
2024-08-16 11:51 ` Stephen Berman
2024-08-16 12:03 ` Heime
2024-08-16 12:10 ` Heime
2024-08-16 12:26 ` Stephen Berman
2024-08-16 15:01 ` Heime
2024-08-16 15:09 ` Heime
2024-08-16 15:16 ` Stephen Berman
2024-08-16 15:21 ` Heime
2024-08-16 15:34 ` Stephen Berman
2024-08-16 17:32 ` Heime
2024-08-16 21:29 ` Stephen Berman
2024-08-16 21:47 ` Heime
2024-08-16 22:26 ` Stephen Berman [this message]
2024-08-17 9:47 ` Heime
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ttfkkssv.fsf@gmx.net \
--to=stephen.berman@gmx.net \
--cc=heimeborgia@protonmail.com \
--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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).