From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?S=C3=A9bastien_Gendre?= Newsgroups: gmane.emacs.help Subject: Re: Elisp and overlay, how to show an image Date: Sun, 07 Jul 2024 17:31:13 +0200 Message-ID: <87plrpdxry.fsf@k-7.ch> References: <8734omfcnc.fsf@k-7.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36722"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.1; emacs 29.4 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 07 18:00:07 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sQUJ5-0009HR-0r for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 07 Jul 2024 18:00:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQTrN-0002N6-Gd; Sun, 07 Jul 2024 11:31:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQTrE-0002Mc-GK for help-gnu-emacs@gnu.org; Sun, 07 Jul 2024 11:31:21 -0400 Original-Received: from 96-100-31-185.ftth.cust.kwaoo.net ([185.31.100.96] helo=k-7.ch) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQTrB-0003nH-KB for help-gnu-emacs@gnu.org; Sun, 07 Jul 2024 11:31:19 -0400 Original-Received: from van (_gateway [192.168.1.1]) (Authenticated sender: seb) by k-7.ch (Postfix) with ESMTPSA id 84BB9E8109 for ; Sun, 7 Jul 2024 17:31:14 +0200 (CEST) In-Reply-To: (Stefan Monnier via Users list for the's message of "Sun, 07 Jul 2024 09:12:48 -0400") Received-SPF: pass client-ip=185.31.100.96; envelope-from=seb@k-7.ch; helo=k-7.ch X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, RDNS_DYNAMIC=0.982, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147108 Archived-At: Stefan Monnier via Users list for the GNU Emacs text editor writes: > As Tomas points out, the `display` property is obeyed only if it covers > characters. The usual way to "insert" an image without disrupting the > content of the buffer (e.g. in `put-image`) is to put the image (with > `display` property) on a *string* and then put that string in the > `before-string` (or `after-string`) property of an overlay. > > (let ((ol (put-image (create-image "~/Path/to/my/image.jpg") > (point-min)))) > (overlay-put ol 'after-string "\n")) > > > - Stefan <#secure method=3Dpgpmime mode=3Dsign> Thank you, to Tomas and you, for your replies. It help me a lot. I didn't know that (put-image) will return the overlay it created. Is there a way to set a bottom margin to the added overlay, or to the image, like with CSS on a web page=C2=A0? Or do I need to add more "\n" with (overlay-put)=C2=A0? I need to found a way to modify the way the image is shown. Controlling the zoom, on which part it's centered and how the image is cut. I will read more carefully the section "41.17 Images" of the elisp manual. Until now, I was started by the overlays section of the manual.=20