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: yank-media: allow users to limit image types that can be inserted Date: Mon, 23 Sep 2024 18:54:25 +0300 Message-ID: <86ikumfjri.fsf@gnu.org> References: <79fc91f3-c2c3-44db-9817-595808917f26@cas.cat> <86ed5ahb08.fsf@gnu.org> <87zfnywki8.fsf@gmail.com> <86setqfnmq.fsf@gnu.org> <87frpqflv4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11582"; mail-complaints-to="usenet@ciao.gmane.io" Cc: visuweshm@gmail.com, pinmacs@cas.cat, emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 23 17:55:02 2024 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 1sslOv-0002oU-HE for ged-emacs-devel@m.gmane-mx.org; Mon, 23 Sep 2024 17:55:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sslOS-0008VK-Uh; Mon, 23 Sep 2024 11:54:32 -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 1sslOR-0008V3-Ej for emacs-devel@gnu.org; Mon, 23 Sep 2024 11:54:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sslOP-0005tR-JE; Mon, 23 Sep 2024 11:54:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=NFAAsQk0UkfRDg1MVoQoo6JHh4D6Nm4CA933QcOZUuU=; b=iARhCUVjAhaMTrx0DKTe 3BaEprEBd9At7x77yFQVkZZ4a8sckLjlK/njYW910a8Srkkr1o3RvZQjZVFgTkYl5j6lgsgx9/Lg0 9G6/o3wu9M7hL30d06/uf3sdJUHZry849ExIsLMGK3icqVlP3Yo/xIBbwJuGAS34DzjMM4q0t+ZfU CFen4qkeJgeWhL2xjyidwuPzjYPE0GgssgPpDokRVg3hOFaouKT62ABSWCGDPjzTDCpBVUh+o2LIp pisBSU0KY3LRucQ1hgugNbpwWaAfGn5Jpcax0OuTMukTIGedtojvuTDJI9+6bFkIaTtR+P4lDLgML yAAAoFy+DUyMmg==; In-Reply-To: <87frpqflv4.fsf@gmail.com> (message from Robert Pluim on Mon, 23 Sep 2024 17:09:03 +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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323971 Archived-At: > From: Robert Pluim > Cc: Visuwesh , pinmacs@cas.cat, emacs-devel@gnu.org > Date: Mon, 23 Sep 2024 17:09:03 +0200 > > Eli> IMO, for users we already have what is needed: when we detect several > Eli> formats, we show them to the user and ask him/her to tell us which > Eli> format he/she wants to use. > > But that requires user interaction. I think the original request could > be summed up as "if the list contains image/png, donʼt ask me, just > insert the image". That's not how I understand the request. It was not always PNG, it was "sometimes PNG, but if so-and-so-happens, the JPEG" etc. I'm okay with having C-y select one format, if we can come up with some reasonable default, but we need to discuss the algorithm to arrive at that default. And if the suggestion is to let users write a function to make that decision, then I'm squarely against that, because providing such functions is the job of Lisp programs. > Eli> The issue at hand here, AFAIU, is not the UI, but how Lisp programs > Eli> (and Org in particular) can control this. If the issue is the user > Eli> interface, then I honestly don't understand what issue is being > Eli> brought up, because in that case we already have the correct and > Eli> comprehensive solution, similar to what other advanced apps do in > Eli> these cases. > > You have to register the yank-media-handler before the yank-media > call, so org canʼt control this: it has to register for "image/.*" > because it canʼt know what formats will be presented to it. I guess it > could have a user option to filter the results from inside its > yank-media-handler, but then *every* package that wants to support > image yanking will have to implement something similar: we should just > implement such handling in the yank-media code. How else would you pull such a trick? And no one has explained yet why I would prefer PNG to JPEG or vice versa, btw. The usual choices I'm familiar with is whether or not to preserve typefaces, colors, and other fancy attributes; regarding images, there's just a decision whether you want to paste the material as a picture or as some kind of text, whether rich or not. So the background and the context for this request is still not clear to me.