Subject: Re: bug#13949: 24.4.1; `fill-paragraph' should not always put the buffer as modified

From: Lars Magne Ingebrigtsen <[email-masked]>
Date: Sun, 27 Mar 2016 17:46:53 +0200

Eli Zaretskii <[email-masked]> writes:

>> +  (when (and (not (string= h ""))
>> +             (string= h (secure-hash 'md5 (current-buffer))))
>> +    (set-buffer-modified-p nil)))
>
> Thanks, but I'm not sure computing the hash is enough: the functions
> involved in refilling can change text properties, so the test should
> also account for that.

True.  Do we have an efficient way to get the text properties, too?  (I
mean, without doing a `buffer-substring'...)

Hm...  looking at `secure-hash', it seems incredibly inefficient.
(Unless I'm misreading the code.)  All the coding system conversion
stuff is completely irrelevant for this usage...  

What we basically need is a fast hashing function for the buffer,
including text properties.  So it would basically do:

1) move the gap out of the way
2) call the hashing function on the buffer contents
c) call the hashing function on the text properties
4) hash them together

This should be really fast, I think?  If the text properties are
available in a fashion where we can do some hashing on them without
copying them around a lot.  And I know nothing about how text properties
are represented.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no