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: Elisp and overlay, how to show an image Date: Sat, 06 Jul 2024 23:12:23 +0200 Message-ID: <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="10937"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.1; emacs 29.4 To: Help Gnu Emacs Mailing List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 06 23:13:22 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 1sQCig-0002fh-4J for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 06 Jul 2024 23:13:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQCi1-0008Fi-FE; Sat, 06 Jul 2024 17:12:41 -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 1sQChz-0008FG-K0 for help-gnu-emacs@gnu.org; Sat, 06 Jul 2024 17:12:39 -0400 Original-Received: from k-7.ch ([185.31.100.96]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQChx-0002ar-RD for help-gnu-emacs@gnu.org; Sat, 06 Jul 2024 17:12:39 -0400 Original-Received: from van (_gateway [192.168.1.1]) (Authenticated sender: seb) by k-7.ch (Postfix) with ESMTPSA id 5EA1DE8109 for ; Sat, 6 Jul 2024 23:12:31 +0200 (CEST) Received-SPF: pass client-ip=185.31.100.96; envelope-from=seb@k-7.ch; helo=k-7.ch X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-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:147092 Archived-At: Hello, 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. 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. Here is the source code my first try: ;; Create an overlay at the first char of the buffer (setq ov1 (make-overlay 1 1)) =20=20=20=20 ;; Create the image from a file (setq my_image (create-image "~/Path/to/my/image.jpg")) =20=20=20=20 ;; Put a new line, to avoid aving the image replacing the first char (overlay-put ov1 'before-string "\n") =20=20=20=20 ;; Put the image on the overlay (overlay-put ov1 'display my_image) When I evaluate this code, for example on the *scratch* buffer, I got a new line before the first buffer char, but the image do not display. Should I need to create, on the overlay, an empty space big enough to put the image in it=C2=A0? Or did I miss something on the manual=C2=A0? Best regards. [1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Overlays.html