From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Friendlier dired experience [CODE INCLUDED] Date: Thu, 05 Nov 2020 15:31:30 +0200 Message-ID: <83blgcaq19.fsf@gnu.org> References: <20201103104340.q34kqfita55w2u7h@E15-2016.optimum.net> <20201103171627.f33ud4xkwv6rqvcq@E15-2016.optimum.net> <87y2jifhjq.fsf@gmx.de> <20201103191043.42sdslilcmb47jg5@E15-2016.optimum.net> <87pn4sgaiy.fsf@gmx.de> <20201105085440.glvl6tzfnbtfssy5@E15-2016.optimum.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38311"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael.albinus@gmx.de, stefankangas@gmail.com, bugs@gnu.support, emacs-devel@gnu.org To: Boruch Baum Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 05 14:32:31 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kafNO-0009ra-JM for ged-emacs-devel@m.gmane-mx.org; Thu, 05 Nov 2020 14:32:30 +0100 Original-Received: from localhost ([::1]:44974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kafNN-0007Go-MI for ged-emacs-devel@m.gmane-mx.org; Thu, 05 Nov 2020 08:32:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kafMZ-0006pM-06 for emacs-devel@gnu.org; Thu, 05 Nov 2020 08:31:39 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:56607) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kafMX-0000qq-NW; Thu, 05 Nov 2020 08:31:37 -0500 Original-Received: from [176.228.60.248] (port=1463 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kafMT-00024W-J8; Thu, 05 Nov 2020 08:31:35 -0500 In-Reply-To: <20201105085440.glvl6tzfnbtfssy5@E15-2016.optimum.net> (message from Boruch Baum on Thu, 5 Nov 2020 03:54:40 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:258717 Archived-At: > Date: Thu, 5 Nov 2020 03:54:40 -0500 > From: Boruch Baum > Cc: Stefan Kangas , Jean Louis , > Emacs-Devel List > > > I believe you must unhexlify the path in the .trashinfo. This is not > > only because of Tramp. A local file "/tmp/file with space", trashed via > > "M-x move-file-to-trash", has the entry > > > > Path=/tmp/file%20with%20space > > > > Calling "M-x diredc-trash-restore" restores it to "/tmp/file%20with%20space". > > I was surprised that this turned out so difficult for me to do. The very > simple case for 8-bit ascii was easily handled by unhexlifying, but that > simple case got me thinking about unicode file names. Sure enough, the > trash meta-data for such file names are also hex encoded, but the > standard elisp commands I could find wouldn't handle them. Have I > overlooked something? The following code snippet performs two alternate > techniques (url-unhex-string, stolen-from-emacs-w3m-url-decode-string) > first for a simple case of a file name with an embedded space, and then > on a unicode file name. Only the function shamelessly stolen from the > emacs-w3m package worked for both cases. Tell me I've overlooked > something, please. I'm not sure I understand exactly what you are trying to do, so what I suggest below may not make sense. But if I did understand, then the dance with temporary buffer shouldn't be required; the below should work (and does work with your 2 examples, assuming your file names are encoded in UTF-8): (decode-coding-string (url-unhex-string STRING) (or file-name-coding-system (default-value 'file-name-coding-system)))