all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: luangruo@yahoo.com, 65892@debbugs.gnu.org
Subject: bug#65892: 30.0.50; yank-media fails for clipboard selection that are wiped after being accessed
Date: Fri, 28 Jun 2024 09:50:33 +0530	[thread overview]
Message-ID: <87r0ch4s1a.fsf@gmail.com> (raw)
In-Reply-To: <86sex19o0c.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 25 Jun 2024 15:59:31 +0300")

[செவ்வாய் ஜூன் 25, 2024] Eli Zaretskii wrote:

>> From: Visuwesh <visuweshm@gmail.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  65892@debbugs.gnu.org
>> Date: Tue, 25 Jun 2024 10:06:35 +0530
>> 
>> BTW, I would be happy if I can do the above copying/cutting files from
>> _dired_ without resorting to xclip(1) to set non-STRING targets.  I
>> tried to do it with the facilities offered by Emacs but failed to set
>> _only_ the required target without other things like STRING.  The same
>> happened when I tried to copy an image to the clipboard.  I would be
>> happy to open a bug report or some such if you're interested.
>
> Isn't this the expected behavior?  The application that sets the
> clipboard data has no idea what the consumer might need or would want
> to do with the data.  It could past the image, or it could take the
> image's meta-data (STRING) and do something with it.  Or it could take
> the image's file name and copy the file somewhere.  Or something else.
> This is why it is customary to put all the relevant data types in the
> clipboard, so that the consumers could take whatever they need.

While what you say makes perfect sense, I seldom find this to be the
case.  But I think I worded my message too poorly.  As per the manual [1], I
can set use text-property to set an alternate TARGET as

    (gui-set-selection
     'CLIPBOARD
     (propertize "asd" 'x-special/gnome-copied-files
                 "copy\nfile:///home/viz/.mkshrc\nfile:///home/viz/.profile\0"))

If I do

    (x-get-clipboard)

I get

    #("asd" 0 3 (x-special/gnome-copied-files "copy
    file:///home/viz/.mkshrc
    file:///home/viz/.profile\0"))

(where I changed the actual NULL character to \0).  But 

    (gui-get-selection 'CLIPBOARD 'x-special/gnome-copied-files) ;; => nil

In fact, if I do

    (gui-get-selection 'CLIPBOARD 'TARGETS)

I get

    [TIMESTAMP MULTIPLE TEXT COMPOUND_TEXT STRING UTF8_STRING text/plain text/plain\;charset=utf-8 TARGETS LENGTH DELETE FILE_NAME CHARACTER_POSITION LINE_NUMBER COLUMN_NUMBER OWNER_OS HOST_NAME USER CLASS NAME ATOM INTEGER SAVE_TARGETS]

with the x-special/gnome-copied-files nowhere in sight.  If I evaluate
x-get-clipboard in a fresh emacs -Q, I obviously don't see the
text-property too.  I thought the inability of gui-get-selection to
return the expected was because there isn't a proper function for the
TARGET in selection-converter-alist but that should not matter since
yank-media does handle this type fine with just a gui-get-selection
call.  So the problem is with the inability to specify the TARGETS I
think.  If I do

    % printf '%s\0' "copy\nfile:///home/viz/.mkshrc\nfile:///home/viz/.profile" |xclip -t x-special/gnome-copied-files -selection clipboard

I get

    (gui-get-selection 'CLIPBOARD 'TARGETS) ;; => [TARGETS x-special/gnome-copied-files]

If you replace x-special/gnome-copied-files with an image, the same
argument holds.

Perhaps I simply do not understand the manual but I cannot find how to
set the TARGET properly.  It would be nice if the relevant info node
could have examples of gui-set-selection that does sets the clipboard to
have an image as the DATA, or something else.

I hope this is clear.  Sorry for my late reply.

1. (info "(elisp) Window System Selections")





  reply	other threads:[~2024-06-28  4:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 16:54 bug#65892: 30.0.50; yank-media fails for clipboard selection that are wiped after being accessed Visuwesh
2024-06-24  3:53 ` Visuwesh
2024-06-24 12:13   ` Eli Zaretskii
2024-06-24 13:46     ` Visuwesh
2024-06-25  3:45       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-25  4:36         ` Visuwesh
2024-06-25 12:59           ` Eli Zaretskii
2024-06-28  4:20             ` Visuwesh [this message]
2024-06-28  8:59               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-28 10:03                 ` Visuwesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0ch4s1a.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=65892@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.