[Top][All Lists]

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

Re: Text Properties And Buffer Modification

From: Eli Zaretskii
Subject: Re: Text Properties And Buffer Modification
Date: Wed, 05 Dec 2018 08:33:05 +0200

> From: "T.V Raman" <address@hidden>
> Date: Tue, 04 Dec 2018 15:39:31 -0800
> At present, modifying text properties (adding, removing or changing
> properties) markes the buffer as  modified.
> Since property changes are mostly cosmetic, is there a good reason why
> this is so?

Because text properties are part of the buffer text: if you copy some
of the text into another place, the properties go there as well.

> Given the present state of buffer-modified status with respect to
> text-properties, one  has to be fairly careful e.g.
> naively writing 
> (with-silent-modifications (put-text-property ...))
> will work *most of the time* except when you say something like:
> (with-silent-modifications 
>   (put-text-property beg end 'face 'bold other-buffer))
> you actually need to write this:
> (with-silent-modifications 
>   (with-current-buffer other-buffer 
>     (put-text-property beg end 'face 'bold other-buffer)))

You could instead simply make the target buffer not modified after you
are done changing the properties, e.g. by using set-buffer-modified-p.

reply via email to

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