From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.devel Subject: Re: yank-media: allow users to limit image types that can be inserted Date: Mon, 23 Sep 2024 19:16:23 +0530 Message-ID: <87zfnywki8.fsf@gmail.com> References: <79fc91f3-c2c3-44db-9817-595808917f26@cas.cat> <86ed5ahb08.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="14023"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: pinmacs , 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 15:47:16 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 1ssjPI-0003Uo-EY for ged-emacs-devel@m.gmane-mx.org; Mon, 23 Sep 2024 15:47:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ssjOc-0006Ei-Gu; Mon, 23 Sep 2024 09:46:34 -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 1ssjOa-0006EV-3T for emacs-devel@gnu.org; Mon, 23 Sep 2024 09:46:32 -0400 Original-Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ssjOY-0007Sl-D3; Mon, 23 Sep 2024 09:46:31 -0400 Original-Received: by mail-pg1-x542.google.com with SMTP id 41be03b00d2f7-7d4fbe62bf5so2488787a12.0; Mon, 23 Sep 2024 06:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727099188; x=1727703988; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ft+xS3EXkQpvwEzJcsVdb3hgPqfGL20IxhQlBNYjnqQ=; b=m4JIvl15L9i+C4RXc00A7SfQzhvoXSd5+eIq4/vudtgprcP58wSnfZsuIO0lXDrxvK WE1M8sEPm1vYIb+UtAgvsPTSUqkydG6vbAUsdgLA93Yjk0O3W8cX7iGDqNi6bWv2PHAD 76qq2NX4tBtwsu+rEDGxL47k/GBmtrG6yAT40ELWPPFFnvml/WDZxCEnIFOm6f1LYvza BvOhEzWNEAeCpaxB2zaUyJlf2PqXser0jKY7bUZO/f8H8gcwIfAKaiegbYuddwXJxq2H dYbZv+oUPIqBFyHoBM1c97N6bNYVEpdW+heItghbNA8fgoudxAg+DcZjzcKfCYBrjQBB xz+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727099188; x=1727703988; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ft+xS3EXkQpvwEzJcsVdb3hgPqfGL20IxhQlBNYjnqQ=; b=mIKVUX209GLNKQZ7TqXZZzVRcO4kPQUkThRTw9TihlNDvm2vi7ktUhZGch2GPQnH1n irfLvnaSvWnDBwAn2yCXJvut6Du7dwPoNFIAvpW26LbxXIIC5SwVkZhy+hOYpC0stLJc jYn/3bTr5q6OaTEBPmt6ZzEh8Rl5PslNqNQMNNYYTQWoyGRCjPQrH7cWnWz0w2oWeBF0 lV9ALr64TjIUGv2tWQq4+OSit31Gy11ALuVmhBGDOCEjXKQ61YdSyeBUEg1Xm3FUhHGE qpjYsuR4TSYhwzxidN5h1LOwfMReJseP0Rn6yyB2sZdaW1h6sHXsaPGPXXfxQcisargJ c6jA== X-Forwarded-Encrypted: i=1; AJvYcCVbaSNhdGYKTPxQBqsy/1Ztlbu9EO29mjstNic2CL88ekyyrcX/+8xyWw1BoFCHhKbIG7IJtPezIm/MEQ==@gnu.org X-Gm-Message-State: AOJu0YwmR4n5fHC/+92cdDn00T7y6rIwhcNstSdtgmxcVSSXspbjk/wq ixmvScUxvdrnvru7I+bXh5Z2wLOLndsSamqOQ5JTeUZ4WuLCh0Pfn/YefFhn X-Google-Smtp-Source: AGHT+IHqQKA2MJZP3oi9HXBeqr8aU3brfARN99m6Fa4sdpjpccNQYGGDTIsO4nKRjfUaN6w8bxV1OA== X-Received: by 2002:a05:6a21:3416:b0:1d2:e90a:f847 with SMTP id adf61e73a8af0-1d30a9fb533mr17069707637.37.1727099188152; Mon, 23 Sep 2024 06:46:28 -0700 (PDT) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2079475df17sm132993415ad.298.2024.09.23.06.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 06:46:27 -0700 (PDT) In-Reply-To: <86ed5ahb08.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 23 Sep 2024 14:20:39 +0300") Received-SPF: pass client-ip=2607:f8b0:4864:20::542; envelope-from=visuweshm@gmail.com; helo=mail-pg1-x542.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:323959 Archived-At: [=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: >> Date: Sun, 22 Sep 2024 13:53:06 -0300 >> From: pinmacs >>=20 >> I submitted the following Feature Request in the orgmode list [1]. They= =20 >> said that the second part related to "limitting image types that can be= =20 >> inserted" should be done in the core emacs side. >>=20 >> In that same thread [1], Ihor proposed different ways to implement it=20 >> [2], I also took how it explained the feature as part of this email-subj= ect. >>=20 >> The thing is that with orgmode we can easily attach images to buffer=20 >> thanks to `yank-media' feature, but there is a dialogue we cannot skip=20 >> and that is: selecting image types. Find attached an image file=20 >> "selecting-image-types.png", where you can see the 7 candidates for a=20 >> screenshot I did to serve as an example. >>=20 >> 1. In case I want to be fast, I would like to skip that dialog entirely= =20 >> and just use the image/png variant. >> 2. In another perspective, I would consider that the relevant decision=20 >> for a screenshot would be between two of them: image/png and image/jpeg >> 3. Another user could argue why the other 5 types are interesting in=20 >> general or for their particular use case... >>=20 >> ... but let's stop that discussion here. Looks like filtering image=20 >> types would be a useful customization for the users. If done as a=20 >> variable, in certain cases, that could be local binded and specific to=20 >> some fast function that immediately inserts an image, and in another=20 >> case, the global var would select only those image types relevant for=20 >> that particular user. >>=20 >> That is also positive if users want to add even more image types, with a= =20 >> good and reasonable default, users will not worry about too many options= =20 >> at some point. > > 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. 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 then 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.