emacs-devel
[Top][All Lists]
Advanced

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

Re: Thinking about changed buffers


From: Phillip Lord
Subject: Re: Thinking about changed buffers
Date: Tue, 29 Mar 2016 23:26:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> The only solution I can see for fill-paragraph is to copy the paragraph to
>> a temp buffer, fill that, check whether it has changed, then if it has,
>> signal before-change, copy the changed paragraph back, signal after
>> change. If it has not changed, then fill-paragraph becomes a no-op.
>
> BTW, another solution for fill-paragraph is to reimplement it from
> scratch such that it doesn't "unfill+refill".  I.e. it could instead
> loop go to each LF in the paragraph, such if that LF is found to be "at
> the right spot", it moves on, if it's "too soon", then it removes it,
> and if it's "too far" then it adds another somewhere earlier.
>
> This would naturally lead to the result that the buffer would stay
> unmodified if there was no change.


Yes, that would seem a clean solution, as it would avoid changing a
buffer which might not need to be changed. It would also mean that a
fill-paragraph which doesn't change anything would leave no undo events.

Phil



reply via email to

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