[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: |
Visuwesh |
Subject: |
Re: yank-media: allow users to limit image types that can be inserted |
Date: |
Sun, 27 Oct 2024 20:32:21 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
[ஞாயிறு அக்டோபர் 27, 2024] Eli Zaretskii wrote:
>> From: Visuwesh <visuweshm@gmail.com>
>> Cc: Ihor Radchenko <yantar92@posteo.net>, pinmacs@cas.cat,
>> rpluim@gmail.com, emacs-devel@gnu.org
>> Date: Sun, 27 Oct 2024 15:06:36 +0530
>>
>> [ஞாயிறு அக்டோபர் 27, 2024] Eli Zaretskii wrote:
>>
>> >> From: Ihor Radchenko <yantar92@posteo.net>
>> >> Cc: visuweshm@gmail.com, pinmacs@cas.cat, rpluim@gmail.com,
>> >> emacs-devel@gnu.org
>> >> Date: Sun, 27 Oct 2024 08:17:22 +0000
>> >>
>> >> Eli Zaretskii <eliz@gnu.org> writes:
>> >>
>> >> 1. clipboard contains 2 MIME types: image/png, image/bmp
>> >> 2. clipboard contains 1 MIME type: image/png
>> >> 3. clipboard contains 1 MIME type: image/bmp
>> >>
>> >> We want to handle all three scenarios in the following way:
>> >> 1. Select image/png (prefer it over image/bmp)
>> >> 2. Select image/png
>> >> 3. Select image/bmp (there is no image/png that we would prefer otherwise)
>> >>
>> >> In all three cases, we do not want to prompt user about mimetype choice.
>> >>
>> >> How can we do it using the existing Elisp API?
>> >
>> > Examine the available TARGETS, then bind
>> > yank-media--registered-handlers to the appropriate value when invoking
>> > yank-media.
>>
>> Would that not defeat the point of yank-media, which is to present a
>> simple, common interface to the clipboard data to major-mode authors?
>
> Which part of the above would "defeat the point of yank-media", and
> why?
yank-media presents a uniform interface to clipboard data across
platforms, in principle. This implies that there is no need to know the
ugly details of how the clipboard data is to be fetched, which data
types are available and which of them are bogus, etc. The major-mode
authors would simply write handlers for all relevant data types and
leave it to the user to choose the preferred type if more than one of
them is handled by the major-mode.
But if the major-mode authors have to cater to the user's preferred data
types by looking at TARGETS in their "major-mode-yank-media" command,
that defeats the abstraction yank-media provides... The entire point of
using the library, IMHO, is to leave out this nasty business of handling
the clipboard to a third party.
>> This approach also means that we would end up with org-yank-media,
>> html-yank-media, etc. which does not sound better.
>
> If Org has its own ideas about what's best for the users in some
> situations, and if the users agree with that, I don't see what is
> wrong with that. The common interface presented by yank-media to
> major modes is there so that major modes could use it in whichever
> ways they think is best for their users. So I see no problems in
> major modes deciding to prefer some handlers over others, not in
> principle.
We do not disagree about this at all. What we do disagree on is the
means by which to achieve this. If we could specify a filter function
as a variable that filters out the available data types before
presenting it to the user, the major-mode authors would be saved the
burden of writing their yank-media-like command which requires the
knowledge of obtaining TARGETS and potentially ignoring bogus types in
it.
- Re: yank-media: allow users to limit image types that can be inserted, Ihor Radchenko, 2024/10/26
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/26
- Re: yank-media: allow users to limit image types that can be inserted, Ihor Radchenko, 2024/10/27
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/27
- Re: yank-media: allow users to limit image types that can be inserted, Visuwesh, 2024/10/27
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/27
- Re: yank-media: allow users to limit image types that can be inserted,
Visuwesh <=
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/27
- Re: yank-media: allow users to limit image types that can be inserted, Visuwesh, 2024/10/28
- Re: yank-media: allow users to limit image types that can be inserted, Visuwesh, 2024/10/29
- Re: yank-media: allow users to limit image types that can be inserted, Pedro, 2024/10/31
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/31
- Re: yank-media: allow users to limit image types that can be inserted, pinmacs, 2024/10/31
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/31
- Re: yank-media: allow users to limit image types that can be inserted, pinmacs, 2024/10/31
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/31
- Message not available
- Re: yank-media: allow users to limit image types that can be inserted, Eli Zaretskii, 2024/10/31