Subject: Re: bug#79168: [PATCH 03/11] Reorder code to put defcustom/defvar at the beginning part

From: Xiyue Deng <[email-masked]>
Date: Sat, 09 Aug 2025 15:23:45 -0700

Hi Robert,

Robert Pluim <[email-masked]> writes:

>>>>>> On Fri,  8 Aug 2025 23:45:42 -0700, Xiyue Deng <[email-masked]> said:
>
>     Xiyue> (Adapted from bug#52476 by Aleksandr Vityazev.)
>     Xiyue> * packages/oauth2/oauth2.el: Put oauth2-token-file,
>     Xiyue> oauth2--url-advice, and oauth--token-data to the beginning part of the
>     Xiyue> source code.
>     Xiyue> ---
>     Xiyue>  oauth2.el | 16 ++++++++--------
>     Xiyue>  1 file changed, 8 insertions(+), 8 deletions(-)
>
>     Xiyue> diff --git a/oauth2.el b/oauth2.el
>     Xiyue> index c3aa45ed69..eccf439130 100644
>     Xiyue> --- a/oauth2.el
>     Xiyue> +++ b/oauth2.el
>     Xiyue> @@ -53,9 +53,17 @@
>     Xiyue>    :link '(url-link :tag "Savannah" "https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/?h=externals/oauth2")
>     Xiyue>    :link '(url-link :tag "ELPA" "https://elpa.gnu.org/packages/oauth2.html"))
>  
>     Xiyue> +(defcustom oauth2-token-file (concat user-emacs-directory "oauth2.plstore")
>     Xiyue> +  "File path where store OAuth tokens."
>     Xiyue> +  :group 'oauth2
>     Xiyue> +  :type 'file)
>     Xiyue> +
>
> This should use `locate-user-emacs-file'.

Ah indeed.  Please see the attached patch.

> Robert
> -- 

-- 
Regards,
Xiyue Deng
From 1b96330d9ff013a8e73c4805f89f0b518c070673 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <[email-masked]>
Date: Sat, 9 Aug 2025 14:51:16 -0700
Subject: [PATCH] Use `locate-user-emacs-file' instead of concat
 user-emacs-directory

* packages/oauth2/oauth2.el (oauth2-token-file): Use
locate-user-emacs-file.
---
 oauth2.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/oauth2.el b/oauth2.el
index 8c36d10eea..25458911d2 100644
--- a/oauth2.el
+++ b/oauth2.el
@@ -56,7 +56,7 @@
                    "https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/?h=externals/oauth2")
   :link '(url-link :tag "ELPA" "https://elpa.gnu.org/packages/oauth2.html"))
 
-(defcustom oauth2-token-file (concat user-emacs-directory "oauth2.plstore")
+(defcustom oauth2-token-file (locate-user-emacs-file "oauth2.plstore")
   "File path where store OAuth tokens."
   :group 'oauth2
   :type 'file)
-- 
2.50.1