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: Fri, 01 Nov 2024 10:50:43 +0530 Message-ID: <87jzdny1g4.fsf@gmail.com> References: <79fc91f3-c2c3-44db-9817-595808917f26@cas.cat> <87frpqflv4.fsf@gmail.com> <86ikumfjri.fsf@gnu.org> <877cb2fj0c.fsf@gmail.com> <86cykufhw7.fsf@gnu.org> <3a015d0f-549a-401f-be1c-651c9dbd5d9a@cas.cat> <8634lqfcaf.fsf@gnu.org> <87ikulwsd6.fsf@gmail.com> <86o74ddzxp.fsf@gnu.org> <87msiqvkph.fsf@localhost> <86ed42bs03.fsf@gnu.org> <874j4yot7x.fsf@localhost> <861q01c3h9.fsf@gnu.org> <87wmht3n17.fsf@gmail.com> <86v7xdamck.fsf@gnu.org> <87sesh37ya.fsf@gmail.com> <86iktd8o9h.fsf@gnu.org> <87iktb171d.fsf@gmail.com> <861pzw4r3j.fsf@gnu.org> <87v7x8y81c.fsf@gmail.com> <86ttcs38a8.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="4231"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: yantar92@posteo.net, pinmacs@cas.cat, rpluim@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 01 06:21:40 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 1t6k6O-0000vu-4u for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Nov 2024 06:21:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6k5e-0005UA-JU; Fri, 01 Nov 2024 01:20:54 -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 1t6k5d-0005U2-9P for emacs-devel@gnu.org; Fri, 01 Nov 2024 01:20:53 -0400 Original-Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6k5a-0005cN-Pn; Fri, 01 Nov 2024 01:20:53 -0400 Original-Received: by mail-pl1-x642.google.com with SMTP id d9443c01a7336-20c7ee8fe6bso15699705ad.2; Thu, 31 Oct 2024 22:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730438448; x=1731043248; 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=pXf8NGYmBnluV6ILg5OUjSIMVERSrdbM2DrQpQ3Sz2Q=; b=XTXEhJzR2lNVIxIq3qeq5J6gfTySMa5XaxMAbQFcpsaYIT7PnkWAK5iJM9WxPPmZh7 VMRUzw8EQ3qCvgimr9dQUuelDAMCZPyCHFIDzeQRyL1kasFgHHQL5MRv782NxFxLwtxU xkvHGJpRSYX0mUt2S7PMA8FhMSP6BsEOZpFGq6C22Qb5LckgN/0yv7V739kZf7mvFIPo e7362+lSzwEZrPTC6W9kwLvOt06+yh+yvppc3drMg8zm4mmeO6s2t1GrXt9gd4zoCcMJ DcpJtST3ML4yTM7+5zdV48si62UbScimD4I2WvpQ+ePL0wE07zT17H2rVwf962HJe581 ZoQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730438448; x=1731043248; 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=pXf8NGYmBnluV6ILg5OUjSIMVERSrdbM2DrQpQ3Sz2Q=; b=Q+cUJBhWw+kR9dtu8IlQpoTS1Sz80RbvBMdbvx6NOfxIMWHkNIVOfEIJ+bZg/yZtwQ fjPnIkDF2fYl+l0wqj7PAI1XNzkDYn5TQJyhu73y3smOtTQQU+pBONaBia8PXyzZWb9i dMlAOEnDDjwgwnUx68Qmq+1CJpuk933PeW+WaTENKENzYHQ139VUdCvyGfXytIp69bzd MwdQ5akPM4BlojuHsKQCknuKnadYU2GTZ5Cid/hz7KTbywK4dp4hBQxbKB7Z/XmIAS2B y81E9EzyXn/3xUxnw5M+bw9fWSiC5GdroIIGeqshDcoFjw/APCSjamCkFR4QmWaT6sYo S8vg== X-Forwarded-Encrypted: i=1; AJvYcCUK7kOcraa8EnnfdMVNeA+hb0RAWtpvlWAVeRIYv8BRfd8iVSMIMYPnsb2gmP9noj2huPG02Tt4lUYONA==@gnu.org X-Gm-Message-State: AOJu0Yw0hvYyb9px4jTQH33ly5g2bShtb7tW/Ypp4fiIG9glGGMh/HUA 11SJ6CgDy6sKH0RYp9b4M2GEHQD+1RMhVzQANkHaHkuC7fDx1tNyAv8cVyiC8FY= X-Google-Smtp-Source: AGHT+IEO0vjpycWtZv0DgkbSsDlDXI/Ys0O384eiVGkd6isYWAU5u4sMnlp1dMYwtz7rs139EdnC7g== X-Received: by 2002:a17:903:1104:b0:20c:8cc4:cf25 with SMTP id d9443c01a7336-210c6c2a1d5mr285828105ad.36.1730438448092; Thu, 31 Oct 2024 22:20:48 -0700 (PDT) Original-Received: from localhost ([1.7.159.70]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211056edc34sm16331275ad.51.2024.10.31.22.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 22:20:47 -0700 (PDT) In-Reply-To: <86ttcs38a8.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 31 Oct 2024 11:56:31 +0200") Received-SPF: pass client-ip=2607:f8b0:4864:20::642; envelope-from=visuweshm@gmail.com; helo=mail-pl1-x642.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:324986 Archived-At: [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE=85= =E0=AE=95=E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 31, 2024] E= li Zaretskii wrote: >> From: Visuwesh >> Cc: yantar92@posteo.net, pinmacs@cas.cat, rpluim@gmail.com, >> emacs-devel@gnu.org >> Date: Thu, 31 Oct 2024 14:16:07 +0530 >>=20 >> > This (and the patch you suggest) completes the full circle of this >> > discussion: it started when I said that such a global preference makes >> > very little sense to me, based on my experience with yanking different >> > data types in other applications. Users have no reason for such >> > preferences, as they almost never have enough reasons to prefer one >> > type over the others _globally_. The preference only makes sense in >> > each specific case, and then asking the user to choose is exactly TRT, >> > which we already do. >>=20 >> At least for images, I see a value in having a global preference. You >> also seem to agree on this point. > > I agree with having an Emacs-wide preference rule, not with asking > users to define those preferences. > >> > Major mode _does_ have a part: it registers only the handlers it wants >> > to support. So it determines, up front, which media types will be >> > available, even if more of them are in the clipboard. >>=20 >> I agree but its participation could be improved. When you copy a cell >> from LibreOffice's Excel clone, it puts both image/png and a TSV data >> type in your clipboard. Taking the example of Org which has a handler >> registered for image/png: if it registers a handler for the TSV data >> type, the user would be asked to choose between image/png and TSV when >> she copies a table cell. The intent of registering image/png is a >> hindrance here. Having a separate command for yanking a table cell >> would remove the convenience of having a single command that does TRT. > > The default yank-media (e.g., with an argument) should yank the TSV > format, and only offer the PNG format as an option if the user for > some reason wants that. > >> > Please tell me why on earth would you prefer PNG to JPEG when yanking, >> > or vice versa. The result is an image displayed in the buffer, which >> > is neither PNG nor JPEG. Why does it matter _for_you_personally_ >> > which intermediate format will Emacs use as part of the yanking >> > process? >>=20 >> You answered the question yourself: >>=20 >> For example, JPEG is generally inferior because it's lossy, so we >> could have that hypothetical variant of yank-media which doesn't ask >> questions to always prefer PNG to JPEG if both are possible. > > That is not something we should ask users to do, IMO. > >> > If we want to avoid the question when several image formats are >> > available, we could teach Org, or Emacs in general, which formats to >> > prefer. For example, JPEG is generally inferior because it's lossy, >> > so we could have that hypothetical variant of yank-media which doesn't >> > ask questions to always prefer PNG to JPEG if both are possible. This >> > is IMO better than asking the users to decide that for Emacs. >>=20 >> I agree, but can we, at least, agree that it should be easy to override >> it completely? > > Override how and for what purpose? If we have a command which asks > the user to select one format from a list of available ones, the > general preference can always be overridden, just on a case by case > basis. Why do we also need to override it globally? > >> > Anyway, since with this message we've made a full circle, let me >> > summarize my opinions on this: >> > >> > . I think we should add to Emacs rules for preferring one media >> > format over the others when several are available and supported >> > . Such rules should be customized by major modes based on their >> > features and preferences (e.g., a mode that has no support for >> > faces might prefer plain text to other textual formats) >>=20 >> (1) and (2) would be best done with the help of user feedback. > > Feedback is always welcome, but I submit that we can formulate a very > good approximation for the rules without any feedback. > >> IMO, coming up with such rules is a long game that requires user >> feedback (like the one that started this whole thread). > > No, I think it is actually quite simple and will be quite close to the > optimum the first time we come up with such rules. It is possible > that a major mode will want to override the rules, for its own > reasons, but that should also be very obvious for each mode. > >> > . I think we should have a variant of yank-media that yanks "the >> > best" of the available formats without asking, based on the above >> > rules >>=20 >> I like your idea of reusing C-u for this. >>=20 >> > If after all of this people still want a global "preference", I won't >> > mount the barricades to fight that, although, as I explained, such a >> > global preference makes little sense to me, and sounds like an >> > inferior replacement for the missing built-in preference rules I think >> > we should have. >>=20 >> The built-in preference rules is already a global "preference" from >> where I stand. Only that, the OP wanted control over these rules. > > And I'm saying that I don't understand why users would need such > control, in addition to being able to select a format in each case. OK, I think I finally understand your stance: we let yank-media pick the best format out of all in the clipboard based on rules that a major-mode can tweak. Apart from this, we also have C-u or somesuch that asks the user to select the data type instead of auto-selecting it. Since the C-u is good enough to override a case-by-case basis, you do not see value in having a defcustom to let the user customise the selection rules for the best data type, correct?