Received: (at 77731) by debbugs.gnu.org; 26 Apr 2025 11:25:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 26 07:25:50 2025 Received: from localhost ([127.0.0.1]:58763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u8dfK-0001GP-5D for submit <at> debbugs.gnu.org; Sat, 26 Apr 2025 07:25:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39630) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u8dfH-0001G4-C5 for 77731 <at> debbugs.gnu.org; Sat, 26 Apr 2025 07:25:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1u8dfC-0007R3-0G; Sat, 26 Apr 2025 07:25:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ELe8GL9ciIK0DF6Xzzb7gMRDcP0s2LgDJZbMllCyUug=; b=eqtsYjkYS2WMHA37qbYJ Jp9IRo5lj1baYBZ7l9OwhGVJaJrtbcz+MPv87Cu1ZerJ3YRT5bMOh58vZZynY8YB9yBXQKt/doWM+ 63Ov1wQGbIfoLMiCKkjOVK+TGsOHeEwFOIj9Y8ZAaiKf+PLAs62DVRR8BX89QlW2Heb3Dk1YxxF8l /UiDovWP7B6XxTzc0N9X+8xAX5lK5QjJ75qBanps8woFcQgXBFXSL94m3eermnYlSZgZXIFDspaun qPt+u8NcL21xiNgv/s2q9TrGqC8/kuzwGTtFSuBidTVemTRGX6kWQaVWO4mJnxBgI3z31/1ZTOTj/ W1MtqNuu3lRUrQ==; Date: Sat, 26 Apr 2025 14:25:39 +0300 Message-Id: <86frhvupu4.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Visuwesh <visuweshm@HIDDEN> In-Reply-To: <877c3q972r.fsf@HIDDEN> (message from Visuwesh on Fri, 11 Apr 2025 18:41:08 +0530) Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager References: <87y0w782tb.fsf@HIDDEN> <86zfgnnddx.fsf@HIDDEN> <87jz7qoq4a.fsf@HIDDEN> <877c3q972r.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77731 Cc: luangruo@HIDDEN, 77731 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Ping! How can we make progress with this issue? > From: Visuwesh <visuweshm@HIDDEN> > Cc: Eli Zaretskii <eliz@HIDDEN>, 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@HIDDEN
:bug#77731
; Package emacs
.
Full text available.Received: (at 77731) by debbugs.gnu.org; 12 Apr 2025 01:29:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 11 21:29:16 2025 Received: from localhost ([127.0.0.1]:52524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u3PgK-0002xd-0Y for submit <at> debbugs.gnu.org; Fri, 11 Apr 2025 21:29:16 -0400 Received: from sonic310-25.consmr.mail.ne1.yahoo.com ([66.163.186.206]:44921) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <luangruo@HIDDEN>) id 1u3PgH-0002xO-4k for 77731 <at> debbugs.gnu.org; Fri, 11 Apr 2025 21:29:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1744421346; bh=F5fwk8dwUB2YVsl0tk9UQEYi81L4lk9ihCn7qUa3ri0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=rAy/Kx9Nnl40InZ37LeSMJADSwrVETxXvGHTgIQFR7cBcRlYfRAem5e+chBT/IjBZpfT1ZfLEo4ObitPrG8HuIsBQZW+wnh0j6IRK4xcnLK3OHWFmkQD+gENh/M4p34C30ImfQHTCJzOixbCGOZ24Yy2yZREhTx+sFSYGM188xnM54CdG22scIZ3ZYvWVyxKBxGoAz0ih7LPr08sAU6ceHwIz/RUP3xvP+ugeK7f614+cl1Rj4R70/EzSIpm/Xj3eloicnTrWJ7HiSl0fIRafTNGO9MKJXxLJIWErqOvnBlyMdJR3Vw0ceosBps9gs8bTGSWZacgwI7y/usEDWTtiA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1744421346; bh=hdy9D2TxMUs/Okx8IYVhjDoRpKE9Ol4Qkylg21BIyAl=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=SreoMO/scQSHF0R2n4bVJJMdGqdrIAJlQ6Wb9mFYq0UJ7sLSA+SdtK5AAgpCbmhHZIw1Y16/3eEGntlvbRwA8U/4X6mZU87g0I1tH1/kpT+MsQNwd9aDTiJRENBFIwQoNfbgJtOylHkQymyk7JxY1EvLY1OEU+rxk5kdjcJOA6kZfNY/HGAkQUtXzsQcyaRSgRvOiQkJ6f4lr3Rl9TWPzOhU5VSBcutXIoSfzN/VS11FXiSfUpZg5hYPp80GlqUvuiI3gzaKZLAZwhvcyoIpTNkHN/6rVkjR02KadqBFQ11EN95x2tGRGgULSWqDgsBqqoIagHKYjvlBym0xuAIrcQ== X-YMail-OSG: RAvVIFwVM1kagcPINGjxf2q0fHSUtQo5naarLzZ4drr5orFPzqLHXTO0aLEmBXv g1itkrKtHIfbkWME2eow9n7WPmLYcpCd2eXr_yFKUml5Sh5giGL8Zl5fL_wvpXUqJWM_d0o_dI5Q VWNj58Jr3GfKC3qHahmSVw8I6I74Emhd7Uqt5SUnsjXhWOu72IA3WyJOzKUjmCmmM_qF.FuSO27f CKSHBXFS0qYJiy9c8AefMoUOLNeS7xIKUsomCDsx9p0F5Iy_6mQjG85uJoZRj.6ghEH4T.yji4Bb oCtSpg5p5iNfaD0_aLt6hjBAeVD7RC7Qxu4ylxaOBOvgyhG5wK3LvFt2Y34lwHdeBi498eOyPTuJ a5JdhB3.R9jDfT4Eog4iEfFfb_SsVcr5fbrO3NYTufnEiT6bdp4Ktx4yaX6N6LQLz50Ne0XkP2Il amnGtVU20jeDEqoit8nkb1VBZyNabgvh3S5SD2Qd8SU9c1Rfv.sVCJmpIm9j9ozh_D388fqXvc4v tYYo_p3i83ORfdnG0IXpeaRNDQBxvCRQSxrAYEv_4qyvXCLsWsKXDpev_Gf5B6MelBVwH_NAqiKl aK9e9wOZxA5xhkWDpBBOBUSEhYMZbIUKFyVFuAwyzeYqLv4BfzpwgLF5.Za3VrZTE.MJ1e7rooDb M6uo8NYRctTKHofXnZ4zNJBImZzT3kCOwvV3OuZuwrsUSiZq_BVb_u7hMHGGiiGGwTGepF0RPGJw El2zGsCyq_htdbaIF.5voFFcl2b.4_N9wn4jMlPpLMyHyDutYpOn9bphSiH8RyhILdLxh2PWCaQJ 3rG8FYKWBKTnmI_Jf3YfArzSRieqM7vRm_RNGSvoRJOsChMqVr9cInqmebwTwS3eS..FtnwlR7x_ yJZpSfzkoZRP1kzjCuZ08Ue_VMTzWO7VFwLANnUOTLEWLN93pCJtJkAlgkSsW4cAFbHuYzWE4aIm zA4pv23iSD0PRe.ewyyjT3DddwIAqZA4LUpji_hTsmlpENckvSmOI5cJpts9n0ZQee26DR4qXEn4 8T1maic69fY4d2WsxkpyWAwR3RNiHMPydBvkV9wKcmA1liKSIshLGJuOXrLckWD_Y.XSRQX_LPpg CPfR8HQbFD7jCPnpBbag0gS_0RSrI2zaJNLzzfPV1ESJ6HfEeqjr5vFtDQm8I1tSl9lpWNg7uymi _GWQ92jwVxGFJRy3qoSL_D37x_aQPmIdawScFWqGpQsgY3E6PbDHbKptLEo.Cf.3d4z4jBiGS5UD u19ShwdPye2M6jhABO8SOscYZMbgHhcRc49Yvnz0obh5wQzl2dhi8Of3vUHCkhi0r.7cPg8lQwZz FakUG1hZOQizePKn4V5DPjXZSSUTpKvGhGdxzFMUGEKvbQYs_rRv2t.fjRO0q0YW2qcdj73Ed55g C5oSWqhjVMphmhPLV7SGw36_erttujVE7pBDGSdNs6Ao0hFPvNPHzHFjLy3Wnk.t1TxVyLi2DriR s4n6aRaLAOIy1YRnsoOIUgmc1AKNqpD_LoyIfsOP_x0ejcorFn39d6xg.7gYJFUp3LEBw.f0KaJI kgQdd1.V6k.O9XawGAPvKkOqaBFUjtA0YJmud1PQ2aioTWVQkTqYumd_8tE3LCoJReVxLbHYNhu5 kcDCMJPQWuh6mTHVy_j7eGHbb2EGZaUyc9.G2d0ivoyxRlDgJ2RPZAQz5oGC4eCTieZ6J0NJPtlH bqrk0FoK1hMN6kC.QqnkXSIGExiQBP_wQ.HU6Y6phCiOlNvIzy3cFT0gI_qLqyUMJWz0bRjjOPNy dTZ6T.UoetNnfo1QeTvTTYZW3.NhZxrUGzD_ekCelFdl9DexXHrHli9CE2_cDQgcBB2vbxnaR3kq wdMjn0X1dtTEA.tULh5MIM1y.lSJvYIPHAqgKEOC.3KljlWDCeHzoKJVApvnTrEzIh4g3gpMitCZ BLoQWBPTMVoGOP1Da8Hi9CaQZz7w2kyYoh8GVGci7EJECbVzLbDPiplow4wWGsTU_memVp9Bn3DY 10oJ2y.qgpv3WTdi9XugyUi6GudDu3hSj6AP4mIpVsJHw1KcMN8Z3hr5OJYdq8gAvrszj2TcKWFk hyOiJUGOrvZ9MW0CNk.v8pc4GnN9u31U08ROsqR92MMeJETxekJsAwmOe_BRVjooAJonPAmZGAPC fkmP9ncP7K8Li8DJPOQ7ugc.4NGdRWG3lwj4cLM0hYpzRK9exZkkoazGt2oy8Sr6wTkVtZ8ureVI o4oLoLTqdkShCTLILhlIt2gV54IlMLTcnrixGFlKq5gQ5Pk4PHdnuEADuXw-- X-Sonic-MF: <luangruo@HIDDEN> X-Sonic-ID: 6c93203d-c232-44cd-a01d-a0d9f2489101 Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ne1.yahoo.com with HTTP; Sat, 12 Apr 2025 01:29:06 +0000 Received: by hermes--production-sg3-cdfd77c9c-fhv7l (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 6934edb365696c84e760453e6f13edb1; Sat, 12 Apr 2025 01:29:02 +0000 (UTC) From: Po Lu <luangruo@HIDDEN> To: Visuwesh <visuweshm@HIDDEN> Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager In-Reply-To: <877c3q972r.fsf@HIDDEN> References: <87y0w782tb.fsf@HIDDEN> <86zfgnnddx.fsf@HIDDEN> <87jz7qoq4a.fsf@HIDDEN> <877c3q972r.fsf@HIDDEN> Date: Sat, 12 Apr 2025 09:28:57 +0800 Message-ID: <87bjt2np5y.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.23665 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 2285 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77731 Cc: Eli Zaretskii <eliz@HIDDEN>, 77731 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Visuwesh <visuweshm@HIDDEN> writes: > [=E0=AE=B5=E0=AF=86=E0=AE=B3=E0=AF=8D=E0=AE=B3=E0=AE=BF =E0=AE=8F=E0=AE= =AA=E0=AF=8D=E0=AE=B0=E0=AE=B2=E0=AF=8D 11, 2025] Po Lu via "Bug reports fo= r 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@HIDDEN
:bug#77731
; Package emacs
.
Full text available.Received: (at 77731) by debbugs.gnu.org; 11 Apr 2025 13:11:27 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 11 09:11:27 2025 Received: from localhost ([127.0.0.1]:49515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u3EAI-0004hn-QJ for submit <at> debbugs.gnu.org; Fri, 11 Apr 2025 09:11:27 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:50320) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <visuweshm@HIDDEN>) id 1u3EAC-0004gc-Gs for 77731 <at> debbugs.gnu.org; Fri, 11 Apr 2025 09:11:21 -0400 Received: by mail-pg1-x542.google.com with SMTP id 41be03b00d2f7-b03bc416962so1377658a12.0 for <77731 <at> debbugs.gnu.org>; Fri, 11 Apr 2025 06:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744377074; x=1744981874; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lFsejTA8/bCzYnW3xArA71bFbJJ8gBRZsWAlLHMOOlo=; b=Hu8grcqDPMFgGDJ2Dh5QPra2i2wf/LOcGbN90yS6n/WOKK3Qt3AD03E4vB9Tm378uI KwLdF/b5yRD3LzT0lzYSh2L1CgH9hbFbnoX1mKj6oVKQl9NE6XT8PSBTR8eqlz2Es/Xo 9sIupFjfaXinxi2ZxYsdZqY6G//HWZuFXxf/7RQzDIP6/D/QRiYezr9V52/vKW62FUgk AxgcIO28TtMmS5/TvRUmE5Z6dRW1/4fvJocPpZaLkvQZk408RrZb7L4PYQqWQgfivebe Uu8rFKHtpsFWfX4Q44+0IUfH4qoWazPATewrZ9nGRh+86taFZ2HnoWOOj1YiB2Tf2Hfj ghxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744377074; x=1744981874; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lFsejTA8/bCzYnW3xArA71bFbJJ8gBRZsWAlLHMOOlo=; b=Zrd4N4AdxENyZWFIfiK37/vYso9UewFdF/fNirTz7uksbNi47Dti6lNpq5kDkOMlJy t6MVHVA1YTInZZ8kIvZADrKYk2bNWR6tc4vYOEtY5JcpoGm76TZccBOKKvdBVEGie7Op VNJeBCOE0GNBuiW8G8+PKMGcQqs1XlIRnPwbr5K5ZxTXy8liHMHU22E+gdDBwiu3Mzgc norM4FTbV92dcbuP+vWAnpf2zNSr9GcfftICzw5FXaXGhFh2Fb928v+/4qL2i1AOEJSV B53ypZAO7mTRX8xuQ7XOK94QT/CkAYEh0hU5XBphCNZlzxSGJCylN0MgWTE6AKrCKWNp 4mLQ== X-Forwarded-Encrypted: i=1; AJvYcCWTEIYn7hSalimuE9s/vC8mM5Coh0MnrI1BpfFpBv9HXSfeNttRcuszhiCa8OLHjYxZ24eyTw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzWeGXgxnamRU4yGAvK3PTK+h/gdyI1MC3Aw4sBjATXJrvNlf0y vyhqnTK9ZzCyva5IWlV6q3txBDYSFdY4SbNUn+dQHQrxCa5+H9Ln X-Gm-Gg: ASbGncsUZ3Pxh0PutuQC9T10C6HsVLx45Y7K3M8WWLRHj7hB0jobc7Q04yq9FlCSG6w rF687sweeaBBurQO3BHM8e3SfEr92ovmj3TQABchY5G0TioRHDxapcSEnUtWOQVVpUWJDzcIxBA /9Hz/2HpOcybHPJgpdinYJvBzKTfsG0QD0euuZAfObH9jUejbfHD4pjiaICPi7myDE4dhWDAaUk cT3FK8O4x3b4SZsuD8emIPaUL8kF+um+Zo10nAmmlF8i4EyAnmsRRybqq39CgglMgOnw9F9VaVP /te3/tPoT3ppEekfNthlVrrLjTAKAELIfyDrdiyoqg== X-Google-Smtp-Source: AGHT+IGeJ27S7Hcn9deiPKiz75g8jajERKUH9jDIavUxNOhZEB/IFaP7xJOchHtplmCJrwEZJs/LJA== X-Received: by 2002:a17:90b:5687:b0:2f1:3355:4a8f with SMTP id 98e67ed59e1d1-3082365a323mr4572903a91.4.1744377073701; Fri, 11 Apr 2025 06:11:13 -0700 (PDT) Received: from localhost ([1.7.159.71]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-306dd568a6asm2769776a91.1.2025.04.11.06.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 06:11:13 -0700 (PDT) From: Visuwesh <visuweshm@HIDDEN> To: Po Lu <luangruo@HIDDEN> Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager In-Reply-To: <87jz7qoq4a.fsf@HIDDEN> References: <87y0w782tb.fsf@HIDDEN> <86zfgnnddx.fsf@HIDDEN> <87jz7qoq4a.fsf@HIDDEN> Date: Fri, 11 Apr 2025 18:41:08 +0530 Message-ID: <877c3q972r.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: [வெள்ளி ஏப்ரல் 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 [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [1.7.159.71 listed in zen.spamhaus.org] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (visuweshm[at]gmail.com) X-Debbugs-Envelope-To: 77731 Cc: Eli Zaretskii <eliz@HIDDEN>, 77731 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: [வெள்ளி ஏப்ரல் 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 [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [1.7.159.71 listed in zen.spamhaus.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (visuweshm[at]gmail.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager [=E0=AE=B5=E0=AF=86=E0=AE=B3=E0=AF=8D=E0=AE=B3=E0=AE=BF =E0=AE=8F=E0=AE=AA= =E0=AF=8D=E0=AE=B0=E0=AE=B2=E0=AF=8D 11, 2025] Po Lu via "Bug reports for G= NU 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@HIDDEN
:bug#77731
; Package emacs
.
Full text available.Received: (at 77731) by debbugs.gnu.org; 11 Apr 2025 12:11:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 11 08:11:04 2025 Received: from localhost ([127.0.0.1]:49285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u3DDs-0008QT-6K for submit <at> debbugs.gnu.org; Fri, 11 Apr 2025 08:11:04 -0400 Received: from sonic312-23.consmr.mail.ne1.yahoo.com ([66.163.191.204]:41619) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <luangruo@HIDDEN>) id 1u3DDp-0008Pw-Je for 77731 <at> debbugs.gnu.org; Fri, 11 Apr 2025 08:11:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1744373455; bh=04Lk8XgHv/oeMiSEKniWy+6YWcrKpHK3gzPB39Q9Ll8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=czMiUXAPYuyl9dFXE2MuLjbQXIuy3bGARVzAam2SXmGJKQb/yPR/Sb4H7bmJnaPvgxVJLWcJBtTGrLl0s58D0Y6hnAZHAxH1lykxBbgPRuBmK4H5hNbBubnjgX+BVWyiHoBnHsVM6XkhQgGK9APmfZ/+x4zYMUgO9s+sFCqg8htWc4d6oqepsdaBNezYAMYr/uN/HviZ2VUZqpWrVWIfR4TNB1kgbJ1OAs7R1a1XMK1WMdzkno9+DqNdBtah+4P+JPs0soArRXxPL8eHGKGBkIzcrIqc9Danu1CSZsrha86l2mPr2VfAKGcUD+xj1Up+/V53MX7gX1xn5Wickf9lug== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1744373455; bh=0IpjBmMVwNTwhv8jBoAiPNjwErZpvePsXz0uyeSdWxI=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=T6MHGi9ePHcGUtBXszX0MDjbMTmgbU2vzqL111vrkJKzKjD+NQDxQyiP5+g4ngetYWIEJbON1K7Cz+CN+syOqVUnm5rYG5r9C3Iv92qZytG9ZCul3Y0iuN4v90ngedVD8C/ohdJLa35t/ThzcRRs5lMGnxjiZ9HE8ERzSG25gPTrcowX3LnKB5QzQh37Jzn73JmYR7/a8b/mPgov1afGBgabPdtyVFWh/lP1DcEeHT6nR1K4tNy1KauFXbty/E0BcaTEoiKSkqHxPrAd3aUwgtTLkKZp+283UV5XfuBgHezHGuB0+w+ufDSlSWsHH2O5QYkmt72llUjsFp7KBT9x5w== X-YMail-OSG: 4.Ew60kVM1km9thavq.jQ2K931w6mRx5xAivxNuuAEGj9iF6MXnMTHSdQ0WU4nt DKouKuKGyaTdvCdDgZdqdRLVUBGrRCMszN3ex5tCSgMmDf.MQHw8ayXfjJucZarJNwEhH56WiX1S qWfaXlKRmmGiJJUbCzU6Kaa.f7_LvW9Sef8A124lcwCsP0qlYdF9wEGClvi82UAr8VcWyii2C1eq 4OaADmTpVUPololhiywZXwC17ewalVKe9GVVZnkaWxEdxnyIWvOKjTE08BfuC2dO0QFbDCFveERO xsyJX6T_8hxtwQE7pmPHE157YTOV4QHn5I0scNMa7PWZnSDOz3e6aNHjCOg9EkWo9r82vr7lHJqQ M5yJDgV5aeHPVQ6H.0NKBJPTeidmwMP3P4fQ0_jV7vMDu0AqfiP2iSavFihOdLziDDFKZ9L3bZ6i oMW.vWO_QxPwzCBitO_xhm47hiU6jwFDXNgknFTyDdyrXYXKpluuj711C.6P5Yjg6kugxOH6LnhD 7Aj7ux8NBpDEUP8ySsacMK0kisXJDf0ILip1U4GYB25gLbYCTAbj4x5JP7Ik617tz9Az9n0EgNXQ DmJi68KaU3ra9bWCS6QV85XODeubZFjMOZK02bDtkR.set14sqPfspL2E0OJ30jvfrXJsYyJ9EOB yc_lBgto8ZoVi5Jy_.v_BSWECbNj13uv5wLVf6eQrsFk.SgMYgjTeQlnbJ2pqrEEEWXJkRuawf3k MXu0FELY07BZxwx9qoWLYHSI6_tuMybhRZ5PUfJGs9V8C87kCpe40TTeQtxCp_W6696DeUBq_ypp T86DPxM49GJnZUJNiPhT2Ne.FXTXltdfPBw5qw.7K6rT0EpFvqBpyBGrFlQ2.t_YM6V0Gg4Cfuou Q7vSyzUko44fhkGzUygZvxVUEykx0D_nDxPd.b6RRoMdZQesh1i9FxVwuLoMSPEPspea4EAl6ukH hxS.bwJOG4lrMYp32ESGyW3swBvkZcIQkVyYA9lOhutLVsJ0vfxdXXF6pjj.YAWAu33Aco7R6lUz wZejJ9QbaNmQ3nMc61nm9HajuHYSsjnW6EeKrq6xnaV.gB1K4.oq7w__7xy3.KTSKqPGUedqnNve Xe8tinPzjqnBIWFfkc.WzMOH8vP_Y_4U3XpzPUQbnkIAXWE2yYgriEA1Sgo.WjHKsmKEJmCEjHiZ pfh9do2r5PP8LzD26HwIRb3T5o7AhYNfzAptuPk97J63lxDY9CQWcUBUKZxKjjRnywDYPzQpWo7Q E9P7nRF7Brwqha8C6NEzA4W.PD6ntmQm6lRawla6lofAJCUSTxZcbme4NGXCwYw5q1ftFWWkqTza La828cwfvrk6itGmDn2IcdXmyrc3eu8hVE6KDAjFsXs_iQqcvbppHNllbi2WIcYl_WTu5nZH2Ond Fk_ASuYD5TUNy83.0zUVCJPpo9ovObSk9DlEluT3rq1_sy0.WC1kASl_0Fo1ZqHl3rM3ITT2krms nVnnnA3NNXoUhOtKeG_KEjO2gNQ3tLsmBuivU0wdDNxBgz8UWNV4nvLFzXCMsFUgzgRBfM1pAqmQ 6j94uZfemZrqpa31d7emfEyrymNwTI_ToKYK77VrAC17ZdRb1ak0VD4zKa_p2w9E9.X4MoL6Bw8K DRnUtuPIMl37Xtej_zGh5vOdO3aed0MiZ4fR8ES6T1GaxhrsFwI2N0guXeEQSvmEiDQbFvOsP5a4 ToX2yN_WiZsCLDxeMLxwIglsOpbhMkoQBDsR3kJR6UKttHJpzzKIKpG2wNWu92l7JO0IAXnEWXDZ q7rAJdtKulywLj2TLN7Pa5Z2zb8s4E6l1DvJPk5YJY8BmRlLorLVaeznufZQFmZnIND.RoVXRsIX USdbYqtdVsx9jQR0EQ06.ybvdqbmSnvkwDfHNKeWJMpDLBo15i3yXZEtkunLVuvLjp4SwQ7oHaF8 gyP9f.KoBtgTa.SmvS6kJsU8PKqkli97Dir.Q3P.JChzExAnSR4R8LXy0PlEKSikaFJkHJySslWd Gxd1GYYsdPpk8pPzkOtx_8JHCi.79pUSdFBAI53nFNtMSMvwJCr4sze6Ck_Wzk9o110WAi_r_E05 fV2AIuh3qK7djJm74nu3.esnAVd4G8MklPuvaRcOvwP6VRb5vA39wSDD9Zvp59.fi39epaGXHn8g P2lpq5b7DLMetNwSVA0gofT36NAMjDafRNPi6zDR_wEPZ7ZOkAGAP4.9UFjsOVSAkc_GDLUptR0r KVqgizxQnDYs6MxNIgN6fs_yw7olzPqFjkADCzh8N1XGwdvsUcIjg.6pv2ss- X-Sonic-MF: <luangruo@HIDDEN> X-Sonic-ID: 78efac5a-c0e2-4df7-9974-504972e3ee9a Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Fri, 11 Apr 2025 12:10:55 +0000 Received: by hermes--production-sg3-78967b78f8-f6v55 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 36527c524509f0bf887d3c47a3b04ec4; Fri, 11 Apr 2025 12:10:50 +0000 (UTC) From: Po Lu <luangruo@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager In-Reply-To: <86zfgnnddx.fsf@HIDDEN> References: <87y0w782tb.fsf@HIDDEN> <86zfgnnddx.fsf@HIDDEN> Date: Fri, 11 Apr 2025 20:10:45 +0800 Message-ID: <87jz7qoq4a.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23665 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 2754 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77731 Cc: 77731 <at> debbugs.gnu.org, Visuwesh <visuweshm@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Visuwesh <visuweshm@HIDDEN> >> 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@HIDDEN
:bug#77731
; Package emacs
.
Full text available.Received: (at 77731) by debbugs.gnu.org; 11 Apr 2025 11:44:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 11 07:44:50 2025 Received: from localhost ([127.0.0.1]:49195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u3CoU-0006xJ-EP for submit <at> debbugs.gnu.org; Fri, 11 Apr 2025 07:44:50 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:56492) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <visuweshm@HIDDEN>) id 1u3CoR-0006wz-LL for 77731 <at> debbugs.gnu.org; Fri, 11 Apr 2025 07:44:48 -0400 Received: by mail-pf1-x441.google.com with SMTP id d2e1a72fcca58-736c062b1f5so1541799b3a.0 for <77731 <at> debbugs.gnu.org>; Fri, 11 Apr 2025 04:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744371881; x=1744976681; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fAUBp7G4s+J0dZVR/N9IPg1/oIIiRnPc/bDtefdnRKc=; b=Knhy8ugmZAjYcWqKFoWjBpiep3bqOO59HchBSYteIHmuz8xDdHhR9Pben1ssfR37zy WvW58Q5FnN1gTMh05woLIFhOkbgvkmqbJAr3OcNgg4yR1+Kq2ZCQuOCwwyS4mE0NPKMd 5In62D18jCYOs+urcON1pIGXC4z/XkMQcUrDmc0xkHKPfo4RteLer1b7mCiEyNENpJ73 05y5V68v4ocI+0bUGex073N54r1jnnp80DjsZw2ObuRuog9khcr1muXlDBRIeeZI8vqm i7tSwXyJd++T2AJvHP5cihYaxNKdONaMEZdnRZtV79+a2eAorePd69ie4qt8Fi6B9aq3 cFWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744371881; x=1744976681; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=fAUBp7G4s+J0dZVR/N9IPg1/oIIiRnPc/bDtefdnRKc=; b=LCYP3tbaRuPToPitb1twNJlR3z7Lpvgp99j/aZmGLCwwjGQPlfqipKNPF9n+yph9A3 KWibDN0GlrdRxmCQHAx9DTa0QKCPc/mMjeErr8cdkV4lOK43CBf1an3vpdgQqMZ+M/gr azS/5fXRUHIsO4KBl3+d2pMP1paSqAGHFAwrgbS28XPsxQNdGPYn2aahkP33t7Mdt84D HVDMdiu5jYsfJ0BvkdTBOxISPEnsrrk9IXfEnuRiCL9GNjQbWh2JW2oCcr79LIX2/ogH rWmKuKonM+JjMHGa7j5vTJJGPbzfenBplSkrQNq7FKpR8dfPJGBH1DCHB4Vr9KlaYnxT VvuA== X-Forwarded-Encrypted: i=1; AJvYcCUVjSkGfcxsCkzhQ00SPEuFdXIBitYMl0L2XO8N+oXLMLKfEjsh7nS7OaKTG7I2m7EWnPTWXg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxzZcl0uKnwVPrr43HmM+znWJSko946UxiprRXDbRQ3DPOy6SG/ ADCXQi71mgPnc4dLLUsK0XkrXlV06pO9vV3FZw+O4+2MeL5jnyBY X-Gm-Gg: ASbGncv6/RNcBt3qhV6Syx4iX8KysxeZQnceaBQt5tYnbUZAql7R/i93Z/VXAZ9eFbh WgQrPcsV0+ePmD66yh/6kWrd4G/1UXg9ti9FBKO9LZslxOCfvQebKpgcvACr6jLJgqdaSNYyPGK 8yG7otl5pe40ulR2Neqh/8qVSDUR4pDyE/BSjAzvstSe84iSN2/ZCYQzQi5W+P73qltuvqjQ414 DAu4H3IrhOMps8i1CWxN+gmH3JxD60nSE065PivWqzWCX2ID8L69wD9YMDDp2QL9ITSZ/KE/eAj 7Mg02aH4EYZNV93mohRVd4myZzzfWKItPeCb7kZ24g== X-Google-Smtp-Source: AGHT+IHRLTABvagA1hxj9V+YcmOM2CUqMA6P9C1uHNfD8BkPaqTF3evBoLe5JetfabCVXEBlzot9EA== X-Received: by 2002:a05:6a00:3901:b0:736:4d44:8b77 with SMTP id d2e1a72fcca58-73bd11e210emr4217366b3a.8.1744371881174; Fri, 11 Apr 2025 04:44:41 -0700 (PDT) Received: from localhost ([1.7.159.71]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-73bd230dd00sm1259182b3a.126.2025.04.11.04.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 04:44:40 -0700 (PDT) From: Visuwesh <visuweshm@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager In-Reply-To: <86zfgnnddx.fsf@HIDDEN> References: <87y0w782tb.fsf@HIDDEN> <86zfgnnddx.fsf@HIDDEN> Date: Fri, 11 Apr 2025 17:14:36 +0530 Message-ID: <87lds69b2z.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: [வெள்ளி ஏப்ரல் 11, 2025] Eli Zaretskii wrote: >> From: Visuwesh >> 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 [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [1.7.159.71 listed in zen.spamhaus.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (visuweshm[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] X-Debbugs-Envelope-To: 77731 Cc: Po Lu <luangruo@HIDDEN>, 77731 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: [வெள்ளி ஏப்ரல் 11, 2025] Eli Zaretskii wrote: >> From: Visuwesh >> 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 [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [1.7.159.71 listed in zen.spamhaus.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (visuweshm[at]gmail.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager [=E0=AE=B5=E0=AF=86=E0=AE=B3=E0=AF=8D=E0=AE=B3=E0=AE=BF =E0=AE=8F=E0=AE=AA= =E0=AF=8D=E0=AE=B0=E0=AE=B2=E0=AF=8D 11, 2025] Eli Zaretskii wrote: >> From: Visuwesh <visuweshm@HIDDEN> >> Date: Fri, 11 Apr 2025 14:58:32 +0530 >>=20 >> [ This has been sitting in my drafts folder for many months now. ] >>=20 >> 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. >>=20 >> I also cannot find the spec of this clipboard type but [2] and pcmanfm >> suggests that the selection is >>=20 >> OPERATION >> file://FILE1 >> file://FILE2... >>=20 >> 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. >>=20 >> 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@HIDDEN
:bug#77731
; Package emacs
.
Full text available.Received: (at 77731) by debbugs.gnu.org; 11 Apr 2025 11:31:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 11 07:31:20 2025 Received: from localhost ([127.0.0.1]:49068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u3CbQ-0006EU-0V for submit <at> debbugs.gnu.org; Fri, 11 Apr 2025 07:31:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34976) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u3CbM-00060R-BV for 77731 <at> debbugs.gnu.org; Fri, 11 Apr 2025 07:31:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1u3CbG-0006zO-Ua; Fri, 11 Apr 2025 07:31:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Z2OQBfC3gyUQReVY/L1+kEXA4zfuiDn9VbJkmDXQ5eo=; b=lm4RQpWRtczF ioHVXGrOJJKS18eIOMvx+AzwDQMOVe1zjqtb3jfUTRJj/AKIsC5wj5Ulg59WLVxNWnMjPc4jLS1Bc AG5qbLrNngV3v2LmGDWeMNPOxEXCMqLh7AItb7AvGcszJs0dZeug/bYEiFc4Rn4rl9v9tAbiK5uru RYICiZyVmGYdnzp2Scbu0Xx040ofIA1Rb+JMJq/9j+jKxf+vbInN/IJ0AHpFUL1watA/nR9NoutrN Q6MLhYtukaFbkgV56gG6ADicPuCzXvCXue8WrqnpHy4n0wbIBsaFiY0G6v2xwBIdXQLPiVsx81C0Z PHFS+0UMEHmOhlP38CMoWQ==; Date: Fri, 11 Apr 2025 14:31:06 +0300 Message-Id: <86zfgnnddx.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Visuwesh <visuweshm@HIDDEN>, Po Lu <luangruo@HIDDEN> In-Reply-To: <87y0w782tb.fsf@HIDDEN> (message from Visuwesh on Fri, 11 Apr 2025 14:58:32 +0530) Subject: Re: bug#77731: [PATCH] Add yank-media-handler for copied files from file manager References: <87y0w782tb.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77731 Cc: 77731 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Visuwesh <visuweshm@HIDDEN> > 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@HIDDEN
:bug#77731
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 11 Apr 2025 09:28:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 11 05:28:51 2025 Received: from localhost ([127.0.0.1]:48750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1u3Ags-0005BG-Rp for submit <at> debbugs.gnu.org; Fri, 11 Apr 2025 05:28:51 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47656) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <visuweshm@HIDDEN>) id 1u3Agq-0005B0-Oi for submit <at> debbugs.gnu.org; Fri, 11 Apr 2025 05:28:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <visuweshm@HIDDEN>) id 1u3Agj-0002iH-93 for bug-gnu-emacs@HIDDEN; Fri, 11 Apr 2025 05:28:41 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <visuweshm@HIDDEN>) id 1u3Agh-0006tc-7M for bug-gnu-emacs@HIDDEN; Fri, 11 Apr 2025 05:28:41 -0400 Received: by mail-pl1-x642.google.com with SMTP id d9443c01a7336-224019ad9edso23553225ad.1 for <bug-gnu-emacs@HIDDEN>; Fri, 11 Apr 2025 02:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744363717; x=1744968517; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=28Nk2z49u7efGo7j7Rj+bxZMzvyHd1v2e4SP27dEryQ=; b=K+bQtQstyPJ1oZihKgHFWaRvwRM8P3g9b0SdfPOYiGayrXC0FVAwYW6psGXsJrQca+ C0qaOFYZzcrrHwasQDjTKTGpmnd7T5operrWr0vZb8FAAbN8VjS3UcB14ocRi5URvo8P V2jP6whw8QcwO3KaUkcRwmBDhVbA2xNOYYpUktceA3XQ8DS7rwgZ2/LIfCCwjPqXwdp/ rqbqqFpv95SgG3s9yTqrb0uztiw6ttUfPMV9G1LCmyDUQ13NPtzcum1ukDPaazc8nh5c 2QfZATNb37oeU6/59dLL9fyza5j3t8j0WupWUgIeMUEfQJk95gTKqeECuRLXpYB7u6WS zSkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744363717; x=1744968517; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=28Nk2z49u7efGo7j7Rj+bxZMzvyHd1v2e4SP27dEryQ=; b=R7QOwDyKBxaIEREp8ld5+zkRBmB5F6gZ38KKENvKNkzklD4DeCZE+D6eJGZ+1Zr1DR S0DjCwuTSH8AMV6P78M98WnUWD04IieJpLDHC/d09VnZcLktCTqX6cqM/2f5cre4q1DU 70QJGmTv6O7RjEMweWeZzz/dmvkwsHWeOxz6aOdySamfGfXy+NQaSEa5pE9PfXwPhsJh EUh84KzYFJwC0EyOLsUKm8vmn5jhKhewRLfHS/9VoVMXW/5+Z4KadF555RAr5szh8Vbj He1I/chXwRFW72RNujyH4dvT5hywkJ9XDMlCrd51GFRaF/llX4btIk4tnwdGtBcAbSl5 xrlQ== X-Gm-Message-State: AOJu0YypmnRVfdALQPiD/q/6u2ZhwkSYuXtltogdFoGwjnkaga1CnM1F z6TaxbjNEhb9PbnWL+cEYLgWUsrBq7JWEWcUsmtYOOCFuUx+SPhyUnFghH+V X-Gm-Gg: ASbGncuuzNG1AiYe9954I6c+FWp9CRIqywulTn0GKEGqZieE7aPfgOGAkId4A7HVeTe zdGyGNd69waXpUIHc7+n9cR77OhiKcJLFdrJ0T15CdA+ZDS8zzbQ0GtEwDkY1A2acUMeDft6TQu fz/rmOrYW1ZHFyl6LCSVb0oQXKy16msIjIW2B1QQ6J4hcK7l7u/d8KJAHrLX6jee0To3vV9DROf OpGVhNmRnBCTheQTpUoT+Bo4tSLKh+GdaRnrL75amnahM/6fQx7szacZPxkE9OfnpK3wLY2xwBk NUCYCwLljIexribc0KaINxGX+lr6Muc0AE/9bljqpTy+daaU X-Google-Smtp-Source: AGHT+IF8OMRcKG0Q6a4J+YG/cMqy13K/8mMKjlbPgJvyII/bBXz61Kdm+KEY+tgBJ2duAGxQemiD0A== X-Received: by 2002:a17:903:1b2f:b0:215:a179:14ca with SMTP id d9443c01a7336-22bea49529cmr31989115ad.2.1744363716660; Fri, 11 Apr 2025 02:28:36 -0700 (PDT) Received: from localhost ([115.240.90.130]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-73bd21c33bfsm1024836b3a.42.2025.04.11.02.28.35 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 02:28:35 -0700 (PDT) From: Visuwesh <visuweshm@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] Add yank-media-handler for copied files from file manager Date: Fri, 11 Apr 2025 14:58:32 +0530 Message-ID: <87y0w782tb.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::642; envelope-from=visuweshm@HIDDEN; helo=mail-pl1-x642.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain [ 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-yank-media-handler-for-copied-files-from-file-ma.patch From 09d24c4f5aca0c618a23e680b4a0cb77ad690236 Mon Sep 17 00:00:00 2001 From: Visuwesh <visuweshm@HIDDEN> Date: Fri, 11 Apr 2025 14:55:29 +0530 Subject: [PATCH] Add yank-media-handler for copied files from file manager * lisp/gnus/message.el (message--yank-media-copied-files-handler): Add yank-media handler to attach files copied/cut files from file manager. (message-mode): Register the handler. * etc/NEWS: Announce the change. --- etc/NEWS | 4 ++++ lisp/gnus/message.el | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 0ff3e8184ee..db5c20589bf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -776,6 +776,10 @@ default, can be set to a non-nil value to restore the previous behavior. It is believed to no longer be useful as a method to fight spam. The 'message-generate-hashcash' option is now obsolete and has no effect. +*** Files copied from file managers can be attached using 'yank-media'. +Pasting files copied from file managers using the 'yank-media' now +attaches those files. + ** Gnus --- diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index a7f27fe1021..d000fcbe720 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3201,6 +3201,8 @@ message-mode (setq-local message-mime-part 0) (message-setup-fill-variables) (yank-media-handler "image/.*" #'message--yank-media-image-handler) + (yank-media-handler "x-special/\\(KDE\|gnome\|mate\\)-copied-files" + #'message--yank-media-copied-files-handler) (when message-fill-column (setq fill-column message-fill-column) (turn-on-auto-fill)) @@ -8944,6 +8946,15 @@ message--yank-media-image-handler nil nil t) (insert "\n\n")) +(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 (cdr (split-string data "[\0\n\r]" t "^file://")))) + (dolist (f files) + (mml-attach-file f (or (mm-default-file-type f) "application/octet-stream"))))) + (defun message--image-part-string (type image) (format "<#part type=\"%s\" disposition=inline data-encoding=base64 raw=t>\n%s\n<#/part>" type -- 2.47.2 --=-=-=--
Visuwesh <visuweshm@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#77731
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.