unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to remove a property from an overlay?
@ 2021-07-30 18:31 Marcin Borkowski
  2021-07-30 18:48 ` Eli Zaretskii
  2021-07-30 20:02 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 8+ messages in thread
From: Marcin Borkowski @ 2021-07-30 18:31 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

is there any way I can remove property `prop' from overlay `ovl' besides

(overlay-put ovl 'prop nil)

which does not really remove it, only sets it to nil?

TIA,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to remove a property from an overlay?
  2021-07-30 18:31 How to remove a property from an overlay? Marcin Borkowski
@ 2021-07-30 18:48 ` Eli Zaretskii
  2021-07-30 19:12   ` Marcin Borkowski
  2021-07-30 20:02 ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-07-30 18:48 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Fri, 30 Jul 2021 20:31:35 +0200
> 
> is there any way I can remove property `prop' from overlay `ovl' besides
> 
> (overlay-put ovl 'prop nil)
> 
> which does not really remove it, only sets it to nil?

What's the difference?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to remove a property from an overlay?
  2021-07-30 18:48 ` Eli Zaretskii
@ 2021-07-30 19:12   ` Marcin Borkowski
  2021-07-30 19:47     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Marcin Borkowski @ 2021-07-30 19:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs


On 2021-07-30, at 20:48, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Marcin Borkowski <mbork@mbork.pl>
>> Date: Fri, 30 Jul 2021 20:31:35 +0200
>> 
>> is there any way I can remove property `prop' from overlay `ovl' besides
>> 
>> (overlay-put ovl 'prop nil)
>> 
>> which does not really remove it, only sets it to nil?
>
> What's the difference?

When I say `(overlay-properties ovl)', I can see `prop' set to nil.
Before setting it, I couldn't.

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to remove a property from an overlay?
  2021-07-30 19:12   ` Marcin Borkowski
@ 2021-07-30 19:47     ` Eli Zaretskii
  2021-07-31  8:45       ` Marcin Borkowski
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-07-30 19:47 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marcin Borkowski <mbork@mbork.pl>
> Cc: help-gnu-emacs@gnu.org
> Date: Fri, 30 Jul 2021 21:12:26 +0200
> 
> >> (overlay-put ovl 'prop nil)
> >> 
> >> which does not really remove it, only sets it to nil?
> >
> > What's the difference?
> 
> When I say `(overlay-properties ovl)', I can see `prop' set to nil.
> Before setting it, I couldn't.

And why is that difference important?

Overlay properties exist to search for them with the likes of
next-single-char-property-change, and those don't distinguish between
the two.

But if you must remove the property, I think the only way is to make
another overlay with all the properties except the one you want to
remove.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to remove a property from an overlay?
  2021-07-30 18:31 How to remove a property from an overlay? Marcin Borkowski
  2021-07-30 18:48 ` Eli Zaretskii
@ 2021-07-30 20:02 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-07-31  8:45   ` Marcin Borkowski
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-07-30 20:02 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski [2021-07-30 20:31:35] wrote:
> is there any way I can remove property `prop' from overlay `ovl' besides
> (overlay-put ovl 'prop nil)
> which does not really remove it, only sets it to nil?

The recommendation is to try and make sure you always give semantics to
those properties such that nil behaves the same as the absence of
the property.


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to remove a property from an overlay?
  2021-07-30 19:47     ` Eli Zaretskii
@ 2021-07-31  8:45       ` Marcin Borkowski
  0 siblings, 0 replies; 8+ messages in thread
From: Marcin Borkowski @ 2021-07-31  8:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs


On 2021-07-30, at 21:47, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Marcin Borkowski <mbork@mbork.pl>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Fri, 30 Jul 2021 21:12:26 +0200
>> 
>> >> (overlay-put ovl 'prop nil)
>> >> 
>> >> which does not really remove it, only sets it to nil?
>> >
>> > What's the difference?
>> 
>> When I say `(overlay-properties ovl)', I can see `prop' set to nil.
>> Before setting it, I couldn't.
>
> And why is that difference important?

Because of my OCD, perhaps?

> Overlay properties exist to search for them with the likes of
> next-single-char-property-change, and those don't distinguish between
> the two.

I see.

> But if you must remove the property, I think the only way is to make
> another overlay with all the properties except the one you want to
> remove.

I see.  Not worth it, of course.

Thanks!

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to remove a property from an overlay?
  2021-07-30 20:02 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-07-31  8:45   ` Marcin Borkowski
  2021-07-31 13:15     ` Fu Yuan
  0 siblings, 1 reply; 8+ messages in thread
From: Marcin Borkowski @ 2021-07-31  8:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs


On 2021-07-30, at 22:02, Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Marcin Borkowski [2021-07-30 20:31:35] wrote:
>> is there any way I can remove property `prop' from overlay `ovl' besides
>> (overlay-put ovl 'prop nil)
>> which does not really remove it, only sets it to nil?
>
> The recommendation is to try and make sure you always give semantics to
> those properties such that nil behaves the same as the absence of
> the property.

Could that be put in the manual?

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to remove a property from an overlay?
  2021-07-31  8:45   ` Marcin Borkowski
@ 2021-07-31 13:15     ` Fu Yuan
  0 siblings, 0 replies; 8+ messages in thread
From: Fu Yuan @ 2021-07-31 13:15 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: help-gnu-emacs, Stefan Monnier



> 在 2021年7月31日,上午4:46,Marcin Borkowski <mbork@mbork.pl> 写道:
> 
> 
>> On 2021-07-30, at 22:02, Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>> 
>> Marcin Borkowski [2021-07-30 20:31:35] wrote:
>>> is there any way I can remove property `prop' from overlay `ovl' besides
>>> (overlay-put ovl 'prop nil)
>>> which does not really remove it, only sets it to nil?
>> 
>> The recommendation is to try and make sure you always give semantics to
>> those properties such that nil behaves the same as the absence of
>> the property.
> 
> Could that be put in the manual?

Reminds me of the similar property of plists, we could also add to plist’s manual.

Yuan


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-31 13:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-30 18:31 How to remove a property from an overlay? Marcin Borkowski
2021-07-30 18:48 ` Eli Zaretskii
2021-07-30 19:12   ` Marcin Borkowski
2021-07-30 19:47     ` Eli Zaretskii
2021-07-31  8:45       ` Marcin Borkowski
2021-07-30 20:02 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-31  8:45   ` Marcin Borkowski
2021-07-31 13:15     ` Fu Yuan

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).