From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: yank-media: allow users to limit image types that can be inserted Date: Mon, 23 Sep 2024 17:09:03 +0200 Message-ID: <87frpqflv4.fsf@gmail.com> References: <79fc91f3-c2c3-44db-9817-595808917f26@cas.cat> <86ed5ahb08.fsf@gnu.org> <87zfnywki8.fsf@gmail.com> <86setqfnmq.fsf@gnu.org> 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="24382"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Visuwesh , pinmacs@cas.cat, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 23 17:09:21 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 1sskgj-0006A5-EE for ged-emacs-devel@m.gmane-mx.org; Mon, 23 Sep 2024 17:09:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sskgZ-000319-M3; Mon, 23 Sep 2024 11:09:11 -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 1sskgX-00030a-3B for emacs-devel@gnu.org; Mon, 23 Sep 2024 11:09:09 -0400 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sskgV-0008WK-Gc; Mon, 23 Sep 2024 11:09:08 -0400 Original-Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-378f600e090so2533973f8f.3; Mon, 23 Sep 2024 08:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727104145; x=1727708945; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from:from :to:cc:subject:date:message-id:reply-to; bh=DUGAaV0iK2uHVMzVKisGbwiZAnb5wY5QJ2f/Wof9XUE=; b=ZYCsnDX7Z+V3pPJyI+4969TJPRF2F/A5q0W3hLwiOdAFyPCpU2xtRjcJtHvFsTlMnS kpQ5+PeuScVO/jGVt6mYqeAn3rV+ao2VwZ4ig+hZqjRRueDLZkxwXDdgY7xdBMukTVyq 67L4C5fJqeN5W2/LjKwt2+7lK6GZleMBeerioj8Zb5bkhzMB+mPdntea4Kn/VZat0esA BBFwSvzo404tZO1MYPLhVCjhx8vBje+ESDgHDot1fWKXCWypBsg9ViQpaOauCaFC5ing vJm8H7A0ZgEKtxwt39bEAFj4j4lI5EvCTwyaPxXKleTzE4vIsgsXZX0c6WXRqIm5e8p2 ZLWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727104145; x=1727708945; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DUGAaV0iK2uHVMzVKisGbwiZAnb5wY5QJ2f/Wof9XUE=; b=eF0G2OZP9prlp/mNi/QXw5q11IXYUQjE9RFOg1MClMin7HaZ4h8Ng5Cejb5w9gvJF9 gcMZj58OVMWv5Thm/K2k/sMz6U9O4MzvYCa8OxIpsH0eNjNt1ZcIzQT+KpgR6/12gF1H SwEULbxJX99pt6aJ0kmB2/DOGoJs2lGgDOqkyMFz/qhV97X3lrGx74K1HWUEJeURdmyI B+cDMsUgjm6qLAG4+ZBDcHeuyGR9ircDvlYvM/cEK6OiWNVR/K/0lL1d3cb4LdiONKZU EgdcW04GNd7dX5nO7R40cL0f0nx7numngAs1loNrT5qO5fQdYm6rx2O71sTrOXGqK3Y3 BTxA== X-Forwarded-Encrypted: i=1; AJvYcCWDiXGbHoRUg0cnBAQ+YWU+DYTAHbTcojGDwuBwGBT2MXFHcJ7Vm6HpaHLE+YnqUdf5fyiIEUKs9r0isA==@gnu.org X-Gm-Message-State: AOJu0YwK/ktV7zcNpTtALdvY71I7TVS7DdzdJB5GNvTN5qmISkRsavO6 DVD46xmXMsi2osS2A97I1CB2wRI4CMxegj/3vxIZQXrNkLdu4n5hIdN7qw== X-Google-Smtp-Source: AGHT+IHLHbvGBdjGLnMKnon80jDrdAnHwyag4AaG0oMA256Mup0jDHzG+XTpDmng+N/l2fouJ8pJdw== X-Received: by 2002:a5d:5f83:0:b0:374:c977:363 with SMTP id ffacd0b85a97d-37a43154e86mr7940600f8f.24.1727104145039; Mon, 23 Sep 2024 08:09:05 -0700 (PDT) Original-Received: from rltb ([2a01:e0a:3f3:fb51:4318:aaaa:4cce:d340]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378e78054absm24759885f8f.106.2024.09.23.08.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 08:09:04 -0700 (PDT) In-Reply-To: <86setqfnmq.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 23 Sep 2024 17:30:53 +0300") Gmane-Reply-To-List: yes Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=rpluim@gmail.com; helo=mail-wr1-x42d.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, 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-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:323964 Archived-At: >>>>> On Mon, 23 Sep 2024 17:30:53 +0300, Eli Zaretskii said: >> From: Visuwesh >> Cc: pinmacs , emacs-devel@gnu.org >> Date: Mon, 23 Sep 2024 19:16:23 +0530 >>=20 >> [=E0=AE=A4=E0=AE=BF=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D =E0= =AE=9A=E0=AF=86=E0=AE=AA=E0=AF=8D=E0=AE=9F=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE= =B0=E0=AF=8D 23, 2024] Eli Zaretskii wrote: >>=20 >> > Isn't this already possible by using yank-media-handler to register >> > only the handlers the Lisp program wants to handle? If that doesn= 't >> > fit the bill, please explain why. >>=20 >> When you copy an image in Firefox, it puts both image/png and image/= jpeg >> in the clipboard. The Lisp program could register a handle for >> image/png but if the non-Emacs program puts only, say, image/jpeg th= en >> we wouldn't be able to handle the image anymore. For the most part,= the >> Lisp program wouldn't care about the specific format of the image but >> the fact that it is an image. An user option that would tell the >> preferred type in the presence of _multiple_ matches for the handler= 's >> regexp would be nice to have. Eli> IMO, for users we already have what is needed: when we detect seve= ral 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=CA=BCt ask me, just insert the image". 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=CA=BCt control this: it has to register for "image/.*" because it can=CA=BCt 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. Robert --=20