GNU bug report logs - #77731
[PATCH] Add yank-media-handler for copied files from file manager

Previous Next

Package: emacs;

Reported by: Visuwesh <visuweshm <at> gmail.com>

Date: Fri, 11 Apr 2025 09:29:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Visuwesh <visuweshm <at> gmail.com>
To: 77731 <at> debbugs.gnu.org
Subject: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager
Date: Fri, 11 Apr 2025 14:58:32 +0530
[Message part 1 (text/plain, inline)]
[ This has been sitting in my drafts folder for many months now.  ]

Attached patch adds a yank-media-handler to message-mode to attach files
copied/cut from a file manager.  I tested this patch using pcmanfm and
xfe.  The regexp for the media-type was chosen after the blogpost [1],
pcmanfm in particular sets the media-type to
x-special/gnome-copied-files.

I strip the null byte in the split-string call in the handler because
pcmanfm adds a null byte at the end of clipboard selection.  I don't
know if this is the case with other file managers.

I also cannot find the spec of this clipboard type but [2] and pcmanfm
suggests that the selection is

    OPERATION
    file://FILE1
    file://FILE2...

where OPERATION is either cut or copy, and the rest of the lines are
links to the files.  I do the same as what Org does to parse the above.

1. https://larsee.com/blog/2019/05/clipboard-files/
2. https://indigo.re/posts/2021-12-21-clipboard-data.html

In GNU Emacs 30.0.50 (build 7, x86_64-pc-linux-gnu, X toolkit, Xaw
 scroll bars) of 2023-09-10 built on astatine
Repository revision: af1e860570191014d94484d6944348b1766ba59f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --with-json
 --without-xaw3d --without-gconf --without-libsystemd --without-cairo'

[0001-Add-yank-media-handler-for-copied-files-from-file-ma.patch (text/patch, attachment)]

This bug report was last modified 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.