emacs-devel
[Top][All Lists]
Advanced

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

[remove all text properties in a region] (was: a strange error with list


From: Uwe Brauer
Subject: [remove all text properties in a region] (was: a strange error with list-registers (and better-registers))
Date: Sat, 23 Jul 2022 07:30:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>> "SM" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I see. What is not clear to me is why these text properties information
>> gets saved at first hand. I thought it might have to do with emacs
>> saving mechanism. I recall that saving registers did not cause any
>> problem, say in GNU emacs 26 (if I recall correctly).

> It doesn't depend on the version of Emacs, but on the values that happen
> to be carried in the text-properties of the text you happen to have in
> your registers.  Packages can put any kinds of values in any kinds of
> text-properties.

I just run a test on a typical message buffer (with, I admit quite a bit
of minor modes turn on)

The saved register looks like 


(set-register 49 #("

Uwe this 

-- 
I strongly condemn Putin's war of aggression against the Ukraine. I
support to deliver weapons to Ukraine's military. I support the ban of
Russia from SWIFT. I support the EU membership of the Ukraine. " 0 1
(fontified t wrap-prefix "") 1 2 (fontified t wrap-prefix "") 2 5
(fontified t wrap-prefix "" pabbrev-added t) 5 6 (fontified t
wrap-prefix "") 6 10 (fontified t wrap-prefix "" pabbrev-added t) 10 11
(fontified t wrap-prefix "") 11 12 (fontified t wrap-prefix "") 12 13
(fontified t wrap-prefix " ") 13 15 (fontified t rear-nonsticky t field
signature face message-signature-separator wrap-prefix " " pabbrev-added
t) 15 16 (fontified t rear-nonsticky t field signature face
message-signature-separator wrap-prefix " ") 16 17 (fontified t
wrap-prefix " ") 17 18 (fontified t wrap-prefix "" pabbrev-added t) 18
19 (fontified t wrap-prefix "") 19 27 (fontified t wrap-prefix ""
pabbrev-added t) 27 28 (fontified t wrap-prefix "") 28 35 (fontified t
wrap-prefix "" pabbrev-added t) 35 36 (fontified t wrap-prefix "") 36 43
(fontified t wrap-prefix "" pabbrev-added t) 43 44 (fontified t
wrap-prefix "") 44 47 (fontified t wrap-prefix "" pabbrev-added t) 47 48
(fontified t wrap-prefix "") 48 50 (fontified t wrap-prefix ""
pabbrev-added t) 50 51 (fontified t wrap-prefix "") 51 61 (fontified t
wrap-prefix "" pabbrev-added t) 61 62 (fontified t wrap-prefix "") 62 69
(fontified t wrap-prefix "" pabbrev-added t) 69 70 (fontified t
wrap-prefix "") 70 73 (fontified t wrap-prefix "" pabbrev-added t) 73 74
(fontified t wrap-prefix "") 74 81 (fontified t wrap-prefix ""
pabbrev-added t) 81 83 (fontified t wrap-prefix "") 83 84 (fontified t
wrap-prefix "" pabbrev-added t) 84 85 (fontified t wrap-prefix "") 85 92
(fontified t wrap-prefix "" pabbrev-added t) 92 93 (fontified t
wrap-prefix "") 93 95 (fontified t wrap-prefix "" pabbrev-added t) 95 96
(fontified t wrap-prefix "") 96 103 (fontified t wrap-prefix ""
pabbrev-added t) 103 104 (fontified t wrap-prefix "") 104 111 (fontified
t wrap-prefix "" pabbrev-added t) 111 112 (fontified t wrap-prefix "")
112 114 (fontified t wrap-prefix "" pabbrev-added t) 114 115 (fontified
t wrap-prefix "") 115 124 (fontified t wrap-prefix "" pabbrev-added t)
124 125 (fontified t wrap-prefix "") 125 133 (fontified t wrap-prefix ""
pabbrev-added t) 133 136 (fontified t wrap-prefix "") 136 137 (fontified
t wrap-prefix "" pabbrev-added t) 137 138 (fontified t wrap-prefix "")
138 145 (fontified t wrap-prefix "" pabbrev-added t) 145 146 (fontified
t wrap-prefix "") 146 149 (fontified t wrap-prefix "" pabbrev-added t)
149 150 (fontified t wrap-prefix "") 150 153 (fontified t wrap-prefix ""
pabbrev-added t) 153 154 (fontified t wrap-prefix "") 154 156 (fontified
t wrap-prefix "" pabbrev-added t) 156 157 (fontified t wrap-prefix "")
157 163 (fontified t wrap-prefix "" pabbrev-added t) 163 164 (fontified
t wrap-prefix "") 164 168 (fontified t wrap-prefix "" pabbrev-added t)
168 169 (fontified t wrap-prefix "") 169 174 (fontified t wrap-prefix ""
pabbrev-added t) 174 176 (fontified t wrap-prefix "") 176 177 (fontified
t wrap-prefix "" pabbrev-added t) 177 178 (fontified t wrap-prefix "")
178 185 (fontified t wrap-prefix "" pabbrev-added t) 185 186 (fontified
t wrap-prefix "") 186 189 (fontified t wrap-prefix "" pabbrev-added t)
189 190 (fontified t wrap-prefix "") 190 192 (fontified t wrap-prefix ""
pabbrev-added t) 192 193 (fontified t wrap-prefix "") 193 203 (fontified
t wrap-prefix "" pabbrev-added t) 203 204 (fontified t wrap-prefix "")
204 206 (fontified t wrap-prefix "" pabbrev-added t) 206 207 (fontified
t wrap-prefix "") 207 210 (fontified t wrap-prefix "" pabbrev-added t)
210 211 (fontified t wrap-prefix "") 211 218 (fontified t wrap-prefix ""
pabbrev-added t) 218 221 (fontified t wrap-prefix "")))

I don't need any of these properties. The documentation 
https://ftp.gnu.org/old-gnu/Manuals/elisp-manual-20-2.5/html_node/elisp_509.html#:~:text=To%20remove%20all%20text%20properties,for%20the%20new%20property%20list.&text=This%20function%20completely%20replaces%20the,defaults%20to%20the%20current%20buffer.

Does not mention a function that would simply remove all text-properties 

So I tried stuff like this 

(defun my-remove-all-text-properties-file ()
  (interactive)
  (set-text-properties (point-min) (point-max) nil))

(defun my-remove-all-text-properties-region ()
  (interactive)
  (set-text-properties (region-beginning) (region-end) nil))

But it seems not to work


Uwe 




-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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