unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
@ 2011-07-24  2:06 Drew Adams
  2011-08-02  4:16 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2011-07-24  2:06 UTC (permalink / raw)
  To: 9159

emacs -Q
 
In *scratch*, do this with cursor on the character `T' (for example):
 
M-: (put-text-property (point) (1+ (point)) 'foo 42)
 
The buffer then appears modified.
With point in the same place, do `C-u C-x ='.
That shows that there is property `foo' there, with value 42.
 
C-M-_ to undo the last change.
With point in the same place, do `C-u C-x ='.
That shows that there is property `foo' there, with value nil.
And it shows the buffer as no longer modified.
 
IOW, the buffer modification is indicated as corresponding with setting
property `foo' to 42, and undo puts it back to nil.
 
While correct, it would be better for the property `foo' to simply be
removed, and thus not have `C-u C-x =' show a `foo' value at all.  Undo
is not really undoing things to put them back they way they were, as
witnessed by `C-u C-x ='.
 
NOTE: Sending from a different Emacs version because of the recent SMTP
mail bugs.  This is the version the report is for:
 
In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-07-18 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt --cflags
-Ic:/build/include'
 
 
 

 






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

* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
  2011-07-24  2:06 bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes Drew Adams
@ 2011-08-02  4:16 ` Stefan Monnier
  2011-08-02 17:34   ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2011-08-02  4:16 UTC (permalink / raw)
  To: Drew Adams; +Cc: 9159

severity 9159 minor
thanks

> C-M-_ to undo the last change.
> With point in the same place, do `C-u C-x ='.
> That shows that there is property `foo' there, with value nil.

Do you have an example situation where the difference matters?
Usually we handle the absence of a text property as synonym to a nil
value of that property.


        Stefan








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

* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
  2011-08-02  4:16 ` Stefan Monnier
@ 2011-08-02 17:34   ` Drew Adams
  2011-08-02 19:10     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2011-08-02 17:34 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 9159

> > C-M-_ to undo the last change.
> > With point in the same place, do `C-u C-x ='.
> > That shows that there is property `foo' there, with value nil.
> 
> Do you have an example situation where the difference matters?

What does "matters" mean?  Evidently it does not matter much to you.

> Usually we handle the absence of a text property as synonym to a nil
> value of that property.

Yes, I know that.  And this is a good example where it makes a difference.  How
much it "matters" to you, you can decide.






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

* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
  2011-08-02 17:34   ` Drew Adams
@ 2011-08-02 19:10     ` Stefan Monnier
  2011-08-02 20:48       ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2011-08-02 19:10 UTC (permalink / raw)
  To: Drew Adams; +Cc: 9159

>> > C-M-_ to undo the last change.
>> > With point in the same place, do `C-u C-x ='.
>> > That shows that there is property `foo' there, with value nil.
>> Do you have an example situation where the difference matters?
> What does "matters" mean?

By "matters" I mean that the difference is reflected in a different
behavior for "the end user".  I'm sure you know what I mean.

> Evidently it does not matter much to you.

Not until I see that it has some more serious consequence.  What you
show is a mostly cosmetic difference.

>> Usually we handle the absence of a text property as synonym to a nil
>> value of that property.
> Yes, I know that.  And this is a good example where it makes
> a difference.

If you accept the fact that "nothing == nil" for text-properties, then
the difference you show is indeed not a difference, it's just
a cosmetically different way to represent the same state.


        Stefan





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

* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
  2011-08-02 19:10     ` Stefan Monnier
@ 2011-08-02 20:48       ` Drew Adams
  2011-08-02 21:13         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2011-08-02 20:48 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 9159

> >> > C-M-_ to undo the last change.
> >> > With point in the same place, do `C-u C-x ='.
> >> > That shows that there is property `foo' there, with value nil.
> >>
> >> Do you have an example situation where the difference matters?
> >
> > What does "matters" mean?
> 
> By "matters" I mean that the difference is reflected in a different
> behavior for "the end user".  I'm sure you know what I mean.

I _described_ a visible difference for the end user.  That is pretty much the
only things I care about in general: user-visible behavior.

What is not user-visible in the behavior I reported?  The whole point of the
report was about the behavior being confusing to an end user.

> > Evidently it does not matter much to you.
> 
> Not until I see that it has some more serious consequence.  What you
> show is a mostly cosmetic difference.

Call it such a name if that makes you feel better.
It is a user-visible difference that promotes confusion.

No, it is not the most important problem Emacs has.
And it is unlikely to cause mass destruction.

> >> Usually we handle the absence of a text property as 
> >> synonym to a nil value of that property.
> >
> > Yes, I know that.  And this is a good example where it makes
> > a difference.

A user-visible difference, I might have added.

> If you accept the fact that "nothing == nil" for text-properties, then
> the difference you show is indeed not a difference, it's just
> a cosmetically different way to represent the same state.

Whatever.  If you don't think this difference in what the user sees and what
s?he is likely to expect/understand promotes confusion, or if you see it but
don't care, nothing I say will change your mind.

I already said in the OP that "while correct" (N.B.) "it would be better for the
property `foo' to simply be removed."

We agree that the value shown is correct.  I say that although correct it is
confusing.  You say that it's just cosmetic - bad looks.  Your poor cosmetics
can confuse users.  And that was the point, from the beginning.






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

* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
  2011-08-02 20:48       ` Drew Adams
@ 2011-08-02 21:13         ` Lars Magne Ingebrigtsen
  2011-08-02 21:48           ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-08-02 21:13 UTC (permalink / raw)
  To: Drew Adams; +Cc: 9159

"Drew Adams" <drew.adams@oracle.com> writes:

> I already said in the OP that "while correct" (N.B.) "it would be
> better for the property `foo' to simply be removed."

I don't think this is a bug (or should be fixed), but I wonder whether
it would make sense for Fput_text_property to just delete the property
instead of adding/setting `prop nil' to the property list in general?

That is, if I say

(put-text-property (point-min) (1+ (point-min)) 'foo nil)

today, `foo nil' is added.  Perhaps it should just be ignored if not
already there, and if it's already set, then it should be removed?

If we have established that there is no semantic difference between nil
properties and missing properties, then this sounds like there could be
(very minor) memory and redisplay efficiencies to be won here.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
  2011-08-02 21:13         ` Lars Magne Ingebrigtsen
@ 2011-08-02 21:48           ` Drew Adams
  2011-09-11  2:36             ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2011-08-02 21:48 UTC (permalink / raw)
  To: 'Lars Magne Ingebrigtsen'; +Cc: 9159

> > I already said in the OP that "while correct" (N.B.) "it would be
> > better for the property `foo' to simply be removed."
> 
> I don't think this is a bug (or should be fixed), but I wonder whether
> it would make sense for Fput_text_property to just delete the property
> instead of adding/setting `prop nil' to the property list in general?
> 
> That is, if I say
> (put-text-property (point-min) (1+ (point-min)) 'foo nil)
> 
> today, `foo nil' is added.  Perhaps it should just be ignored if not
> already there, and if it's already set, then it should be removed?
> 
> If we have established that there is no semantic difference 
> between nil properties and missing properties, then this sounds
> like there could be (very minor) memory and redisplay efficiencies
> to be won here.

Presumably Stefan agrees (?) but considers that improvement only cosmetic, so
fodder for the wishlist (/dev/null) cannon.






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

* bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes
  2011-08-02 21:48           ` Drew Adams
@ 2011-09-11  2:36             ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-11  2:36 UTC (permalink / raw)
  To: Drew Adams; +Cc: 9159

"Drew Adams" <drew.adams@oracle.com> writes:

>> If we have established that there is no semantic difference 
>> between nil properties and missing properties, then this sounds
>> like there could be (very minor) memory and redisplay efficiencies
>> to be won here.
>
> Presumably Stefan agrees (?) but considers that improvement only cosmetic, so
> fodder for the wishlist (/dev/null) cannon.

The added complexity to the code is probably not worth the (very minor)
memory gains.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

end of thread, other threads:[~2011-09-11  2:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-24  2:06 bug#9159: 24.0.50; `undo' is not as good as it should be wrt property changes Drew Adams
2011-08-02  4:16 ` Stefan Monnier
2011-08-02 17:34   ` Drew Adams
2011-08-02 19:10     ` Stefan Monnier
2011-08-02 20:48       ` Drew Adams
2011-08-02 21:13         ` Lars Magne Ingebrigtsen
2011-08-02 21:48           ` Drew Adams
2011-09-11  2:36             ` Lars Magne Ingebrigtsen

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