From: Visuwesh <visuweshm@gmail.com>
To: Davin Pearson <davin.pearson@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: How to remove the "read-only" property...
Date: Sun, 28 Aug 2022 13:12:08 +0530 [thread overview]
Message-ID: <87ilmcu84v.fsf@gmail.com> (raw)
In-Reply-To: <CAG9ihEsa3+nMLq3Y2noijhJjuMnGfawLO3_s2iSyw_5MM2NqAg@mail.gmail.com> (Davin Pearson's message of "Sun, 28 Aug 2022 19:27:07 +1200")
[ஞாயிறு ஆகஸ்ட் 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")
next prev parent reply other threads:[~2022-08-28 7:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-28 7:27 How to remove the "read-only" property Davin Pearson
2022-08-28 7:39 ` Emanuel Berg
2022-08-28 7:47 ` Davin Pearson
2022-08-28 7:55 ` Davin Pearson
2022-08-28 8:18 ` Eli Zaretskii
2022-08-28 9:04 ` Basil L. Contovounesios
2022-08-29 5:05 ` Davin Pearson
2022-08-29 12:46 ` Stefan Monnier
2022-08-29 17:32 ` Stefan Kangas
2022-08-28 7:42 ` Visuwesh [this message]
2022-08-28 8:16 ` Eli Zaretskii
2022-08-28 15:11 ` Stefan Monnier
2022-08-28 15:34 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ilmcu84v.fsf@gmail.com \
--to=visuweshm@gmail.com \
--cc=davin.pearson@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).