emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yank-media: allow users to limit image types that can be inserted


From: Eli Zaretskii
Subject: Re: yank-media: allow users to limit image types that can be inserted
Date: Thu, 31 Oct 2024 11:56:31 +0200

> From: Visuwesh <visuweshm@gmail.com>
> Cc: yantar92@posteo.net,  pinmacs@cas.cat,  rpluim@gmail.com,
>   emacs-devel@gnu.org
> Date: Thu, 31 Oct 2024 14:16:07 +0530
> 
> > 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.
> 
> 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.
> 
> 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?
> 
> You answered the question yourself:
> 
>     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.
> 
> 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)
> 
> (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
> 
> I like your idea of reusing C-u for this.
> 
> > 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.
> 
> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]