* problems with better-registers: turn-off-all-minor modes or remove all text-properties
@ 2022-07-23 16:45 Uwe Brauer
2022-07-23 20:35 ` Thorsten Bonow
2022-07-24 0:09 ` Michael Heerdegen
0 siblings, 2 replies; 20+ messages in thread
From: Uwe Brauer @ 2022-07-23 16:45 UTC (permalink / raw)
To: help-gnu-emacs
Hi
better-registers found in https://github.com/emacsmirror/emacswiki.org/blob/master/better-registers.el
is unfortunately no longer maintained. It allows, among other things, to
save registers in a file for future sessions.
While there is no problem in saving some text of a buffer in fundamental
mode to a specific resister.
However for example message mode, that has in my case quite a bit of
minor modes turn on, results in a saving of the sort.
,----
|
| (set-register 49 #("
| Test again
| and again
| --
| 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) 1 11 (fontified t) 11 22 (fontified t) 22 23 (fontified t)
| 23 25 (fontified t rear-nonsticky t field signature pabbrev-added t) 25
| 26 (fontified t rear-nonsticky t field signature) 26 27 (fontified t) 27
| 28 (fontified t pabbrev-added t) 28 29 (fontified t) 29 37 (fontified t
| pabbrev-added t) 37 38 (fontified t) 38 45 (fontified t pabbrev-added t)
| 45 46 (fontified t) 46 53 (fontified t pabbrev-added t) 53 54 (fontified
| t) 54 57 (fontified t pabbrev-added t) 57 58 (fontified t) 58 60
| (fontified t pabbrev-added t) 60 61 (fontified t) 61 71 (fontified t
| pabbrev-added t) 71 72 (fontified t) 72 79 (fontified t pabbrev-added t)
| 79 80 (fontified t) 80 83 (fontified t pabbrev-added t) 83 84 (fontified
| t) 84 91 (fontified t pabbrev-added t) 91 93 (fontified t) 93 94
| (fontified t pabbrev-added t) 94 95 (fontified t) 95 102 (fontified t
| pabbrev-added t) 102 103 (fontified t) 103 105 (fontified t
| pabbrev-added t) 105 106 (fontified t) 106 113 (fontified t
| pabbrev-added t) 113 114 (fontified t) 114 121 (fontified t
| pabbrev-added t) 121 122 (fontified t) 122 124 (fontified t
| pabbrev-added t) 124 125 (fontified t) 125 134 (fontified t
| pabbrev-added t) 134 135 (fontified t) 135 143 (fontified t
| pabbrev-added t) 143 146 (fontified t) 146 147 (fontified t
| pabbrev-added t) 147 148 (fontified t) 148 155 (fontified t
| pabbrev-added t) 155 156 (fontified t) 156 159 (fontified t
| pabbrev-added t) 159 160 (fontified t) 160 163 (fontified t
| pabbrev-added t) 163 164 (fontified t) 164 166 (fontified t
| pabbrev-added t) 166 167 (fontified t) 167 173 (fontified t
| pabbrev-added t) 173 174 (fontified t) 174 178 (fontified t
| pabbrev-added t) 178 179 (fontified t) 179 184 (fontified t
| pabbrev-added t) 184 186 (fontified t) 186 187 (fontified t
| pabbrev-added t) 187 188 (fontified t) 188 195 (fontified t
| pabbrev-added t) 195 196 (fontified t) 196 199 (fontified t
| pabbrev-added t) 199 200 (fontified t) 200 202 (fontified t
| pabbrev-added t) 202 203 (fontified t) 203 213 (fontified t
| pabbrev-added t) 213 214 (fontified t) 214 216 (fontified t
| pabbrev-added t) 216 217 (fontified t) 217 220 (fontified t
| pabbrev-added t) 220 221 (fontified t) 221 228 (fontified t
| pabbrev-added t) 228 231 (fontified t)))
`----
Which in turn causes problems when loading a file with such saved resisters.
Two workaround occured to me, but both did not work
1. Turn off all minor mode (which might be the culprit of all the
face stuff that is added) by using
(defun disable-all-minor-modes ()
(interactive)
(mapc
(lambda (mode-symbol)
(when (functionp mode-symbol)
;; some symbols are functions which aren't normal mode functions
(ignore-errors
(funcall mode-symbol -1))))
minor-mode-list))
Found in
https://emacs.stackexchange.com/questions/42239/how-to-disable-all-the-minor-modes-when-a-specific-major-mode-is-enabled-with
2. Or delete all the text-properties, by something like this
(let ((inhibit-read-only t))
(set-text-properties (point-min) (point-max) nil))
It did not work neither.
Any idea?
Thanks and regards
Uwe Brauer
--
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.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: problems with better-registers: turn-off-all-minor modes or remove all text-properties
2022-07-23 16:45 problems with better-registers: turn-off-all-minor modes or remove all text-properties Uwe Brauer
@ 2022-07-23 20:35 ` Thorsten Bonow
2022-07-24 0:09 ` Michael Heerdegen
1 sibling, 0 replies; 20+ messages in thread
From: Thorsten Bonow @ 2022-07-23 20:35 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> Uwe Brauer <oub@mat.ucm.es> writes:
> Hi
> better-registers found in
> https://github.com/emacsmirror/emacswiki.org/blob/master/better-registers.el
> is unfortunately no longer maintained. It allows, among other
> things, to save registers in a file for future sessions.
> While there is no problem in saving some text of a buffer in
> fundamental mode to a specific resister.
> However for example message mode, that has in my case quite a
> bit of minor modes turn on, results in a saving of the sort.
> ,---- | | (set-register 49 #(" | Test again | and again | -- | 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) 1 11 (fontified
> t) 11 22 (fontified t) 22 23 (fontified t) | 23 25 (fontified t
> rear-nonsticky t field signature pabbrev-added t) 25 | 26
> (fontified t rear-nonsticky t field signature) 26 27 (fontified
> t) 27 | 28 (fontified t pabbrev-added t) 28 29 (fontified t) 29
> 37 (fontified t | pabbrev-added t) 37 38 (fontified t) 38 45
> (fontified t pabbrev-added t) | 45 46 (fontified t) 46 53
> (fontified t pabbrev-added t) 53 54 (fontified | t) 54 57
> (fontified t pabbrev-added t) 57 58 (fontified t) 58 60 |
> (fontified t pabbrev-added t) 60 61 (fontified t) 61 71
> (fontified t | pabbrev-added t) 71 72 (fontified t) 72 79
> (fontified t pabbrev-added t) | 79 80 (fontified t) 80 83
> (fontified t pabbrev-added t) 83 84 (fontified | t) 84 91
> (fontified t pabbrev-added t) 91 93 (fontified t) 93 94 |
> (fontified t pabbrev-added t) 94 95 (fontified t) 95 102
> (fontified t | pabbrev-added t) 102 103 (fontified t) 103 105
> (fontified t | pabbrev-added t) 105 106 (fontified t) 106 113
> (fontified t | pabbrev-added t) 113 114 (fontified t) 114 121
> (fontified t | pabbrev-added t) 121 122 (fontified t) 122 124
> (fontified t | pabbrev-added t) 124 125 (fontified t) 125 134
> (fontified t | pabbrev-added t) 134 135 (fontified t) 135 143
> (fontified t | pabbrev-added t) 143 146 (fontified t) 146 147
> (fontified t | pabbrev-added t) 147 148 (fontified t) 148 155
> (fontified t | pabbrev-added t) 155 156 (fontified t) 156 159
> (fontified t | pabbrev-added t) 159 160 (fontified t) 160 163
> (fontified t | pabbrev-added t) 163 164 (fontified t) 164 166
> (fontified t | pabbrev-added t) 166 167 (fontified t) 167 173
> (fontified t | pabbrev-added t) 173 174 (fontified t) 174 178
> (fontified t | pabbrev-added t) 178 179 (fontified t) 179 184
> (fontified t | pabbrev-added t) 184 186 (fontified t) 186 187
> (fontified t | pabbrev-added t) 187 188 (fontified t) 188 195
> (fontified t | pabbrev-added t) 195 196 (fontified t) 196 199
> (fontified t | pabbrev-added t) 199 200 (fontified t) 200 202
> (fontified t | pabbrev-added t) 202 203 (fontified t) 203 213
> (fontified t | pabbrev-added t) 213 214 (fontified t) 214 216
> (fontified t | pabbrev-added t) 216 217 (fontified t) 217 220
> (fontified t | pabbrev-added t) 220 221 (fontified t) 221 228
> (fontified t | pabbrev-added t) 228 231 (fontified t))) `----
> Which in turn causes problems when loading a file with such
> saved resisters.
Hi,
could you please be more specific about the problems?
I ran a few quick tests with savehist mode; worked for me:
(savehist-mode 1)
(setq savehist-additional-variables '(register-alist))
This saves minibuffer history and `register-alist' in
`savehist-file' (defaults to "~/.emacs.d/history").
Toto
> Two workaround occured to me, but both did not work
> 1. Turn off all minor mode (which might be the culprit of all
> the face stuff that is added) by using (defun
> disable-all-minor-modes () (interactive) (mapc (lambda
> (mode-symbol) (when (functionp mode-symbol) ;; some symbols are
> functions which aren't normal mode functions (ignore-errors
> (funcall mode-symbol -1)))) minor-mode-list)) Found in
> https://emacs.stackexchange.com/questions/42239/how-to-disable-all-the-minor-modes-when-a-specific-major-mode-is-enabled-with
> 2. Or delete all the text-properties, by something like this
> (let ((inhibit-read-only t)) (set-text-properties (point-min)
> (point-max) nil))
> It did not work neither.
> Any idea?
> Thanks and regards
> Uwe Brauer
--
Sent from my GNU Emacs running on GNU/Linux
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: problems with better-registers: turn-off-all-minor modes or remove all text-properties
2022-07-23 16:45 problems with better-registers: turn-off-all-minor modes or remove all text-properties Uwe Brauer
2022-07-23 20:35 ` Thorsten Bonow
@ 2022-07-24 0:09 ` Michael Heerdegen
2022-07-24 3:59 ` Michael Heerdegen
1 sibling, 1 reply; 20+ messages in thread
From: Michael Heerdegen @ 2022-07-24 0:09 UTC (permalink / raw)
To: help-gnu-emacs
Uwe Brauer <oub@mat.ucm.es> writes:
> Which in turn causes problems when loading a file with such saved
> resisters.
Could you please be more specific - what's the problem? As Stefan said,
text properties are normally not a problem in this case.
Michael.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: problems with better-registers: turn-off-all-minor modes or remove all text-properties
2022-07-24 0:09 ` Michael Heerdegen
@ 2022-07-24 3:59 ` Michael Heerdegen
2022-07-24 5:39 ` Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Michael Heerdegen @ 2022-07-24 3:59 UTC (permalink / raw)
To: help-gnu-emacs
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Could you please be more specific - what's the problem? As Stefan said,
> text properties are normally not a problem in this case.
Ok, after reading again what you had posted in emacs-dev, I saw your
string contained unreadable properties. Your string contained a button,
for example.
What I would do is to advice `set-register' to strip unreadable
properties from any stringp value. Or just strip text properties if you
don't want them anyway. That's better than trying to work around that
problem.
Michael.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: problems with better-registers: turn-off-all-minor modes or remove all text-properties
2022-07-24 3:59 ` Michael Heerdegen
@ 2022-07-24 5:39 ` Uwe Brauer
2022-07-24 19:51 ` [SOLVED] (was: problems with better-registers: turn-off-all-minor modes or remove all text-properties) Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-24 5:39 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1554 bytes --]
>>> "MH" == Michael Heerdegen <michael_heerdegen@web.de> writes:
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>> Could you please be more specific - what's the problem? As Stefan said,
>> text properties are normally not a problem in this case.
> Ok, after reading again what you had posted in emacs-dev, I saw your
> string contained unreadable properties. Your string contained a button,
> for example.
> What I would do is to advice `set-register' to strip unreadable
> properties from any stringp value. Or just strip text properties if you
> don't want them anyway. That's better than trying to work around that
> problem.
Thanks, that did not occur to me. I tried to advice since a while since
it makes debugging difficult.
In any case, maybe because I have not used it for a while, my attempts
failed:
(defadvice set-property (before removeproperties activate)
"Remove all text properties before setting the property"
(let ((inhibit-read-only t))
(set-text-properties (point-min) (point-max) nil)))
(defadvice set-property (after removeproperties activate)
"Remove all text properties before setting the property"
(let ((inhibit-read-only t))
(set-text-properties (point-min) (point-max) nil)))
None of them worked
Any ideas?
thanks
Uwe Brauer
--
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* [SOLVED] (was: problems with better-registers: turn-off-all-minor modes or remove all text-properties)
2022-07-24 5:39 ` Uwe Brauer
@ 2022-07-24 19:51 ` Uwe Brauer
2022-07-24 22:36 ` [SOLVED] Michael Heerdegen
0 siblings, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-24 19:51 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 878 bytes --]
> Thanks, that did not occur to me. I tried to advice since a while since
> it makes debugging difficult.
> In any case, maybe because I have not used it for a while, my attempts
> failed:
> (defadvice set-property (before removeproperties activate)
> "Remove all text properties before setting the property"
> (let ((inhibit-read-only t))
> (set-text-properties (point-min) (point-max) nil)))
> (defadvice set-property (after removeproperties activate)
> "Remove all text properties before setting the property"
> (let ((inhibit-read-only t))
> (set-text-properties (point-min) (point-max) nil)))
> None of them worked
The magic seems to be
(defadvice copy-to-register (before removeproperties activate)
"Remove all text properties before setting the property"
(let ((inhibit-read-only t))
(set-text-properties (point-min) (point-max) nil)))
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-24 19:51 ` [SOLVED] (was: problems with better-registers: turn-off-all-minor modes or remove all text-properties) Uwe Brauer
@ 2022-07-24 22:36 ` Michael Heerdegen
2022-07-25 5:37 ` [SOLVED] Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Michael Heerdegen @ 2022-07-24 22:36 UTC (permalink / raw)
To: help-gnu-emacs
Uwe Brauer <oub@mat.ucm.es> writes:
> Thanks, that did not occur to me. I tried to advice since a while
> since it makes debugging difficult.
Not much, IME.
> (defadvice copy-to-register (before removeproperties activate)
> "Remove all text properties before setting the property"
> (let ((inhibit-read-only t))
> (set-text-properties (point-min) (point-max) nil)))
It would be better and cleaner to change the value that is saved in the
register instead of modifying the buffer.
Michael.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-24 22:36 ` [SOLVED] Michael Heerdegen
@ 2022-07-25 5:37 ` Uwe Brauer
2022-07-25 5:49 ` [SOLVED] Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-25 5:37 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
>>> "MH" == Michael Heerdegen <michael_heerdegen@web.de> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> Thanks, that did not occur to me. I tried to advice since a while
>> since it makes debugging difficult.
> Not much, IME.
>> (defadvice copy-to-register (before removeproperties activate)
>> "Remove all text properties before setting the property"
>> (let ((inhibit-read-only t))
>> (set-text-properties (point-min) (point-max) nil)))
> It would be better and cleaner to change the value that is saved in the
> register instead of modifying the buffer.
Well I tried that, but I couldn't. As I said modify set-register did not
work for me.
I am not happy about my solution and would appreciate any suggestion.
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-25 5:37 ` [SOLVED] Uwe Brauer
@ 2022-07-25 5:49 ` Uwe Brauer
2022-07-25 17:09 ` [SOLVED] Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-25 5:49 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]
>>> "UB" == Uwe Brauer <oub@mat.ucm.es> writes:
>>> "MH" == Michael Heerdegen <michael_heerdegen@web.de> writes:
>> Uwe Brauer <oub@mat.ucm.es> writes:
>>> Thanks, that did not occur to me. I tried to advice since a while
>>> since it makes debugging difficult.
>> Not much, IME.
>>> (defadvice copy-to-register (before removeproperties activate)
>>> "Remove all text properties before setting the property"
>>> (let ((inhibit-read-only t))
>>> (set-text-properties (point-min) (point-max) nil)))
>> It would be better and cleaner to change the value that is saved in the
>> register instead of modifying the buffer.
I just realized that I did not read your message carefully enough.
It seems you suggest
(defadvice copy-to-register (before removeproperties activate)
"Remove all text properties before setting the property"
(let ((inhibit-read-only t))
(set-text-properties (region-beginning) (region-end) nil)))
Which is what I intended but copied the code incorrectly.
--
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-25 5:49 ` [SOLVED] Uwe Brauer
@ 2022-07-25 17:09 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-07-25 19:49 ` [SOLVED] Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-07-25 17:09 UTC (permalink / raw)
To: help-gnu-emacs
> It seems you suggest
>
> (defadvice copy-to-register (before removeproperties activate)
> "Remove all text properties before setting the property"
> (let ((inhibit-read-only t))
> (set-text-properties (region-beginning) (region-end) nil)))
No, that still modifies the buffer. He suggests you apply
`set-text-properties` to the extracted string.
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-25 17:09 ` [SOLVED] Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-07-25 19:49 ` Uwe Brauer
2022-07-25 22:37 ` [SOLVED] Michael Heerdegen
0 siblings, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-25 19:49 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 973 bytes --]
>>> "SMvUlftGEte" == Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:
>> It seems you suggest
>>
>> (defadvice copy-to-register (before removeproperties activate)
>> "Remove all text properties before setting the property"
>> (let ((inhibit-read-only t))
>> (set-text-properties (region-beginning) (region-end) nil)))
> No, that still modifies the buffer. He suggests you apply
> `set-text-properties` to the extracted string.
Well I tried
(defadvice set-property (before removeproperties activate)
"Remove all text properties before setting the property"
(let ((inhibit-read-only t))
(set-text-properties (region-beginning) (region-end) nil)))
But it did not 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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-25 19:49 ` [SOLVED] Uwe Brauer
@ 2022-07-25 22:37 ` Michael Heerdegen
2022-07-26 4:57 ` [SOLVED] Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Michael Heerdegen @ 2022-07-25 22:37 UTC (permalink / raw)
To: help-gnu-emacs
Uwe Brauer <oub@mat.ucm.es> writes:
> Well I tried
>
> (defadvice set-property (before removeproperties activate)
> "Remove all text properties before setting the property"
> (let ((inhibit-read-only t))
> (set-text-properties (region-beginning) (region-end) nil)))
>
> But it did not work
Wouldn't it be appropriate to refresh your knowledge about advices?
Michael.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-25 22:37 ` [SOLVED] Michael Heerdegen
@ 2022-07-26 4:57 ` Uwe Brauer
2022-07-26 13:01 ` [SOLVED] Thorsten Bonow
0 siblings, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-26 4:57 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 3123 bytes --]
>>> "MH" == Michael Heerdegen <michael_heerdegen@web.de> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> Well I tried
>>
>> (defadvice set-property (before removeproperties activate)
>> "Remove all text properties before setting the property"
>> (let ((inhibit-read-only t))
>> (set-text-properties (region-beginning) (region-end) nil)))
>>
>> But it did not work
> Wouldn't it be appropriate to refresh your knowledge about advices?
Well I tried this as well, and tried out the new advice-add
functionality.
Here is what I tried
(defun my-remove-all-text-properties-region ()
(interactive) ;; that is not important
(let ((inhibit-read-only t))
(set-text-properties (region-beginning) (region-end) nil)))
Then
(advice-add 'set-property :before #'my-remove-all-text-properties-region)
or
(advice-add 'set-property :around #'my-remove-all-text-properties-region)
Result: no effect
I tried
(advice-add 'copy-to-register :before #'my-remove-all-text-properties-region)
or
(advice-add 'copy-to-register :around #'my-remove-all-text-properties-region)
Results in an error:
,----
| Debugger entered--Lisp error: (wrong-number-of-arguments
| #f(compiled-function () (interactive nil) #<bytecode
| 0x1f6825029d2a6658>) 1)
| my-remove-all-text-properties-region(#f(compiled-function (register
| start end &optional delete-flag region) "Copy region into register
| REGISTER.\nWith prefix arg, delete as well.\nCalled from program,
| takes five args: REGISTER, START, END, DELETE-FLAG,\nand REGION. START
| and END are buffer positions indicating what to copy.\nThe optional
| argument REGION if non-nil, indicates that we're not just\ncopying
| some text between START and END, but we're copying the
| region.\n\nInteractively, reads the register using
| `register-read-with-preview'." (interactive #f(compiled-function ()
| #<bytecode -0x19b31a6142e6ce87>)) #<bytecode 0x18af6be063d3e91b>))
| apply(my-remove-all-text-properties-region #f(compiled-function
| (register start end &optional delete-flag region) "Copy region into
| register REGISTER.\nWith prefix arg, delete as well.\nCalled from
| program, takes five args: REGISTER, START, END, DELETE-FLAG,\nand
| REGION. START and END are buffer positions indicating what to
| copy.\nThe optional argument REGION if non-nil, indicates that we're
| not just\ncopying some text between START and END, but we're copying
| the region.\n\nInteractively, reads the register using
| `register-read-with-preview'." (interactive #f(compiled-function ()
| #<bytecode -0x19b31a6142e6ce87>)) #<bytecode 0x18af6be063d3e91b>) nil)
| copy-to-register() funcall-interactively(copy-to-register)
| call-interactively(copy-to-register nil nil)
| command-execute(copy-to-register)
`----
At this point I give up
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-26 4:57 ` [SOLVED] Uwe Brauer
@ 2022-07-26 13:01 ` Thorsten Bonow
2022-07-26 15:02 ` [SOLVED] Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Thorsten Bonow @ 2022-07-26 13:01 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> Uwe Brauer <oub@mat.ucm.es> writes:
[...]
> At this point I give up
> Uwe
Don't loose heart...
(defun copy-to-register--no-properties (orig-fun &rest args)
"Remove properties of region when calling `copy-to-register'."
(let ((filter-buffer-substring-function (lambda (beg end
&optional delete)
(if delete
(delete-and-extract-region
beg end)
(buffer-substring-no-properties
beg end)))))
(apply orig-fun args)))
(advice-add 'copy-to-register :around
#'copy-to-register--no-properties)
Works for me, but the way I understand the manual, instead of
advising a function, better-registers.el should just modify
`filter-buffer-substring-function' for its needs.
Hope this helps.
Toto
--
Sent from my GNU Emacs running on GNU/Linux
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-26 13:01 ` [SOLVED] Thorsten Bonow
@ 2022-07-26 15:02 ` Uwe Brauer
2022-07-26 16:23 ` [SOLVED] Yuri Khan
0 siblings, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-26 15:02 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]
>>> "TB" == Thorsten Bonow <thorsten.bonow@post.rwth-aachen.de> writes:
Hello Thorsten
>>>>>> Uwe Brauer <oub@mat.ucm.es> writes:
> [...] > At this point I give up > Uwe Don't loose heart...
Ok I will not (and it seems I can count on «with a little help of my
friends 😉)
> (defun copy-to-register--no-properties (orig-fun &rest args) "Remove
> properties of region when calling `copy-to-register'." (let
> ((filter-buffer-substring-function (lambda (beg end &optional
> delete) (if delete
> (delete-and-extract-region
> beg end)
> (buffer-substring-no-properties
> beg end))))) (apply orig-fun args))) (advice-add 'copy-to-register
> :around #'copy-to-register--no-properties) Works for me, but the way I
> understand the manual, instead of advising a function,
> better-registers.el should just modify
> `filter-buffer-substring-function' for its needs.
> Hope this helps.
It does very much so, that solution would not have occurred to me. So thanks for
the code.
BTW, I found it strange that «vanilla» Emacs does not provide saving
registers, but then this is a question of demand, and it seems only a
few users use that functionality.
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-26 15:02 ` [SOLVED] Uwe Brauer
@ 2022-07-26 16:23 ` Yuri Khan
2022-07-26 23:28 ` [SOLVED] Michael Heerdegen
2022-07-27 10:50 ` [SOLVED] Uwe Brauer
0 siblings, 2 replies; 20+ messages in thread
From: Yuri Khan @ 2022-07-26 16:23 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, 26 Jul 2022 at 22:08, Uwe Brauer <oub@mat.ucm.es> wrote:
> BTW, I found it strange that «vanilla» Emacs does not provide saving
> registers, but then this is a question of demand, and it seems only a
> few users use that functionality.
I don’t remember who said it doesn’t but do we consider desktop.el
“vanilla” or some other flavor? My .emacs.desktop has a ‘(setq
register-alist '…)’ and it persists across Emacs sessions. (I have not
encountered unreadable properties in there, or maybe I did but did not
make the connection.)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-26 16:23 ` [SOLVED] Yuri Khan
@ 2022-07-26 23:28 ` Michael Heerdegen
2022-07-27 10:50 ` [SOLVED] Uwe Brauer
1 sibling, 0 replies; 20+ messages in thread
From: Michael Heerdegen @ 2022-07-26 23:28 UTC (permalink / raw)
To: help-gnu-emacs
Yuri Khan <yuri.v.khan@gmail.com> writes:
> I don’t remember who said it doesn’t but do we consider desktop.el
> “vanilla” or some other flavor? My .emacs.desktop has a ‘(setq
> register-alist '…)’ and it persists across Emacs sessions. (I have not
> encountered unreadable properties in there, or maybe I did but did not
> make the connection.)
Seems it is silently stripping (all) properties when such a problem
appears - see `desktop--v2s'.
Michael.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-26 16:23 ` [SOLVED] Yuri Khan
2022-07-26 23:28 ` [SOLVED] Michael Heerdegen
@ 2022-07-27 10:50 ` Uwe Brauer
2022-07-27 15:04 ` [SOLVED] Yuri Khan
1 sibling, 1 reply; 20+ messages in thread
From: Uwe Brauer @ 2022-07-27 10:50 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]
>>> "YK" == Yuri Khan <yuri.v.khan@gmail.com> writes:
> On Tue, 26 Jul 2022 at 22:08, Uwe Brauer <oub@mat.ucm.es> wrote:
>> BTW, I found it strange that «vanilla» Emacs does not provide saving
>> registers, but then this is a question of demand, and it seems only a
>> few users use that functionality.
> I don’t remember who said it doesn’t but do we consider desktop.el
> “vanilla” or some other flavor?
Since desktop is part of Emacs it is vanilla.
> My .emacs.desktop has a ‘(setq
> register-alist '…)’ and it persists across Emacs sessions. (I have not
> encountered unreadable properties in there, or maybe I did but did not
> make the connection.)
Aha, thanks I did not know that, I really never used desktop that much,
but can you use list-register and then edit the registers?
Ok I realized that list-register is not part of emacs vanilla neither.
--
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED]
2022-07-27 10:50 ` [SOLVED] Uwe Brauer
@ 2022-07-27 15:04 ` Yuri Khan
2022-07-28 14:46 ` [SOLVED$ Uwe Brauer
0 siblings, 1 reply; 20+ messages in thread
From: Yuri Khan @ 2022-07-27 15:04 UTC (permalink / raw)
To: help-gnu-emacs
On Wed, 27 Jul 2022 at 17:51, Uwe Brauer <oub@mat.ucm.es> wrote:
> Since desktop is part of Emacs it is vanilla.
[…]
> Aha, thanks I did not know that, I really never used desktop that much,
> but can you use list-register and then edit the registers?
> Ok I realized that list-register is not part of emacs vanilla neither.
Is it not? Works for me and I do not remember doing anything for it to
work, and it lives in /usr/share/emacs/29.0.50/lisp/register.el.gz, so
I guess it’s also vanilla by your definition.
I cannot edit registers directly, but I can insert the text from a
register into a buffer, edit the text there, and copy it back to the
register, and it will be persisted the next time I restart Emacs.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [SOLVED$
2022-07-27 15:04 ` [SOLVED] Yuri Khan
@ 2022-07-28 14:46 ` Uwe Brauer
0 siblings, 0 replies; 20+ messages in thread
From: Uwe Brauer @ 2022-07-28 14:46 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]
>>> "YK" == Yuri Khan <yuri.v.khan@gmail.com> writes:
> On Wed, 27 Jul 2022 at 17:51, Uwe Brauer <oub@mat.ucm.es> wrote:
>> Since desktop is part of Emacs it is vanilla.
> […$
>> Aha, thanks I did not know that, I really never used desktop that much,
>> but can you use list-register and then edit the registers?
>> Ok I realized that list-register is not part of emacs vanilla neither.
> Is it not? Works for me and I do not remember doing anything for it to
> work, and it lives in /usr/share/emacs/29.0.50/lisp/register.el.gz, so
> I guess it’s also vanilla by your definition.
> I cannot edit registers directly, but I can insert the text from a
> register into a buffer, edit the text there, and copy it back to the
> register, and it will be persisted the next time I restart Emacs.
May I suggest then list-register (found in the package system):
it lists registers and allows to edit them,
There is also register-list
(remember Monty Python:
«The People's Front of Judea» vs «Judean People's Front» )
--
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2022-07-28 14:46 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-23 16:45 problems with better-registers: turn-off-all-minor modes or remove all text-properties Uwe Brauer
2022-07-23 20:35 ` Thorsten Bonow
2022-07-24 0:09 ` Michael Heerdegen
2022-07-24 3:59 ` Michael Heerdegen
2022-07-24 5:39 ` Uwe Brauer
2022-07-24 19:51 ` [SOLVED] (was: problems with better-registers: turn-off-all-minor modes or remove all text-properties) Uwe Brauer
2022-07-24 22:36 ` [SOLVED] Michael Heerdegen
2022-07-25 5:37 ` [SOLVED] Uwe Brauer
2022-07-25 5:49 ` [SOLVED] Uwe Brauer
2022-07-25 17:09 ` [SOLVED] Stefan Monnier via Users list for the GNU Emacs text editor
2022-07-25 19:49 ` [SOLVED] Uwe Brauer
2022-07-25 22:37 ` [SOLVED] Michael Heerdegen
2022-07-26 4:57 ` [SOLVED] Uwe Brauer
2022-07-26 13:01 ` [SOLVED] Thorsten Bonow
2022-07-26 15:02 ` [SOLVED] Uwe Brauer
2022-07-26 16:23 ` [SOLVED] Yuri Khan
2022-07-26 23:28 ` [SOLVED] Michael Heerdegen
2022-07-27 10:50 ` [SOLVED] Uwe Brauer
2022-07-27 15:04 ` [SOLVED] Yuri Khan
2022-07-28 14:46 ` [SOLVED$ Uwe Brauer
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).