patch 9.1.0337: Missing entry for XDG vimrc file in :version

Commit: 
https://github.com/vim/vim/commit/d1068a2bb09fd3b9d117d832105bf10dd5e48e2f
Author: Diego Viola <diego.vi...@gmail.com>
Date:   Tue Apr 16 20:58:45 2024 +0200

    patch 9.1.0337: Missing entry for XDG vimrc file in :version
    
    Problem:  Missing entry for XDG vimrc file in :version
    Solution: Add 4th user vimrc entry to :version output
              (Diego Viola)
    
    related: #14182
    closes: #14569
    
    Signed-off-by: Diego Viola <diego.vi...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/os_unix.h b/src/os_unix.h
index d214a4aaf..67dad2e68 100644
--- a/src/os_unix.h
+++ b/src/os_unix.h
@@ -250,9 +250,9 @@ typedef struct dsc$descriptor   DESC;
 #endif
 
 #ifndef XDG_VIMRC_FILE
-# define XDG_VIMRC_FILE mch_getenv("XDG_CONFIG_HOME") \
-       ? (char_u *)"$XDG_CONFIG_HOME/vim/vimrc" \
-       : (char_u *)"~/.config/vim/vimrc"
+# define XDG_VIMRC_FILE (mch_getenv("XDG_CONFIG_HOME") \
+       ? "$XDG_CONFIG_HOME/vim/vimrc" \
+       : "~/.config/vim/vimrc")
 #endif
 
 #if !defined(USR_VIMRC_FILE3) && defined(VMS)
diff --git a/src/testdir/test_xdg.vim b/src/testdir/test_xdg.vim
index d23c93a37..da98a2cfa 100644
--- a/src/testdir/test_xdg.vim
+++ b/src/testdir/test_xdg.vim
@@ -137,4 +137,21 @@ func Test_xdg_runtime_files()
   unlet $XDG_CONFIG_HOME
 endfunc
 
+func Test_xdg_version()
+  CheckUnix
+  let $HOME = getcwd() .. '/XfakeHOME'
+  unlet $XDG_CONFIG_HOME
+  let a = execute(':version')->split('
')
+  let a = filter(a, { _, val -> val =~ '\.config\|XDG_CONFIG_HOME' })
+  call assert_equal(1, len(a))
+  call assert_match('\~/.config/vim/vimrc', a[0])
+
+  let $XDG_CONFIG_HOME = expand('~/.xdg')
+  let a = execute(':version')->split('
')
+  let a = filter(a, { _, val -> val =~ '\.config\|XDG_CONFIG_HOME' })
+  call assert_equal(1, len(a))
+  call assert_match('XDG_CONFIG_HOME/vim/vimrc', a[0])
+  unlet $XDG_CONFIG_HOME
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 0c8687ebe..802addc30 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    337,
 /**/
     336,
 /**/
@@ -1743,10 +1745,21 @@ list_version(void)
     version_msg(USR_VIMRC_FILE2);
     version_msg("\"
");
 #endif
-#ifdef USR_VIMRC_FILE3
+#if defined(USR_VIMRC_FILE3) && defined(XDG_VIMRC_FILE)
     version_msg(_(" 3rd user vimrc file: \""));
     version_msg(USR_VIMRC_FILE3);
     version_msg("\"
");
+    version_msg(_(" 4th user vimrc file: \""));
+    version_msg((char *)(XDG_VIMRC_FILE));
+    version_msg("\"
");
+#elif defined(USR_VIMRC_FILE3)
+    version_msg(_(" 3rd user vimrc file: \""));
+    version_msg(USR_VIMRC_FILE3);
+    version_msg("\"
");
+#elif defined(XDG_VIMRC_FILE)
+    version_msg(_(" 3rd user vimrc file: \""));
+    version_msg((char *)(XDG_VIMRC_FILE));
+    version_msg("\"
");
 #endif
 #ifdef USR_EXRC_FILE
     version_msg(_("      user exrc file: \""));

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rwoyR-00EVPM-MW%40256bit.org.

Raspunde prin e-mail lui