help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: [External] : How to get all paragraphs in list?


From: Drew Adams
Subject: RE: [External] : How to get all paragraphs in list?
Date: Wed, 7 Sep 2022 15:04:07 +0000

> From: Yuri Khan
>
> >       (while (< (point) end)
> >         (funcall function)
> >         (forward-paragraph)))))
> 
> This loop is fragile: if FUNCTION moves point backward in the buffer,
> it may loop infinitely, or if it moves forward, it may skip some
> paragraphs. I’d maybe wrap the funcall in a save-excursion.
> 
> More to the point[sic], you calculate and cache the END position as an
> integer. So if your FUNCTION reduces the length of the buffer text,
> you may never reach END. Should probably place a marker there, or
> check for (region-end) or (point-max) every time.

What Yuri said.

And I pointed you to using the debugger, if you
want to see and understand just what's going on
in your code.  You can also insert calls to
`message' in it at various places, to print values.

And you can insert calls to `debug' in it, as
breakpoints - e.g. (debug nil EVAL-ME1 EVAL-ME2...).

reply via email to

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