From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id sFe6KWJqYmdacQEA62LTzQ:P1 (envelope-from ) for ; Wed, 18 Dec 2024 06:23:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id sFe6KWJqYmdacQEA62LTzQ (envelope-from ) for ; Wed, 18 Dec 2024 07:23:30 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=me1UTdq+; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734503009; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=hiSNu8hr4BGSVUPHECcPhR+YiEoGhhKyf5QMAOtYlTw=; b=Kii+8rLQMkorIlDsZ0GboPwhzhDpVOTodo83Ydiv54tlcdGP3Cc4dar6ukWGtjqc+IAHr2 Ai2qVZ7ZaygS+bakknhg7AkWURLAV0WhVEfrFVzHvqMsBUR16R9ZAc6EJQwXr8+bjghImW uQjQnadFd3e/jq8OJNFBU6pYfYtf8v9ii20YPR0tyqiqQOdoiNFJaFlwEIgo+lN7lUgiib HGkJ388Dj+Txwy0dFUcV6cZuzrN4FmHgBpI0FmcNor7SrmTxCIWu7pSw0O6zxIHaHvZx+/ U8EHqIhoTB59w+lIqvX0a6Mr9siluZnoDTf2pcBaX/FnOe/NhWVi7IQCF+ThGQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=me1UTdq+; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734503009; a=rsa-sha256; cv=none; b=htVrdjltnvqGBTIIjDvwTWk6M6CB2WL2ODku1mw1DhNmL6gDH1b5w6gtoFZVt73oGXnEma afNW1EMBM8cYFC0ZpC3KncAp/217H0sYjbqkHAGlPWoSZrfxZ/4cWYUP1dryKv95NWhiNR 9ujt3u21Evvq8FnXkPpLMH4Qmcsp4WqKdMSGtR1UoiJEr2zq8FGwaiikGNH1E8ei/SmIP9 atfs7+Xxd93169wXrV2rM++8LzABlN+ea2ilM6YpRzNI+zydWjoA1V6Uz32Q7ugOUFB7M5 u2IWxpBdyIpszzKFNOWiNDwzcpHMn8ScWfyMlQPTn0cv3s95JhJFuCT8tDdozg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A11345B09D for ; Wed, 18 Dec 2024 07:23:29 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNnS9-00041E-7w; Wed, 18 Dec 2024 01:22:37 -0500 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 1tNnS4-00040l-1U for emacs-orgmode@gnu.org; Wed, 18 Dec 2024 01:22:34 -0500 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNnS1-0005Yg-Jg for emacs-orgmode@gnu.org; Wed, 18 Dec 2024 01:22:31 -0500 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53e3a5fa6aaso437965e87.0 for ; Tue, 17 Dec 2024 22:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734502946; x=1735107746; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hiSNu8hr4BGSVUPHECcPhR+YiEoGhhKyf5QMAOtYlTw=; b=me1UTdq+J7vUSbffhxv+FTLKOGq0z4xjlc30IiVKjo8SGXSs97YNOe2dBIYMTcDidb i9WXM7+hMijArvcgrmVQ4+tnFFUvqbKZT8TVK/HB0GFzQTNmEchUyoQ12esuKVPcKw0D wWDDrYOeYYY4fkZ8qYjywtJvZznl4IHS/g8xpqrIAKjfxnjK8Oe3tEMC9VhhkpzfT+Xi TJc9NMhmfdriyYsMlgaO5gWaLxUqQrdxVwMLbgVdxiCpQxGUv2nbWjnh6gt6E1Jo220n +UInVEOOIzD2yn0mbhpvMIKV+IBdmK0QAQf/HeYQhLCgaa/nFQkBmslQ/0EaHuMUz1Jb PaGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734502946; x=1735107746; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hiSNu8hr4BGSVUPHECcPhR+YiEoGhhKyf5QMAOtYlTw=; b=IMO40kdkkWnkf3hw1yRiIIdpd27dXhculm3+xwXNhas8mmh427V4mUeo5LOIyB0t3I kYy8BBC+c91olLS0Zt516pzxcgBFwzI38bbp225CVYPaP2nkWTMMzwV8x6e1onl9r7wE zzjrr5avtpOT9Zg6CNk3XwRl4tfmTsmB+ic+hdrNH7gttVOqhMOQfb2pBy0F3GwEHkos gsE7+4DsaX9wnEyLe9wl9n1Tdr6r+lnnyQW133lSnZsVmwLQllDz/G1+Q4EzLVagI/fD CPO1r5H6nXz92bUDjEwWBHotFNAbDDFctt6SkgNUFieecXzB7IiREaR+tXzHlzyWYukw dVpw== X-Forwarded-Encrypted: i=1; AJvYcCU32hgBMQe5zrEFOOSNNJ7eD7LeyV82DLWaNc3ePSwIbmF6FeqtSmbDX5YXL27upF1Ov/2mUFHR2iAJZda8@gnu.org X-Gm-Message-State: AOJu0YzVUSyKXI6AtGV3zKB8dF/AzbusuIB3lQPMV3W+7/enOMd4pIft L6Y3P1/3KdUv2nSlAmy3aYxy9ekC6KJ2KVw+Ch7IP1POC/zq1rdpYE8jsrqTLHJRRfdVZz8hf1H FDZGyf01lqTwEQULMxwn75xb8+A== X-Gm-Gg: ASbGncvdt999hBuHYqTocHce/jwo5b0UWL4QitDBwRm90gJ4v8SnAXjwsOc100LDHuJ rs6t+EnqdwBerDtIfJ90mU6ffigxiWMj94M/71f0rxThPB0YigOEBBbPSJj+XR9I8TL/JK5U= X-Google-Smtp-Source: AGHT+IHbGE+4nuseDJJPA2kOUDRoCo68IO4kBU4+BOugRIJwcr1xA8viCPwD6IFJc7uSb1DKWkqiiZxcX4zUhyk7FRI= X-Received: by 2002:a05:6512:3e15:b0:542:1c96:3312 with SMTP id 2adb3069b0e04-5421c9677e4mr224704e87.4.1734502945351; Tue, 17 Dec 2024 22:22:25 -0800 (PST) MIME-Version: 1.0 References: <6755f138.0c0a0220.40388.51fbSMTPIN_ADDED_BROKEN@mx.google.com> <874j382kue.fsf@gmail.com> <87pllug2y4.fsf@localhost> <87ldwfnff4.fsf@gmail.com> In-Reply-To: <87ldwfnff4.fsf@gmail.com> From: stardiviner Date: Wed, 18 Dec 2024 14:21:58 +0800 Message-ID: Subject: Re: Link preview generation with new link preview property To: Karthik Chikmagalur Cc: Ihor Radchenko , =?UTF-8?B?QmrDtnJuIEJpZGFy?= , emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000eb716e0629856f87" Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=numbchild@gmail.com; helo=mail-lf1-x12e.google.com 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -0.63 X-Spam-Score: -0.63 X-Migadu-Queue-Id: A11345B09D X-TUID: /G1dZImpqkxp --000000000000eb716e0629856f87 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I don't think so, my package org-link-beautify ported to the new :preview mechanism. The file preview not always image. Could be text, or icon etc. So pass in image object is not a good idea. It will limit preview functionality extensibility. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Tue, Dec 17, 2024 at 11:43=E2=80=AFAM Karthik Chikmagalur < karthikchikmagalur@gmail.com> wrote: > >> Would it be possible to also handle image data in the function or > >> refactor the org-link-preview-file function in a way that the geometry > >> handling is done in a helper function which can be reused by other > >> handlers. > > > > There is such function: `org-display-inline-image--width'. > > We may consider exposing it as public function. > > This will not be enough, we will also have to expose `org-image--align' > and the alignment code: > > (when align > (overlay-put > ov 'before-string > (propertize > " " 'face 'default > 'display > (pcase align > ("center" `(space :align-to (- center (0.5 . ,image)))) > ("right" `(space :align-to (- right ,image))))))) > > I don't think we can expect third party packages to figure out and > reimplement Org's image alignment logic. > > Considering this, it might be better to just split > `org-link-preview-file' into two public functions, where the "inside" > function accepts an image instead of a file. > > Karthik > > --000000000000eb716e0629856f87 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I don't think so, my package org-link-beautify po= rted to the new
:preview mechanism. The file preview not always image. C= ould be text, or
icon etc. So pass in image object is not a good idea. I= t will limit
preview functionality extensibility.

[stardiviner]=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!>=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): stardiv= iner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchild
= Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433=
Blog: http:= //stardiviner.github.io/

On Tue, Dec 17, 2024 at 11:43=E2=80=AFAM Karthik Chikmagalur &= lt;karthikchikmagalur@gmail= .com> wrote:
>> Would it be possible to also handle image data in the function= or
>> refactor the org-link-preview-file function in a way that the geom= etry
>> handling is done in a helper function which can be reused by other=
>> handlers.
>
> There is such function: `org-display-inline-image--width'.
> We may consider exposing it as public function.

This will not be enough, we will also have to expose `org-image--align'=
and the alignment code:

(when align
=C2=A0 (overlay-put
=C2=A0 =C2=A0ov 'before-string
=C2=A0 =C2=A0(propertize
=C2=A0 =C2=A0 " " 'face 'default
=C2=A0 =C2=A0 'display
=C2=A0 =C2=A0 (pcase align
=C2=A0 =C2=A0 =C2=A0 ("center" `(space :align-to (- center (0.5 .= ,image))))
=C2=A0 =C2=A0 =C2=A0 ("right"=C2=A0 `(space :align-to (- right ,i= mage)))))))

I don't think we can expect third party packages to figure out and
reimplement Org's image alignment logic.

Considering this, it might be better to just split
`org-link-preview-file' into two public functions, where the "insi= de"
function accepts an image instead of a file.

Karthik

--000000000000eb716e0629856f87--