From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Thu, 08 Sep 2022 22:30:07 +0300 Message-ID: <837d2dekao.fsf@gnu.org> References: <87v8pz18wf.fsf@mail.jao.io> <83o7vrgimc.fsf@gnu.org> <87wnafdnee.fsf@logand.com> <87a67bymys.fsf@mail.jao.io> <87h71hekyu.fsf@logand.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12619"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jao@gnu.org, emacs-devel@gnu.org To: Tomas Hlavaty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 08 21:31:43 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oWNFW-0003BU-QG for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 21:31:42 +0200 Original-Received: from localhost ([::1]:34514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNFV-0005h6-T7 for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 15:31:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNEW-0004m3-8c for emacs-devel@gnu.org; Thu, 08 Sep 2022 15:30:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNEU-0005Pu-4S; Thu, 08 Sep 2022 15:30:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=lybW16zzEym9NSjipoGQGRgirTzcSfHCq5XIM5y5jWY=; b=Yw6jdmWZ2bjW 7gTdn0kjwz75Z3+0gJM1Rrl9wN/RgKLjIjgrGOlg9/z10Mn5JmzJBXnojo00Nt8+89wQXBj3TZFRZ 10oVAk1y8P9cqD7uc495WtXPxmd/FG2QObKSUB5ZgqZ9n5MDZbuVXrelwv5o6u6gMDJcLD1T6txpy I7g+ND59ulVyxOBXYixN95kO+vEBMzaUTjjBtzim5ONaHMWpbnzoShhq+Z8+AiompkpRf3CKuNhyF VqSAl2RLIZvlOEz04CjZMmqRhIzhay0+QpoE4yHArktoVEghj0/pMNkninqQOnJt1yjHnlpOqf4Yq a2s2Ti/a3OBm+1zDfP++Yw==; Original-Received: from [87.69.77.57] (port=1925 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNED-0007VK-LM; Thu, 08 Sep 2022 15:30:35 -0400 In-Reply-To: <87h71hekyu.fsf@logand.com> (message from Tomas Hlavaty on Thu, 08 Sep 2022 21:15:37 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295006 Archived-At: > From: Tomas Hlavaty > Cc: emacs-devel@gnu.org > Date: Thu, 08 Sep 2022 21:15:37 +0200 > > The problem is, that that capability is not available in tty emacs: Yes, it _is_ available. We just suppress it. > (image-size (create-image "/tmp/a.jpg")) > => (error "Window system frame should be used") This is us deliberately failing image-size early on, because we don't want complications down the road, and because we know images cannot be displayed on TTY frames. > Would it be possible to fix that? I don't see why it would be hard. E.g., this works just fine in a -nw session: (create-image "/tmp/a.jpg") > > and, if > > those libraries are not available, a call to "file foo.png" is (at least > > in my system) telling me the size of foo.png... kind of hacky, of > > course, but as a first step maybe good enough. > > This is the easy part. Then you need to change the existing emacs C > code to actually call that. > > (btw isn't the file program potential security issue?) We don't need 'file', Emacs already knows how to compute the size of an image.