[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to remove the "read-only" property...
From: |
Visuwesh |
Subject: |
Re: How to remove the "read-only" property... |
Date: |
Sun, 28 Aug 2022 13:12:08 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
[ஞாயிறு ஆகஸ்ட் 28, 2022] Davin Pearson wrote:
>
> I have written some code that makes the first line read-only:
>
> (save-excursion
> (goto-char (point-min))
> (set-text-properties (point-at-bol) (point-at-eol) '(read-only t))
> )
>
> When I try to remove all text-properties:
>
> (condition-case err
> (save-excursion
> (set-text-properties (point-min) (point-max) nil))
> (error
> (message "dmp-error:err=%s" err)))
>
> It barfs with the following error message:
>
> dmp-error:err=(text-read-only)
>
> How do I go about removing the read-only property of the text?
‘read-only’
If a character has the property ‘read-only’, then modifying that
character is not allowed. Any command that would do so gets an
error, ‘text-read-only’. If the property value is a string, that
string is used as the error message.
Insertion next to a read-only character is an error if inserting
ordinary text there would inherit the ‘read-only’ property due to
stickiness. Thus, you can control permission to insert next to
read-only text by controlling the stickiness. *Note Sticky
Properties::.
Since changing properties counts as modifying the buffer, it is not
possible to remove a ‘read-only’ property unless you know the
special trick: bind ‘inhibit-read-only’ to a non-‘nil’ value and
then remove the property. *Note Read Only Buffers::.
>From (info "(elisp) Special Properties")