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: user-directory: New library to find user {conf, data, state, ...} files Date: Mon, 08 Nov 2021 20:31:17 +0200 Message-ID: <835yt27b4a.fsf@gnu.org> References: <83sfwp1c27.fsf@gnu.org> <83sfwnyi65.fsf@gnu.org> <83k0hzydcg.fsf@gnu.org> <83wnlj7ng4.fsf@gnu.org> <83fss67nvw.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4151"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 08 19:32:04 2021 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 1mk9R6-0000tJ-0x for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Nov 2021 19:32:04 +0100 Original-Received: from localhost ([::1]:60600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mk9R5-0000YM-2s for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Nov 2021 13:32:03 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mk9QX-0008In-2f for emacs-devel@gnu.org; Mon, 08 Nov 2021 13:31:29 -0500 Original-Received: from [2001:470:142:3::e] (port=37444 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mk9QW-0006G7-5y; Mon, 08 Nov 2021 13:31:28 -0500 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=/mpplHzf24XDhg6cy1ZKJdwS3Ch6G0NTHiFPnlGqX4I=; b=Nuhye3rSpL3l 7IOVvjbzbyPaJbKCwm3ev6depmczFjhkX5NQuiLr1OwlVLj5XKCuB1xRnTFYSYhu3/G6DfU11budn D4VpTgiFXZWLfDWG/H+Sn9RqHuzuQqlgclCiF+qNHL1qqilL9dtLDiW+/OeeUELkZjvKWmI2YbvQ6 RluvqIrLqcvjwbqqj8YljDWVPouNjpkUiz6Gir7Ih/GuG5scUl1t3MfJy9210v32seu2pfBQKjxQw 4UER6hwmsBd+O0ToAhYtXSMP8frjJbTBEfGvBbMtIbtljjHWP7J2OJE7FlGmpov4nRDMB4reDX+k6 cbW1/WegqJ5Qw7jn2Q0sBA==; Original-Received: from [87.69.77.57] (port=3730 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mk9QU-0007ry-Ok; Mon, 08 Nov 2021 13:31:27 -0500 In-Reply-To: (message from Stefan Kangas on Mon, 8 Nov 2021 16:26:15 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:279050 Archived-At: > From: Stefan Kangas > Date: Mon, 8 Nov 2021 16:26:15 +0100 > Cc: Stefan Monnier , Emacs developers > > > That is fine, but I'm not sure how you can achieve that goal and still > > prefer the XDG directories. > > This is the key point, indeed. > > The new name will be preferred only when there is no old file. If it > exists, the old name will be used. (This is based on how > 'locate-user-emacs-file' works.) See below. "Old file" or "old directory"? That's an important difference, IMO. > > What do you mean by "falls back"? To respect the current behavior, > > the value of user-emacs-directory should be used in preference to > > everything else. > > Sorry, I should have said "use", not "falls back": it returns the > value of 'user-emacs-directory' and does nothing else. > > > But if we do that, then in which cases will the XDG > > directories be used, since user-emacs-directory always exists and is > > defined. > > The 'config case is different from the 'cache, 'state and 'data cases, > where the XDG directories will be preferred instead. Which of the existing files we have in Emacs will be in one of the 3 latter directories? Please search the tree for uses of user-emacs-directory and tell me whether any of those will/should be in one of those 3. If none of them should be there, then perhaps my problem is smaller than I feared, but I'd still want to talk about the files which will be in those 3. And also perhaps we should see if some popular 3rd party packages place files under user-emacs-directory, and consider those as well. > 1. If "~/.emacs.d/old" exists, then we get: > > (user-file 'config "new" "old") > => "~/.emacs.d/old" > > (user-file 'cache "new" "old") > => "~/.emacs.d/old" Not sure I understand why "new" and "old" are different strings. Presumably, code which uses user-file will look for a particular basename, so why do we need 2 separate arguments? > 3. Finally, let's consider the bookmark case, where a user might be > using the very old name "~/.emacs.bmk": > > (user-file 'data "bookmarks" (locate-user-emacs-file "bookmarks" > ".emacs.bmk")) > => "~/.emacs.bmk" And here I don't understand why the caller need to call locate-user-emacs-file explicitly? why couldn't user-file call it internally? Hmm... actually, does the above mean that locate-user-emacs-file will forever use the old semantics? Perhaps it should call user-file instead?