From 7177aa780fd4293c968ecd5331f67cf4a64b046d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 3 May 2020 15:37:55 +1200 Subject: Write v:null back out of XDG routines I had misconfigured my test machine, and was testing the latest Vim v8.2.x when I thought I was testing v7.0.0, which misled me into thinking v:null was defined on the latter version in commit 145998c. Reverse this and just use an empty string as the sentinel value; it's not strictly correct, but it doesn't matter much to XDG. --- vim/autoload/getenv.vim | 11 +++-------- vim/autoload/xdg.vim | 4 ++-- vim/vimrc | 16 ++++++++-------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/vim/autoload/getenv.vim b/vim/autoload/getenv.vim index 2b8fef1b..3b5f4c1b 100644 --- a/vim/autoload/getenv.vim +++ b/vim/autoload/getenv.vim @@ -1,19 +1,14 @@ -" Backport getenv() from v8.1.1305 +" Backport getenv() from v8.1.1305, except return an empty string rather than +" v:null " " " function! getenv#(name) abort - " Use native if available - if exists('*getenv') - return getenv(a:name) - endif - - " Backport if a:name !~# '^[A-Z][A-Z0-9_]*$' throw 'Illegal env var name' endif - let value = v:null + let value = '' if exists('$'.a:name) execute 'let value = $'.a:name endif diff --git a/vim/autoload/xdg.vim b/vim/autoload/xdg.vim index 2b90f5f1..3dff52a5 100644 --- a/vim/autoload/xdg.vim +++ b/vim/autoload/xdg.vim @@ -15,7 +15,7 @@ function! s:Get(name) abort throw 'Illegal XDG basedirs env var name' endif let value = getenv#(name) - return value !=# v:null + return value !=# '' \ ? value \ : s:defaults[name] endfunction @@ -29,7 +29,7 @@ endfunction function! s:Home(name) abort let home = s:Get(a:name) if !s:Absolute(home) - return v:null + return '' endif return join([home, s:subdir], '/') endfunction diff --git a/vim/vimrc b/vim/vimrc index a08a4287..f4b0d329 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Sat, 02 May 2020 15:15:57 UTC +" Last updated: Sun, 03 May 2020 03:40:34 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -108,7 +108,7 @@ endif " of configuration. " let s:xdgconfigpaths = xdg#['config']['dirs'] -if xdg#['config']['home'] !=# v:null +if xdg#['config']['home'] !=# '' call insert(s:xdgconfigpaths, xdg#['config']['home']) endif if !empty(s:xdgconfigpaths) @@ -124,7 +124,7 @@ unlet s:xdgconfigpaths " Now put the XDG cache home at the very front, so that e.g. 'spellfile' gets " created in there rather than in the configuration directories. " -if xdg#['cache']['home'] !=# v:null +if xdg#['cache']['home'] !=# '' execute 'set runtimepath^='.option#Escape( \ option#item#Escape(xdg#['cache']['home']) \) @@ -155,7 +155,7 @@ command! -bang -bar -complete=dir -nargs=1 CreatePath " v8.1.716 introduced a way to set this with an option named 'viminfofile', " but I don't see a reason to use that. " -if xdg#['cache']['home'] !=# v:null && path#Create(xdg#['cache']['home']) +if xdg#['cache']['home'] !=# '' && path#Create(xdg#['cache']['home']) execute 'set viminfo+='.option#Escape( \ 'n'.xdg#['cache']['home'].'/viminfo' \) @@ -204,7 +204,7 @@ set history=10000 " 'backupfullname', 'swapfilefullname' would have been clearer. " set backup -if xdg#['cache']['home'] !=# v:null +if xdg#['cache']['home'] !=# '' let s:backupdir = xdg#['cache']['home'].'/backup' if path#Create(s:backupdir) execute 'set backupdir^='.option#Escape(option#item#Escape( @@ -248,7 +248,7 @@ endif " option has supported that hint for much longer than 'backupdir' has. We " apply path#Create() to attempt to create the path, if needed. " -if xdg#['cache']['home'] !=# v:null +if xdg#['cache']['home'] !=# '' let s:directory = xdg#['cache']['home'].'/swap' if path#Create(s:directory) execute 'set directory^='.option#Escape(option#item#Escape( @@ -273,7 +273,7 @@ endif " if has#('persistent_undo') set undofile - if xdg#['cache']['home'] !=# v:null + if xdg#['cache']['home'] !=# '' let s:undodir = xdg#['cache']['home'].'/undo' if path#Create(s:undodir) execute 'set undodir^='.option#Escape(option#item#Escape( @@ -411,7 +411,7 @@ set spellcapcheck=[.?!]\\%(\ \ \\\|[\\n\\r\\t]\\) " set dictionary^=/usr/share/dict/words let s:refdirs = xdg#['data']['dirs'] -if xdg#['data']['home'] !=# v:null +if xdg#['data']['home'] !=# '' call insert(s:refdirs, xdg#['data']['home']) endif if !empty(s:refdirs) -- cgit v1.2.3 From 8293c20476a36be8b7f0fb0c30c1a348370ed581 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 3 May 2020 15:44:21 +1200 Subject: Copy, don't reference XDG basedir lists --- vim/vimrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index f4b0d329..33ac602e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Sun, 03 May 2020 03:40:34 UTC +" Last updated: Sun, 03 May 2020 03:44:03 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -107,7 +107,7 @@ endif " directories to the end of it, in reverse order, forming the desired layers " of configuration. " -let s:xdgconfigpaths = xdg#['config']['dirs'] +let s:xdgconfigpaths = copy(xdg#['config']['dirs']) if xdg#['config']['home'] !=# '' call insert(s:xdgconfigpaths, xdg#['config']['home']) endif @@ -410,7 +410,7 @@ set spellcapcheck=[.?!]\\%(\ \ \\\|[\\n\\r\\t]\\) " 'isfname'; the blacklist is hard-coded. " set dictionary^=/usr/share/dict/words -let s:refdirs = xdg#['data']['dirs'] +let s:refdirs = copy(xdg#['data']['dirs']) if xdg#['data']['home'] !=# '' call insert(s:refdirs, xdg#['data']['home']) endif -- cgit v1.2.3 From 88055d28f280ce263e8e5573207b0906aa127a6a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 3 May 2020 15:44:40 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index d7fc9f90..59c843da 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v8.25.1 -Sat, 02 May 2020 23:30:24 +0000 +tejr dotfiles v8.25.2 +Sun, 03 May 2020 03:44:32 +0000 -- cgit v1.2.3