[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Run `fill-paragraph' on all the paragraphs in the currently opened L
Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
Mon, 18 Oct 2021 16:56:57 +0800
On Mon, Oct 18, 2021 at 12:43 PM Yuri Khan <firstname.lastname@example.org> wrote:
> On Mon, 18 Oct 2021 at 07:22, Hongyi Zhao <email@example.com> wrote:
> > > Why do you even want that?
> > I use SyncTeX to do the forward and backward search, which is based on
> > linefeed separated line to locate the position in the source LaTeX
> > document. If a paragraph is arranged in one line, the backward search
> > will always jump to a very inaccurate location.
> I’m not suggesting
> keeping each paragraph as a single long line.
> What I’m suggesting is
> dividing paragraphs into sentences
> and sentences into phrases
> while keeping each line reasonably short
> but without trying to cram as much as possible into each line.
> (This mail uses semantic line breaks,
> as a demonstration.)
So the idea suggested by Emanuel Berg and you now can be combined into
Iterate the whole buffer line-by-line with a semantic line as the unit
block, and check
each line if it starts with '\' or not, e.g. with (looking-at
"\\\\"). When you find one "beg", start looking for where it
ends, and when you find that push (beg end) onto a list.
Then loop through the list and do (fill-region beg end) for each
list pair item ...