From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Elisp and overlay, how to show an image Date: Sun, 7 Jul 2024 07:30:27 +0200 Message-ID: References: <8734omfcnc.fsf@k-7.ch> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dpPN5Qynz56F7OfO" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9413"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs Mailing List To: =?utf-8?Q?S=C3=A9bastien?= Gendre Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 07 07:31:25 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 1sQKUd-0002HU-QY for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 07 Jul 2024 07:31:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQKTq-000211-UP; Sun, 07 Jul 2024 01:30:34 -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 1sQKTo-00020P-L4 for help-gnu-emacs@gnu.org; Sun, 07 Jul 2024 01:30:32 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQKTm-0003ZX-HF for help-gnu-emacs@gnu.org; Sun, 07 Jul 2024 01:30:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jxREBiwFedrXFhEkgMQEO8zYuOzPwz4UtYYBpWVp6O8=; b=mX9XG+68tzK6bCjwGQpa2FY6rX 16Pleu3XE8BzHjZoqaF1deevTzSdFCKxxAd4Xc8koAjjZH7umbuvG40jBdzxS5v7oqL2OUy3TE0tJ M4OkkqOjcHzal+VwOH2DuixAwjwa6joZwIJWWEQnm6YNA5hyXWVQEez0leZiz+6782uHZGUfsEgkr jwNs2smNcgDrYpIFGQgViHo9CcL21g7RTOXRIrLx0ysPI+X/6kfN9iug3wylAMVXweiYb/UTLLjvy +Y8z0XLSe8ggEOooUKrYwVDgH492bXPNaChA3f62shm0oDskSxnPDlfGtGy/jygmoI7YdtRz0dm/i NSqn8t3A==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1sQKTj-0003FB-Jo; Sun, 07 Jul 2024 07:30:27 +0200 Content-Disposition: inline In-Reply-To: <8734omfcnc.fsf@k-7.ch> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:147097 Archived-At: --dpPN5Qynz56F7OfO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 06, 2024 at 11:12:23PM +0200, S=C3=A9bastien Gendre wrote: > Hello, >=20 > I am trying to show an image on the top of a buffer, before the first > line of text, and put a small margin at the bottom of the image. >=20 >=20 > I have read the Overlay manual [1] and the source code of the function > `org-display-inline-images`, but I have difficulties to understand how > to use overlay beginning and end parameters. >=20 >=20 > Here is the source code my first try: >=20 >=20 > ;; Create an overlay at the first char of the buffer > (setq ov1 (make-overlay 1 1)) I think you have to give the overlay some width. Possibly you'll have to insert some text (one char will be enough) to slap the overlay on. > =20 > ;; Create the image from a file > (setq my_image (create-image "~/Path/to/my/image.jpg")) > =20 > ;; Put a new line, to avoid aving the image replacing the first char > (overlay-put ov1 'before-string "\n") I'm not quite sure the before-string is displayed when the overlay has a 'display property. Cheers --=20 t --dpPN5Qynz56F7OfO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZoon7AAKCRAFyCz1etHa Rt3/AJ93NMheDPk/FL8OlOb3wtwZHgKsxwCfXC1v6IriOB7aQcbdB2o5+O6gyro= =Exzv -----END PGP SIGNATURE----- --dpPN5Qynz56F7OfO--