From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Inclusion of XDG Base Directory library Date: Sat, 12 May 2018 09:52:19 +0300 Message-ID: <8336yxnz6k.fsf@gnu.org> References: <779935bf-79ea-5783-4c9c-4b7e2857bc50@gmail.com> <83o9hmnzsi.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1526107859 14029 195.159.176.226 (12 May 2018 06:50:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 12 May 2018 06:50:59 +0000 (UTC) Cc: emacs-devel@gnu.org To: Francisco Miguel =?utf-8?Q?Cola=C3=A7o?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 12 08:50:54 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHOMo-0003YB-JP for ged-emacs-devel@m.gmane.org; Sat, 12 May 2018 08:50:54 +0200 Original-Received: from localhost ([::1]:51557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHOOv-0000WH-N7 for ged-emacs-devel@m.gmane.org; Sat, 12 May 2018 02:53:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHOOG-00008O-Da for emacs-devel@gnu.org; Sat, 12 May 2018 02:52:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHOOD-0002w2-BO for emacs-devel@gnu.org; Sat, 12 May 2018 02:52:24 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHOOD-0002vx-8n; Sat, 12 May 2018 02:52:21 -0400 Original-Received: from [176.228.60.248] (port=1444 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fHOOC-0004eJ-Nf; Sat, 12 May 2018 02:52:21 -0400 In-reply-to: (message from Francisco Miguel =?utf-8?Q?Cola=C3=A7o?= on Fri, 11 May 2018 21:22:37 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225254 Archived-At: > Cc: emacs-devel@gnu.org > From: Francisco Miguel Colaço > Date: Fri, 11 May 2018 21:22:37 +0100 > >   Thanks for the heads up.  The windows-shell-folder and > windows-read-registry-value, which I thought were part of Windows Emacs, > were added to user-directories-windows-nt.el. Thanks. >   I have not tested Windows NT code because I do not currently own any > Windows computer and the virtual machines on which I run it do not have > Emacs.  So, I am dependent on the goodwill and patches from the many > that use Emacs on Microsoft platforms. I understand. Therefore, I raised an issue with the package, listing there the problems I see in the code, and I hope the person(s) who contributed this code will take notice and fix the problems I mentioned there. (Btw, I suggest to keep track of all your contributors, otherwise we will have difficulties admitting the code into ELPA later.) >   According to http://environmentvariables.org/LocalAppData, the > variable was introduced in Windows Vista and defaults to > C:\Users\{username}\AppData\Local. That's exactly my point: Emacs on Windows still tries to support versions of Windows that predate Vista. The code should not fail for them, but should provide fallbacks for those directories that were introduced in more recent versions. In addition, I think it's gross to use 'reg' and 'echo' as external commands to produce the Registry values; in particular, this will fail if the values include non-ASCII characters not from the system locale. We should have primitives for that. Volunteers are welcome to add such capabilities to Emacs. >   About Linux, the canonical way to get an XDG user folder is by the use > of the command xdg-user-dir.  The alternative is to parse > ~/.config/user-dirs.dirs, something that is already done by > xdg-user-dir.  Here are two lines of mine (European Portuguese): > >   XDG_DESKTOP_DIR="$HOME/Área de Trabalho" >   XDG_DOWNLOAD_DIR="$HOME/Transferências" > >   Although it does not pose a gruesome task to parse it (blessed be > regexps), as far as I can understand the XDG Base Directory Standard the > recommended way to find directories is not to parse the file, but to use > the command.  Every distribution since near 2010 includes > xdg-user-dirs.  I can write parsing code, but it seems inadequate, > considering there is a blessed way to perform the search. IMO, the advantage of parsing files in Emacs is that we can be more sure we deal properly with non-ASCII file names. When you invoke a command to do the job for you, you rely on guesswork for decoding what the program outputs, which could be tricky, especially when you do that remotely from another system, with a different locale. By contrast, I expect the file to be encoded in UTF-8 always, is that right?