all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to display an image contained in a file?
Date: Tue, 01 Mar 2016 21:04:48 +0200	[thread overview]
Message-ID: <838u226mun.fsf@gnu.org> (raw)
In-Reply-To: <87twkqvya3.fsf@mbork.pl> (message from Marcin Borkowski on Tue,  01 Mar 2016 19:38:44 +0100)

> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Tue, 01 Mar 2016 19:38:44 +0100
> 
> I have an image in the file, say "~/image.png".  I want to display it in
> an interactive function - say, the user says M-x display-my-image, and
> I want a buffer containing the image to pop up.  What do I do?  Of
> course, (find-file "~/image.png") works, but it's probably not what
> I should do in an Elisp program, right?

 (let ((image (create-image "~/image.png")))
   (pop-to-buffer "*image*")
   (insert-image image))



      reply	other threads:[~2016-03-01 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 18:38 How to display an image contained in a file? Marcin Borkowski
2016-03-01 19:04 ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=838u226mun.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.