From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Thu, 08 Sep 2022 21:15:37 +0200 Message-ID: <87h71hekyu.fsf@logand.com> References: <87v8pz18wf.fsf@mail.jao.io> <83o7vrgimc.fsf@gnu.org> <87wnafdnee.fsf@logand.com> <87a67bymys.fsf@mail.jao.io> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20183"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jose A Ortega Ruiz , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 08 21:17:10 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 1oWN1R-000502-Nb for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 21:17:09 +0200 Original-Received: from localhost ([::1]:59900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWN1Q-0006jw-Mz for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 15:17:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWN09-0005uw-Cu for emacs-devel@gnu.org; Thu, 08 Sep 2022 15:15:49 -0400 Original-Received: from logand.com ([37.48.87.44]:39430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWN04-0002dj-8A; Thu, 08 Sep 2022 15:15:48 -0400 Original-Received: by logand.com (Postfix, from userid 1001) id B3DF21A1790; Thu, 8 Sep 2022 21:15:39 +0200 (CEST) X-Mailer: emacs 28.1 (via feedmail 11-beta-1 I) In-Reply-To: <87a67bymys.fsf@mail.jao.io> Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:295004 Archived-At: On Wed 07 Sep 2022 at 20:59, Jose A Ortega Ruiz wrote: > On Wed, Sep 07 2022, Tomas Hlavaty wrote: >> First, tty emacs would need to understand images instead of throwing >> error. At least their dimensions. Maybe using some library or even in >> elisp, for example like this >> https://logand.com/sw/emacs-framebuffer/file/emacs-framebuffer.el.html#l286 >> I have not figured out, how to actually plug it into upstream emacs, as >> this seems to require a lot of changes to C code. > > fwiw, in the kitty case, image libraries are going to be almost for sure > available, it being an x11/wayland application. so an emacs compiled > with image support (but not necessarily linking against any x libs) > doesn't seem like a strong requirement. in that scenario, determining > the size of an image wouldn't needed a lot of C code, would it? Note the difference between "a lot of changes to C code" vs "a lot of C code". I already linked an elisp function which does that. It would be easy to write it in C. Emacs already has the capability anyway. The problem is, that that capability is not available in tty emacs: (image-size (create-image "/tmp/a.jpg")) => (error "Window system frame should be used") Would it be possible to fix that? > 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?)