unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Displaying images "outside" the layout
@ 2014-01-26  5:18 Lars Ingebrigtsen
  2014-01-26  5:41 ` YAMAMOTO Mitsuharu
  2014-01-26 16:22 ` Eli Zaretskii
  0 siblings, 2 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2014-01-26  5:18 UTC (permalink / raw)
  To: emacs-devel

I've been thinking a bit about adding the possibility of adding image
previews to dired in a more similar way to other file browsers.  There
is image-dired and friends, but they require batch processing and are
kinda awkward.

What I'd like to see is that when you place point on an image, or you
issue a special new command, Emacs would make a preview image on the fly
(like all other file browsers), and it would display this image in a
convenient way.

Inserting the preview into the buffer would be the easiest, of course,
but where?  On the current line would be obvious, but would make stuff
move around, since image thumbnails would be taller than the lines are.

So here's my question: Is there a way to display images in tooltips?  I
tried the obvious, which is using a string with a display parameter that
points to an image in `help-echo', but that didn't work.

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




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

* Re: Displaying images "outside" the layout
  2014-01-26  5:18 Displaying images "outside" the layout Lars Ingebrigtsen
@ 2014-01-26  5:41 ` YAMAMOTO Mitsuharu
  2014-01-27  0:23   ` Lars Ingebrigtsen
  2014-01-26 16:22 ` Eli Zaretskii
  1 sibling, 1 reply; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2014-01-26  5:41 UTC (permalink / raw)
  To: emacs-devel

>>>>> On Sat, 25 Jan 2014 22:18:15 -0700, Lars Ingebrigtsen <larsi@gnus.org> said:

> So here's my question: Is there a way to display images in tooltips?
> I tried the obvious, which is using a string with a display
> parameter that points to an image in `help-echo', but that didn't
> work.

This one works for me:

(insert (propertize "splash" 'help-echo (propertize " " 'display (create-image "splash.png"))) ?\n)

You need to set x-gtk-use-system-tooltips to nil if you are using the
GTK+ build, and the NS port cannot display images in tooltips AFAIK.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp



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

* Re: Displaying images "outside" the layout
  2014-01-26  5:18 Displaying images "outside" the layout Lars Ingebrigtsen
  2014-01-26  5:41 ` YAMAMOTO Mitsuharu
@ 2014-01-26 16:22 ` Eli Zaretskii
  2014-01-26 16:39   ` Alp Aker
  2014-01-27  0:28   ` Lars Ingebrigtsen
  1 sibling, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2014-01-26 16:22 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sat, 25 Jan 2014 22:18:15 -0700
> 
> Inserting the preview into the buffer would be the easiest, of course,
> but where?  On the current line would be obvious, but would make stuff
> move around, since image thumbnails would be taller than the lines are.

You could reserve the space in advance, by displaying some empty image
there, or by some other suitable trick with display properties.

> So here's my question: Is there a way to display images in tooltips?  I
> tried the obvious, which is using a string with a display parameter that
> points to an image in `help-echo', but that didn't work.

If the tooltip is drawn by Emacs, it is just a special kind of frame,
so images ought to work.  (Not that I like the idea of showing
thumbnails only in tooltips.)



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

* Re: Displaying images "outside" the layout
  2014-01-26 16:22 ` Eli Zaretskii
@ 2014-01-26 16:39   ` Alp Aker
  2014-01-26 17:40     ` Eli Zaretskii
  2014-01-27  0:28   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 11+ messages in thread
From: Alp Aker @ 2014-01-26 16:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, Emacs devel

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

> If the tooltip is drawn by Emacs, it is just a special kind of frame
> so images ought to work.  (Not that I like the idea of showing
> thumbnails only in tooltips.)

That's not true on NS, at least.

[-- Attachment #2: Type: text/html, Size: 317 bytes --]

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

* Re: Displaying images "outside" the layout
  2014-01-26 16:39   ` Alp Aker
@ 2014-01-26 17:40     ` Eli Zaretskii
  2014-01-26 18:12       ` Alp Aker
  2014-01-26 18:53       ` Jan Djärv
  0 siblings, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2014-01-26 17:40 UTC (permalink / raw)
  To: Alp Aker; +Cc: larsi, emacs-devel

> Date: Sun, 26 Jan 2014 11:39:34 -0500
> From: Alp Aker <alptekin.aker@gmail.com>
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, Emacs devel <emacs-devel@gnu.org>
> 
> > If the tooltip is drawn by Emacs, it is just a special kind of frame
> > so images ought to work.  (Not that I like the idea of showing
> > thumbnails only in tooltips.)
> 
> That's not true on NS, at least.

Which part? that tooltips are drawn by Emacs, or that tooltips drawn
by Emacs can show images?

If the former, then I don't think Emacs can do anything about that.



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

* Re: Displaying images "outside" the layout
  2014-01-26 17:40     ` Eli Zaretskii
@ 2014-01-26 18:12       ` Alp Aker
  2014-01-26 18:53       ` Jan Djärv
  1 sibling, 0 replies; 11+ messages in thread
From: Alp Aker @ 2014-01-26 18:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, Emacs devel

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

> Which part? that tooltips are drawn by Emacs, or that tooltips draw
> by Emacs can show images?

Sorry, I was unclear.  On NS, tooltips aren't implemented as frames.

[-- Attachment #2: Type: text/html, Size: 224 bytes --]

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

* Re: Displaying images "outside" the layout
  2014-01-26 17:40     ` Eli Zaretskii
  2014-01-26 18:12       ` Alp Aker
@ 2014-01-26 18:53       ` Jan Djärv
  1 sibling, 0 replies; 11+ messages in thread
From: Jan Djärv @ 2014-01-26 18:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alp Aker, larsi@gnus.org, emacs-devel@gnu.org

Hello. 

26 jan 2014 kl. 18:40 skrev Eli Zaretskii <eliz@gnu.org>:

>> Date: Sun, 26 Jan 2014 11:39:34 -0500
>> From: Alp Aker <alptekin.aker@gmail.com>
>> Cc: Lars Ingebrigtsen <larsi@gnus.org>, Emacs devel <emacs-devel@gnu.org>
>> 
>>> If the tooltip is drawn by Emacs, it is just a special kind of frame
>>> so images ought to work.  (Not that I like the idea of showing
>>> thumbnails only in tooltips.)
>> 
>> That's not true on NS, at least.
> 
> Which part? that tooltips are drawn by Emacs, or that tooltips drawn
> by Emacs can show images?
> 

The first. Also the Gtk+ port by default uses native tooltips to get the native colors, shapes and transparency.  What Emacs needs is a frame type without window decorations. Can also be useful for popup menus. 

    Jan D. 

> If the former, then I don't think Emacs can do anything about that.



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

* Re: Displaying images "outside" the layout
  2014-01-26  5:41 ` YAMAMOTO Mitsuharu
@ 2014-01-27  0:23   ` Lars Ingebrigtsen
  2014-01-27  0:38     ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2014-01-27  0:23 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> This one works for me:
>
> (insert (propertize "splash" 'help-echo (propertize " " 'display (create-image "splash.png"))) ?\n)
>
> You need to set x-gtk-use-system-tooltips to nil if you are using the
> GTK+ build, and the NS port cannot display images in tooltips AFAIK.

Hm, nice...  Is there an interface to display these kinds of things
without actually using the `help-echo' stuff?  I.e., is there a "display
this string in a tooltip like fashion"?

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



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

* Re: Displaying images "outside" the layout
  2014-01-26 16:22 ` Eli Zaretskii
  2014-01-26 16:39   ` Alp Aker
@ 2014-01-27  0:28   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2014-01-27  0:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> You could reserve the space in advance, by displaying some empty image
> there, or by some other suitable trick with display properties.

Yeah, but then we'd display a lot fewer dired lines, which isn't
optimal.

> If the tooltip is drawn by Emacs, it is just a special kind of frame,
> so images ought to work.  (Not that I like the idea of showing
> thumbnails only in tooltips.)

Sorry; I didn't mean literally using the `help-echo' stuff, but just
wondered whether it was even possible for Emacs to display images
"floating"...

A different solution that just occurred to me while writing this is that
we could just use the echo area.  I didn't know that that worked,
either:

(progn (message (propertize "hello" 'display (create-image "splash.png")))
       (sit-for 1))

Perhaps that's the most natural and Emacsey way to display thumbnails?

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



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

* Re: Displaying images "outside" the layout
  2014-01-27  0:23   ` Lars Ingebrigtsen
@ 2014-01-27  0:38     ` YAMAMOTO Mitsuharu
  2014-01-27  0:47       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2014-01-27  0:38 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

>>>>> On Sun, 26 Jan 2014 17:23:54 -0700, Lars Ingebrigtsen <larsi@gnus.org> said:

>> This one works for me:
>> 
>> (insert (propertize "splash" 'help-echo (propertize " " 'display
>> (create-image "splash.png"))) ?\n)
>> 
>> You need to set x-gtk-use-system-tooltips to nil if you are using
>> the GTK+ build, and the NS port cannot display images in tooltips
>> AFAIK.

> Hm, nice...  Is there an interface to display these kinds of things
> without actually using the `help-echo' stuff?  I.e., is there a
> "display this string in a tooltip like fashion"?

You mean something like this?

(tooltip-show (propertize " " 'display (create-image "splash.png")))

					YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp




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

* Re: Displaying images "outside" the layout
  2014-01-27  0:38     ` YAMAMOTO Mitsuharu
@ 2014-01-27  0:47       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2014-01-27  0:47 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: emacs-devel

YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> You mean something like this?
>
> (tooltip-show (propertize " " 'display (create-image "splash.png")))

Great; thanks.  >"?

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



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

end of thread, other threads:[~2014-01-27  0:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-26  5:18 Displaying images "outside" the layout Lars Ingebrigtsen
2014-01-26  5:41 ` YAMAMOTO Mitsuharu
2014-01-27  0:23   ` Lars Ingebrigtsen
2014-01-27  0:38     ` YAMAMOTO Mitsuharu
2014-01-27  0:47       ` Lars Ingebrigtsen
2014-01-26 16:22 ` Eli Zaretskii
2014-01-26 16:39   ` Alp Aker
2014-01-26 17:40     ` Eli Zaretskii
2014-01-26 18:12       ` Alp Aker
2014-01-26 18:53       ` Jan Djärv
2014-01-27  0:28   ` Lars 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).