Package: emacs;
Reported by: Visuwesh <visuweshm <at> gmail.com>
Date: Fri, 11 Apr 2025 09:29:01 UTC
Severity: normal
Tags: patch
To reply to this bug, email your comments to 77731 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Fri, 11 Apr 2025 09:29:01 GMT) Full text and rfc822 format available.Visuwesh <visuweshm <at> gmail.com>
:bug-gnu-emacs <at> gnu.org
.
(Fri, 11 Apr 2025 09:29:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: bug-gnu-emacs <at> gnu.org Subject: [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)]
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Fri, 11 Apr 2025 11:32:02 GMT) Full text and rfc822 format available.Message #8 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Visuwesh <visuweshm <at> gmail.com>, Po Lu <luangruo <at> yahoo.com> Cc: 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Fri, 11 Apr 2025 14:31:06 +0300
> From: Visuwesh <visuweshm <at> gmail.com> > Date: Fri, 11 Apr 2025 14:58:32 +0530 > > [ 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. Thanks, but copy/paste operations on files should first and foremost be supported in Dired, no? Limiting such support to message-mode seems too narrow and much less useful than it could be, let alone what users would expect. Can we support this in Dired? > 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 I wonder if this is too specific to the specific file managers you tested this with. If it is, should we try to support more file managers? > +(defun message--yank-media-copied-files-handler (_ data) > + "Attach files copied/cut from the file manager. The name and the doc string should be more specific to the file managers for which this is supposed to work. I doubt that these details are general enough to say that any file manager capable of copy/pasting files will behave like that. Btw, isn't copy/paste of files similar or maybe even equivalent to drag-n-drop? If so, perhaps a better way would be to use the DND machinery we have in Emacs? Adding Po Lu in case he has opinions or comments about this.
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Fri, 11 Apr 2025 11:45:01 GMT) Full text and rfc822 format available.Message #11 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Eli Zaretskii <eliz <at> gnu.org> Cc: Po Lu <luangruo <at> yahoo.com>, 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Fri, 11 Apr 2025 17:14:36 +0530
[வெள்ளி ஏப்ரல் 11, 2025] Eli Zaretskii wrote: >> From: Visuwesh <visuweshm <at> gmail.com> >> Date: Fri, 11 Apr 2025 14:58:32 +0530 >> >> [ 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. > > Thanks, but copy/paste operations on files should first and foremost > be supported in Dired, no? Limiting such support to message-mode > seems too narrow and much less useful than it could be, let alone what > users would expect. > > Can we support this in Dired? Sure, I can prepare a patch that would copy/rename the file if the user has copy/cut the file from her file manager. I have code for this living in my init file. >> 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 > > I wonder if this is too specific to the specific file managers you > tested this with. If it is, should we try to support more file > managers? I believe covering x-special/gnome-copied-files will cover a large ground of file managers. Obviously, I have no idea how to support file managers in MacOS or Windows. >> +(defun message--yank-media-copied-files-handler (_ data) >> + "Attach files copied/cut from the file manager. > > The name and the doc string should be more specific to the file > managers for which this is supposed to work. I doubt that these > details are general enough to say that any file manager capable of > copy/pasting files will behave like that. See above. I can say that it works with pcmanfm, xfe, and thunar if my memory serves right. > Btw, isn't copy/paste of files similar or maybe even equivalent to > drag-n-drop? They essentially serve to perform the same function in most cases, yes. > If so, perhaps a better way would be to use the DND machinery we have > in Emacs? Adding Po Lu in case he has opinions or comments about > this. As in, call the relevant function in dnd-protocol-alist for ^file:///? This hasn't crossed my mind. I am not opposed to this idea.
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Fri, 11 Apr 2025 12:12:02 GMT) Full text and rfc822 format available.Message #14 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Po Lu <luangruo <at> yahoo.com> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 77731 <at> debbugs.gnu.org, Visuwesh <visuweshm <at> gmail.com> Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Fri, 11 Apr 2025 20:10:45 +0800
Eli Zaretskii <eliz <at> gnu.org> writes: >> From: Visuwesh <visuweshm <at> gmail.com> >> Date: Fri, 11 Apr 2025 14:58:32 +0530 >> >> [ 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. > > Thanks, but copy/paste operations on files should first and foremost > be supported in Dired, no? Limiting such support to message-mode > seems too narrow and much less useful than it could be, let alone what > users would expect. > > Can we support this in Dired? +1. >> 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 > > I wonder if this is too specific to the specific file managers you > tested this with. If it is, should we try to support more file > managers? > >> +(defun message--yank-media-copied-files-handler (_ data) >> + "Attach files copied/cut from the file manager. > > The name and the doc string should be more specific to the file > managers for which this is supposed to work. I doubt that these > details are general enough to say that any file manager capable of > copy/pasting files will behave like that. > Btw, isn't copy/paste of files similar or maybe even equivalent to > drag-n-drop? If so, perhaps a better way would be to use the DND > machinery we have in Emacs? Adding Po Lu in case he has opinions or > comments about this. Regrettably not, since the formats concerned differ subtly and DND gives a weight to negotiating actions on dropped data that is undue for a simple copy/paste operation. The selection formats you must recognize are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, and FILE, which are NULL-separated lists of strings, and numerous ad hoc formats defined by file managers and desktop environments. If you like, you may implement a rough draft that functions satisfactorily with whatever file managers you test, and I shall supply its deficiencies as best I can.
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Fri, 11 Apr 2025 13:12:02 GMT) Full text and rfc822 format available.Message #17 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Po Lu <luangruo <at> yahoo.com> Cc: Eli Zaretskii <eliz <at> gnu.org>, 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Fri, 11 Apr 2025 18:41:08 +0530
[வெள்ளி ஏப்ரல் 11, 2025] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: >> The name and the doc string should be more specific to the file >> managers for which this is supposed to work. I doubt that these >> details are general enough to say that any file manager capable of >> copy/pasting files will behave like that. > >> Btw, isn't copy/paste of files similar or maybe even equivalent to >> drag-n-drop? If so, perhaps a better way would be to use the DND >> machinery we have in Emacs? Adding Po Lu in case he has opinions or >> comments about this. > > Regrettably not, since the formats concerned differ subtly and DND gives > a weight to negotiating actions on dropped data that is undue for a > simple copy/paste operation. The selection formats you must recognize > are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, > and FILE, which are NULL-separated lists of strings, and numerous ad hoc > formats defined by file managers and desktop environments. What's wrong with doing the following? (defun message--yank-media-copied-files-handler (_ data) "Attach files copied/cut from the file manager. DATA is a string where the first line is the operation to perform: copy or cut. Rest are file: links. The operation is always ignored, and the files are only attached." (let ((files (split-string data "[\0\n\r]" t))) (dnd-handle-multiple-urls (selected-window) (cdr files) (pcase (car files) (`"copy" 'copy) (`"cut" 'move) (_ 'private))))) It calls mml-dnd-attach-file in message-mode buffer. > If you like, you may implement a rough draft that functions > satisfactorily with whatever file managers you test, and I shall supply > its deficiencies as best I can. Considering that text/uri-list and friends seem to be considered in others part of the code, is there a function that would parse its format?
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Sat, 12 Apr 2025 01:30:02 GMT) Full text and rfc822 format available.Message #20 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Po Lu <luangruo <at> yahoo.com> To: Visuwesh <visuweshm <at> gmail.com> Cc: Eli Zaretskii <eliz <at> gnu.org>, 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Sat, 12 Apr 2025 09:28:57 +0800
Visuwesh <visuweshm <at> gmail.com> writes: > [வெள்ளி ஏப்ரல் 11, 2025] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: > >>> The name and the doc string should be more specific to the file >>> managers for which this is supposed to work. I doubt that these >>> details are general enough to say that any file manager capable of >>> copy/pasting files will behave like that. >> >>> Btw, isn't copy/paste of files similar or maybe even equivalent to >>> drag-n-drop? If so, perhaps a better way would be to use the DND >>> machinery we have in Emacs? Adding Po Lu in case he has opinions or >>> comments about this. >> >> Regrettably not, since the formats concerned differ subtly and DND gives >> a weight to negotiating actions on dropped data that is undue for a >> simple copy/paste operation. The selection formats you must recognize >> are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, >> and FILE, which are NULL-separated lists of strings, and numerous ad hoc >> formats defined by file managers and desktop environments. > > What's wrong with doing the following? > > (defun message--yank-media-copied-files-handler (_ data) > "Attach files copied/cut from the file manager. > DATA is a string where the first line is the operation to > perform: copy or cut. Rest are file: links. The operation is > always ignored, and the files are only attached." > (let ((files (split-string data "[\0\n\r]" t))) > (dnd-handle-multiple-urls (selected-window) > (cdr files) > (pcase (car files) > (`"copy" 'copy) > (`"cut" 'move) > (_ 'private))))) > > It calls mml-dnd-attach-file in message-mode buffer. It expects and respects options specific to drag and drop. `(car files)' is also certainly not guaranteed to designate the action to take. > Considering that text/uri-list and friends seem to be considered in > others part of the code, is there a function that would parse its > format? Not that I'm aware of.
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Sat, 26 Apr 2025 11:26:01 GMT) Full text and rfc822 format available.Message #23 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Visuwesh <visuweshm <at> gmail.com> Cc: luangruo <at> yahoo.com, 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Sat, 26 Apr 2025 14:25:39 +0300
Ping! How can we make progress with this issue? > From: Visuwesh <visuweshm <at> gmail.com> > Cc: Eli Zaretskii <eliz <at> gnu.org>, 77731 <at> debbugs.gnu.org > Date: Fri, 11 Apr 2025 18:41:08 +0530 > > [வெள்ளி ஏப்ரல் 11, 2025] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: > > >> The name and the doc string should be more specific to the file > >> managers for which this is supposed to work. I doubt that these > >> details are general enough to say that any file manager capable of > >> copy/pasting files will behave like that. > > > >> Btw, isn't copy/paste of files similar or maybe even equivalent to > >> drag-n-drop? If so, perhaps a better way would be to use the DND > >> machinery we have in Emacs? Adding Po Lu in case he has opinions or > >> comments about this. > > > > Regrettably not, since the formats concerned differ subtly and DND gives > > a weight to negotiating actions on dropped data that is undue for a > > simple copy/paste operation. The selection formats you must recognize > > are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, > > and FILE, which are NULL-separated lists of strings, and numerous ad hoc > > formats defined by file managers and desktop environments. > > What's wrong with doing the following? > > (defun message--yank-media-copied-files-handler (_ data) > "Attach files copied/cut from the file manager. > DATA is a string where the first line is the operation to > perform: copy or cut. Rest are file: links. The operation is > always ignored, and the files are only attached." > (let ((files (split-string data "[\0\n\r]" t))) > (dnd-handle-multiple-urls (selected-window) > (cdr files) > (pcase (car files) > (`"copy" 'copy) > (`"cut" 'move) > (_ 'private))))) > > It calls mml-dnd-attach-file in message-mode buffer. > > > If you like, you may implement a rough draft that functions > > satisfactorily with whatever file managers you test, and I shall supply > > its deficiencies as best I can. > > Considering that text/uri-list and friends seem to be considered in > others part of the code, is there a function that would parse its > format? >
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Sat, 10 May 2025 09:28:02 GMT) Full text and rfc822 format available.Message #26 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: visuweshm <at> gmail.com, luangruo <at> yahoo.com Cc: 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Sat, 10 May 2025 12:27:32 +0300
Ping! Ping! Would people please respond? > Cc: luangruo <at> yahoo.com, 77731 <at> debbugs.gnu.org > Date: Sat, 26 Apr 2025 14:25:39 +0300 > From: Eli Zaretskii <eliz <at> gnu.org> > > Ping! How can we make progress with this issue? > > > From: Visuwesh <visuweshm <at> gmail.com> > > Cc: Eli Zaretskii <eliz <at> gnu.org>, 77731 <at> debbugs.gnu.org > > Date: Fri, 11 Apr 2025 18:41:08 +0530 > > > > [வெள்ளி ஏப்ரல் 11, 2025] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: > > > > >> The name and the doc string should be more specific to the file > > >> managers for which this is supposed to work. I doubt that these > > >> details are general enough to say that any file manager capable of > > >> copy/pasting files will behave like that. > > > > > >> Btw, isn't copy/paste of files similar or maybe even equivalent to > > >> drag-n-drop? If so, perhaps a better way would be to use the DND > > >> machinery we have in Emacs? Adding Po Lu in case he has opinions or > > >> comments about this. > > > > > > Regrettably not, since the formats concerned differ subtly and DND gives > > > a weight to negotiating actions on dropped data that is undue for a > > > simple copy/paste operation. The selection formats you must recognize > > > are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, > > > and FILE, which are NULL-separated lists of strings, and numerous ad hoc > > > formats defined by file managers and desktop environments. > > > > What's wrong with doing the following? > > > > (defun message--yank-media-copied-files-handler (_ data) > > "Attach files copied/cut from the file manager. > > DATA is a string where the first line is the operation to > > perform: copy or cut. Rest are file: links. The operation is > > always ignored, and the files are only attached." > > (let ((files (split-string data "[\0\n\r]" t))) > > (dnd-handle-multiple-urls (selected-window) > > (cdr files) > > (pcase (car files) > > (`"copy" 'copy) > > (`"cut" 'move) > > (_ 'private))))) > > > > It calls mml-dnd-attach-file in message-mode buffer. > > > > > If you like, you may implement a rough draft that functions > > > satisfactorily with whatever file managers you test, and I shall supply > > > its deficiencies as best I can. > > > > Considering that text/uri-list and friends seem to be considered in > > others part of the code, is there a function that would parse its > > format? > > > > > >
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Sat, 10 May 2025 19:35:02 GMT) Full text and rfc822 format available.Message #29 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Visuwesh <visuweshm <at> gmail.com> To: Eli Zaretskii <eliz <at> gnu.org>, luangruo <at> yahoo.com Cc: 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Sun, 11 May 2025 01:03:53 +0530
I am quite confused as to what Po Lu wants me to do, TBH. I can start working on the patch again if I get an explanation of the work that needs to be done. On 10 May 2025 14:57:32 GMT+05:30, Eli Zaretskii <eliz <at> gnu.org> wrote: >Ping! Ping! Would people please respond? > >> Cc: luangruo <at> yahoo.com, 77731 <at> debbugs.gnu.org >> Date: Sat, 26 Apr 2025 14:25:39 +0300 >> From: Eli Zaretskii <eliz <at> gnu.org> >> >> Ping! How can we make progress with this issue? >> >> > From: Visuwesh <visuweshm <at> gmail.com> >> > Cc: Eli Zaretskii <eliz <at> gnu.org>, 77731 <at> debbugs.gnu.org >> > Date: Fri, 11 Apr 2025 18:41:08 +0530 >> > >> > [வெள்ளி ஏப்ரல் 11, 2025] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: >> > >> > >> The name and the doc string should be more specific to the file >> > >> managers for which this is supposed to work. I doubt that these >> > >> details are general enough to say that any file manager capable of >> > >> copy/pasting files will behave like that. >> > > >> > >> Btw, isn't copy/paste of files similar or maybe even equivalent to >> > >> drag-n-drop? If so, perhaps a better way would be to use the DND >> > >> machinery we have in Emacs? Adding Po Lu in case he has opinions or >> > >> comments about this. >> > > >> > > Regrettably not, since the formats concerned differ subtly and DND gives >> > > a weight to negotiating actions on dropped data that is undue for a >> > > simple copy/paste operation. The selection formats you must recognize >> > > are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, >> > > and FILE, which are NULL-separated lists of strings, and numerous ad hoc >> > > formats defined by file managers and desktop environments. >> > >> > What's wrong with doing the following? >> > >> > (defun message--yank-media-copied-files-handler (_ data) >> > "Attach files copied/cut from the file manager. >> > DATA is a string where the first line is the operation to >> > perform: copy or cut. Rest are file: links. The operation is >> > always ignored, and the files are only attached." >> > (let ((files (split-string data "[\0\n\r]" t))) >> > (dnd-handle-multiple-urls (selected-window) >> > (cdr files) >> > (pcase (car files) >> > (`"copy" 'copy) >> > (`"cut" 'move) >> > (_ 'private))))) >> > >> > It calls mml-dnd-attach-file in message-mode buffer. >> > >> > > If you like, you may implement a rough draft that functions >> > > satisfactorily with whatever file managers you test, and I shall supply >> > > its deficiencies as best I can. >> > >> > Considering that text/uri-list and friends seem to be considered in >> > others part of the code, is there a function that would parse its >> > format? >> > >> >> >> >>
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Sat, 24 May 2025 08:59:01 GMT) Full text and rfc822 format available.Message #32 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: luangruo <at> yahoo.com, Visuwesh <visuweshm <at> gmail.com> Cc: 77731 <at> debbugs.gnu.org Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Sat, 24 May 2025 11:58:09 +0300
Ping! Po Lu, could you please answer the questions from Visuwesh? > Date: Sun, 11 May 2025 01:03:53 +0530 > From: Visuwesh <visuweshm <at> gmail.com> > CC: 77731 <at> debbugs.gnu.org > > I am quite confused as to what Po Lu wants me to do, TBH. I can start working on the patch again if I get an explanation of the work that needs to be done. > > On 10 May 2025 14:57:32 GMT+05:30, Eli Zaretskii <eliz <at> gnu.org> wrote: > >Ping! Ping! Would people please respond? > > > >> Cc: luangruo <at> yahoo.com, 77731 <at> debbugs.gnu.org > >> Date: Sat, 26 Apr 2025 14:25:39 +0300 > >> From: Eli Zaretskii <eliz <at> gnu.org> > >> > >> Ping! How can we make progress with this issue? > >> > >> > From: Visuwesh <visuweshm <at> gmail.com> > >> > Cc: Eli Zaretskii <eliz <at> gnu.org>, 77731 <at> debbugs.gnu.org > >> > Date: Fri, 11 Apr 2025 18:41:08 +0530 > >> > > >> > [வெள்ளி ஏப்ரல் 11, 2025] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: > >> > > >> > >> The name and the doc string should be more specific to the file > >> > >> managers for which this is supposed to work. I doubt that these > >> > >> details are general enough to say that any file manager capable of > >> > >> copy/pasting files will behave like that. > >> > > > >> > >> Btw, isn't copy/paste of files similar or maybe even equivalent to > >> > >> drag-n-drop? If so, perhaps a better way would be to use the DND > >> > >> machinery we have in Emacs? Adding Po Lu in case he has opinions or > >> > >> comments about this. > >> > > > >> > > Regrettably not, since the formats concerned differ subtly and DND gives > >> > > a weight to negotiating actions on dropped data that is undue for a > >> > > simple copy/paste operation. The selection formats you must recognize > >> > > are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, > >> > > and FILE, which are NULL-separated lists of strings, and numerous ad hoc > >> > > formats defined by file managers and desktop environments. > >> > > >> > What's wrong with doing the following? > >> > > >> > (defun message--yank-media-copied-files-handler (_ data) > >> > "Attach files copied/cut from the file manager. > >> > DATA is a string where the first line is the operation to > >> > perform: copy or cut. Rest are file: links. The operation is > >> > always ignored, and the files are only attached." > >> > (let ((files (split-string data "[\0\n\r]" t))) > >> > (dnd-handle-multiple-urls (selected-window) > >> > (cdr files) > >> > (pcase (car files) > >> > (`"copy" 'copy) > >> > (`"cut" 'move) > >> > (_ 'private))))) > >> > > >> > It calls mml-dnd-attach-file in message-mode buffer. > >> > > >> > > If you like, you may implement a rough draft that functions > >> > > satisfactorily with whatever file managers you test, and I shall supply > >> > > its deficiencies as best I can. > >> > > >> > Considering that text/uri-list and friends seem to be considered in > >> > others part of the code, is there a function that would parse its > >> > format? > >> > > >> > >> > >> > >> >
bug-gnu-emacs <at> gnu.org
:bug#77731
; Package emacs
.
(Sat, 07 Jun 2025 08:20:01 GMT) Full text and rfc822 format available.Message #35 received at 77731 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: luangruo <at> yahoo.com Cc: 77731 <at> debbugs.gnu.org, visuweshm <at> gmail.com Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager Date: Sat, 07 Jun 2025 11:19:10 +0300
Ping! Ping! Po Lu, please respond. > Cc: 77731 <at> debbugs.gnu.org > Date: Sat, 24 May 2025 11:58:09 +0300 > From: Eli Zaretskii <eliz <at> gnu.org> > > Ping! Po Lu, could you please answer the questions from Visuwesh? > > > Date: Sun, 11 May 2025 01:03:53 +0530 > > From: Visuwesh <visuweshm <at> gmail.com> > > CC: 77731 <at> debbugs.gnu.org > > > > I am quite confused as to what Po Lu wants me to do, TBH. I can start working on the patch again if I get an explanation of the work that needs to be done. > > > > On 10 May 2025 14:57:32 GMT+05:30, Eli Zaretskii <eliz <at> gnu.org> wrote: > > >Ping! Ping! Would people please respond? > > > > > >> Cc: luangruo <at> yahoo.com, 77731 <at> debbugs.gnu.org > > >> Date: Sat, 26 Apr 2025 14:25:39 +0300 > > >> From: Eli Zaretskii <eliz <at> gnu.org> > > >> > > >> Ping! How can we make progress with this issue? > > >> > > >> > From: Visuwesh <visuweshm <at> gmail.com> > > >> > Cc: Eli Zaretskii <eliz <at> gnu.org>, 77731 <at> debbugs.gnu.org > > >> > Date: Fri, 11 Apr 2025 18:41:08 +0530 > > >> > > > >> > [வெள்ளி ஏப்ரல் 11, 2025] Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote: > > >> > > > >> > >> The name and the doc string should be more specific to the file > > >> > >> managers for which this is supposed to work. I doubt that these > > >> > >> details are general enough to say that any file manager capable of > > >> > >> copy/pasting files will behave like that. > > >> > > > > >> > >> Btw, isn't copy/paste of files similar or maybe even equivalent to > > >> > >> drag-n-drop? If so, perhaps a better way would be to use the DND > > >> > >> machinery we have in Emacs? Adding Po Lu in case he has opinions or > > >> > >> comments about this. > > >> > > > > >> > > Regrettably not, since the formats concerned differ subtly and DND gives > > >> > > a weight to negotiating actions on dropped data that is undue for a > > >> > > simple copy/paste operation. The selection formats you must recognize > > >> > > are `text/uri-list' (which is identical to its Xdnd variant), FILE_NAME, > > >> > > and FILE, which are NULL-separated lists of strings, and numerous ad hoc > > >> > > formats defined by file managers and desktop environments. > > >> > > > >> > What's wrong with doing the following? > > >> > > > >> > (defun message--yank-media-copied-files-handler (_ data) > > >> > "Attach files copied/cut from the file manager. > > >> > DATA is a string where the first line is the operation to > > >> > perform: copy or cut. Rest are file: links. The operation is > > >> > always ignored, and the files are only attached." > > >> > (let ((files (split-string data "[\0\n\r]" t))) > > >> > (dnd-handle-multiple-urls (selected-window) > > >> > (cdr files) > > >> > (pcase (car files) > > >> > (`"copy" 'copy) > > >> > (`"cut" 'move) > > >> > (_ 'private))))) > > >> > > > >> > It calls mml-dnd-attach-file in message-mode buffer. > > >> > > > >> > > If you like, you may implement a rough draft that functions > > >> > > satisfactorily with whatever file managers you test, and I shall supply > > >> > > its deficiencies as best I can. > > >> > > > >> > Considering that text/uri-list and friends seem to be considered in > > >> > others part of the code, is there a function that would parse its > > >> > format? > > >> > > > >> > > >> > > >> > > >> > > > > > >
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.