unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7834: 24.0.50; doc of `put-image'
@ 2011-01-12 22:43 Drew Adams
  2011-07-14 17:21 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2011-01-12 22:43 UTC (permalink / raw)
  To: 7834

The doc string does not tell you what you need to know.
 
Look at the code for `image-dired-dired-toggle-marked-thumbs', for
instance.  You will see that it makes use of the `put-image' overlay
property (to gather the right overlay(s)).  That property was added by
the call to function `put-image'.
 
But there is nothing in the doc for function `put-image' that mentions
that it adds property `put-image' to the overlay that it creates.
 
In fact, the doc says nothing about this overlay, just calling it "an
overlay".  Well, at least it says that the overlay has a `before-string'
string with a `display' property whose value is the image.
 
1. The doc should mention the `put-image' property, which is the only
way for you to recognize such an overlay AFAICT.
 
2. Why not have `put-image' return the overlay itself?  That would
simplify code such as that of `image-dired-dired-toggle-marked-thumbs',
which, just after calling `put-image', tries to examine all overlays at
point just to find the right one - the one with a `put-image' property.

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-01-03 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags
-Ic:/imagesupport/include'
 






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

* bug#7834: 24.0.50; doc of `put-image'
  2011-01-12 22:43 bug#7834: 24.0.50; doc of `put-image' Drew Adams
@ 2011-07-14 17:21 ` Lars Magne Ingebrigtsen
  2011-07-15 14:42   ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-14 17:21 UTC (permalink / raw)
  To: Drew Adams; +Cc: 7834

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

> 1. The doc should mention the `put-image' property, which is the only
> way for you to recognize such an overlay AFAICT.

I've now done this.

> 2. Why not have `put-image' return the overlay itself?  That would
> simplify code such as that of `image-dired-dired-toggle-marked-thumbs',
> which, just after calling `put-image', tries to examine all overlays at
> point just to find the right one - the one with a `put-image' property.

That's a good idea.  Stefan, however, is really against primarily
side-effect-ey functions returning usable values, so we should check
with him first.

Stefan?

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





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

* bug#7834: 24.0.50; doc of `put-image'
  2011-07-14 17:21 ` Lars Magne Ingebrigtsen
@ 2011-07-15 14:42   ` Stefan Monnier
  2011-07-15 14:51     ` Lars Magne Ingebrigtsen
  2012-04-10  2:35     ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2011-07-15 14:42 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 7834

>> 2. Why not have `put-image' return the overlay itself?  That would
>> simplify code such as that of `image-dired-dired-toggle-marked-thumbs',
>> which, just after calling `put-image', tries to examine all overlays at
>> point just to find the right one - the one with a `put-image' property.

> That's a good idea.  Stefan, however, is really against primarily
> side-effect-ey functions returning usable values, so we should check
> with him first.

This function creates a new object, and that's a good idea to return it.
The cases to which I'm opposed is when the function returns something
which the caller knows even before calling the function.


        Stefan





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

* bug#7834: 24.0.50; doc of `put-image'
  2011-07-15 14:42   ` Stefan Monnier
@ 2011-07-15 14:51     ` Lars Magne Ingebrigtsen
  2011-07-15 21:01       ` Stefan Monnier
  2012-04-10  2:35     ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-15 14:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7834

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

> This function creates a new object, and that's a good idea to return it.
> The cases to which I'm opposed is when the function returns something
> which the caller knows even before calling the function.

Okidoke.

I'll mark this bug as "pending", since changing the return value of
`put-image' is a new feature (and may possibly break something that
relied on the un-announced old value).

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





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

* bug#7834: 24.0.50; doc of `put-image'
  2011-07-15 14:51     ` Lars Magne Ingebrigtsen
@ 2011-07-15 21:01       ` Stefan Monnier
  2011-07-17 17:49         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2011-07-15 21:01 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 7834

> I'll mark this bug as "pending", since changing the return value of
> `put-image' is a new feature (and may possibly break something that
> relied on the un-announced old value).

OK.  You can also install the change in the `pending' branch and close
the bug as "fixed in 24.2".


        Stefan





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

* bug#7834: 24.0.50; doc of `put-image'
  2011-07-15 21:01       ` Stefan Monnier
@ 2011-07-17 17:49         ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-17 17:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7834

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

>> I'll mark this bug as "pending", since changing the return value of
>> `put-image' is a new feature (and may possibly break something that
>> relied on the un-announced old value).
>
> OK.  You can also install the change in the `pending' branch and close
> the bug as "fixed in 24.2".

For me it easier to just mark it as pending.  Having a long-lived tree
that will need to be merged back later can be a bit complicated, in my
experience. 

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





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

* bug#7834: 24.0.50; doc of `put-image'
  2011-07-15 14:42   ` Stefan Monnier
  2011-07-15 14:51     ` Lars Magne Ingebrigtsen
@ 2012-04-10  2:35     ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-04-10  2:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7834

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

> This function creates a new object, and that's a good idea to return it.
> The cases to which I'm opposed is when the function returns something
> which the caller knows even before calling the function.

I've now installed this change.

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





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

end of thread, other threads:[~2012-04-10  2:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12 22:43 bug#7834: 24.0.50; doc of `put-image' Drew Adams
2011-07-14 17:21 ` Lars Magne Ingebrigtsen
2011-07-15 14:42   ` Stefan Monnier
2011-07-15 14:51     ` Lars Magne Ingebrigtsen
2011-07-15 21:01       ` Stefan Monnier
2011-07-17 17:49         ` Lars Magne Ingebrigtsen
2012-04-10  2:35     ` 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).