* How to remove the "read-only" property...
@ 2022-08-28 7:27 Davin Pearson
2022-08-28 7:39 ` Emanuel Berg
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Davin Pearson @ 2022-08-28 7:27 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 519 bytes --]
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?
TIA,
Davin
[-- Attachment #2: Type: text/html, Size: 686 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
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
` (2 more replies)
2022-08-28 7:42 ` Visuwesh
` (3 subsequent siblings)
4 siblings, 3 replies; 13+ messages in thread
From: Emanuel Berg @ 2022-08-28 7:39 UTC (permalink / raw)
To: emacs-devel
Davin Pearson wrote:
> (set-text-properties (point-at-bol) (point-at-eol) '(read-only t))
FYI
This function is obsolete since 29.1; use
‘line-beginning-position’ instead.
This function is obsolete since 29.1; use
‘line-end-position’ instead.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
2022-08-28 7:39 ` Emanuel Berg
@ 2022-08-28 7:47 ` Davin Pearson
2022-08-28 7:55 ` Davin Pearson
2022-08-29 5:05 ` Davin Pearson
2 siblings, 0 replies; 13+ messages in thread
From: Davin Pearson @ 2022-08-28 7:47 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 595 bytes --]
(insert (prin1-to-string emacs-version)) => "28.1"
(insert (prin1-to-string system-type)) => gnu/linux
Should I upgrade to Emacs 29.1 ?
On Sun, 28 Aug 2022 at 19:40, Emanuel Berg <incal@dataswamp.org> wrote:
> Davin Pearson wrote:
>
> > (set-text-properties (point-at-bol) (point-at-eol) '(read-only t))
>
> FYI
>
> This function is obsolete since 29.1; use
> ‘line-beginning-position’ instead.
>
> This function is obsolete since 29.1; use
> ‘line-end-position’ instead.
>
> --
> underground experts united
> https://dataswamp.org/~incal
>
>
>
[-- Attachment #2: Type: text/html, Size: 1056 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
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
2 siblings, 2 replies; 13+ messages in thread
From: Davin Pearson @ 2022-08-28 7:55 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]
Why has point-at-bol changed to line-beginning-position?
Why has point-at-eol changed to line-end-position?
To my eyes, the defaults (point-at-bol) and (point-at-eol)
are superior to line-beginning-position and line-end-position.
I could just set an alias to get the old behaviour on my machine,
but I can't see the point of the new labels.
On Sun, 28 Aug 2022 at 19:40, Emanuel Berg <incal@dataswamp.org> wrote:
> Davin Pearson wrote:
>
> > (set-text-properties (point-at-bol) (point-at-eol) '(read-only t))
>
> FYI
>
> This function is obsolete since 29.1; use
> ‘line-beginning-position’ instead.
>
> This function is obsolete since 29.1; use
> ‘line-end-position’ instead.
>
> --
> underground experts united
> https://dataswamp.org/~incal
>
>
>
[-- Attachment #2: Type: text/html, Size: 1295 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
2022-08-28 7:39 ` Emanuel Berg
2022-08-28 7:47 ` Davin Pearson
2022-08-28 7:55 ` Davin Pearson
@ 2022-08-29 5:05 ` Davin Pearson
2022-08-29 12:46 ` Stefan Monnier
2 siblings, 1 reply; 13+ messages in thread
From: Davin Pearson @ 2022-08-29 5:05 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 738 bytes --]
A quick look at ftp://www.gnu.org reveals that the latest
version is Version 28.1 not 29.1 as you claim.
I presume you made a typo.
I much prefer the old aliases point-at-bol and point-at-eol.
Any change to this arrangement would in my opinion be
a step backwards..
*Davin.*
On Sun, 28 Aug 2022 at 19:40, Emanuel Berg <incal@dataswamp.org> wrote:
> Davin Pearson wrote:
>
> > (set-text-properties (point-at-bol) (point-at-eol) '(read-only t))
>
> FYI
>
> This function is obsolete since 29.1; use
> ‘line-beginning-position’ instead.
>
> This function is obsolete since 29.1; use
> ‘line-end-position’ instead.
>
> --
> underground experts united
> https://dataswamp.org/~incal
>
>
>
[-- Attachment #2: Type: text/html, Size: 1469 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
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:42 ` Visuwesh
2022-08-28 8:16 ` Eli Zaretskii
` (2 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Visuwesh @ 2022-08-28 7:42 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
[ஞாயிறு ஆகஸ்ட் 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")
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
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:42 ` Visuwesh
@ 2022-08-28 8:16 ` Eli Zaretskii
2022-08-28 15:11 ` Stefan Monnier
2022-08-28 15:34 ` Stefan Monnier
4 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2022-08-28 8:16 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
> From: Davin Pearson <davin.pearson@gmail.com>
> Date: Sun, 28 Aug 2022 19:27:07 +1200
>
> 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?
Bind inhibit-read-only to a non-nil value.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
2022-08-28 7:27 How to remove the "read-only" property Davin Pearson
` (2 preceding siblings ...)
2022-08-28 8:16 ` Eli Zaretskii
@ 2022-08-28 15:11 ` Stefan Monnier
2022-08-28 15:34 ` Stefan Monnier
4 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2022-08-28 15:11 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
> (condition-case err
> (save-excursion
> (set-text-properties (point-min) (point-max) nil))
Side note: `save-excursion` is of no use here.
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to remove the "read-only" property...
2022-08-28 7:27 How to remove the "read-only" property Davin Pearson
` (3 preceding siblings ...)
2022-08-28 15:11 ` Stefan Monnier
@ 2022-08-28 15:34 ` Stefan Monnier
4 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2022-08-28 15:34 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
> How do I go about removing the read-only property of the text?
IME, in 99% of the cases, changes to text-properties need to be wrapped
within a `with-silent-modifications`.
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-08-29 17:32 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2022-08-28 8:16 ` Eli Zaretskii
2022-08-28 15:11 ` Stefan Monnier
2022-08-28 15:34 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.