Skip to content

Commit 01edfec

Browse files
committed
Fix config option lookup
Vim script is infuriating sometimes! Turns out that the indentation tests locally passed with the previous code, but failed in CI and real life.
1 parent b86a4c0 commit 01edfec

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Diff for: indent/clojure.vim

+8-10
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ setlocal indentkeys=!,o,O
2525
" Set a new configuration option with a default value. Assigns a script-local
2626
" version too, which is the default fallback in case the global was "unlet".
2727
function! s:SConf(name, default) abort
28-
exec 'let' 's:' . a:name '=' string(a:default)
28+
let s = 's:' . a:name
2929
let n = 'g:' . a:name
30-
if ! exists(n) | exec 'let' n '=' string(a:default) | endif
30+
exec 'let' 's:' . a:name '=' string(a:default)
31+
if ! exists(n) | exec 'let' n '=' s | endif
3132
endfunction
3233

33-
" Get the value of a configuration option with a possible fallback. If no
34-
" fallback is given, uses the original config option value.
35-
function! s:Conf(opt, fallback = v:null) abort
36-
return a:fallback ==# v:null
37-
\ ? get(b:, a:opt, get(g:, a:opt, get(s:, a:opt)))
38-
\ : get(b:, a:opt, get(g:, a:opt, a:fallback))
34+
" Get the value of a configuration option with a possible fallback.
35+
function! s:Conf(opt, fallback) abort
36+
return get(b:, a:opt, get(g:, a:opt, a:fallback))
3937
endfunction
4038

4139
" Available options:
@@ -246,7 +244,7 @@ function! s:StringIndent(delim_pos)
246244
let m = mode()
247245
if m ==# 'i' || (m ==# 'n' && ! s:EqualsOperatorInEffect())
248246
" If in insert mode, or normal mode but "=" is not in effect.
249-
let alignment = s:Conf('clojure_align_multiline_strings')
247+
let alignment = s:Conf('clojure_align_multiline_strings', s:clojure_align_multiline_strings)
250248
" -1: Indent along left edge, like traditional Lisps.
251249
" 0: Indent in alignment with end of the string start delimiter.
252250
" 1: Indent in alignment with string start delimiter.
@@ -313,7 +311,7 @@ function! s:ListIndent(delim_pos)
313311
" - Indent subsequent lines to align with first operand.
314312
" else
315313
" - Indent 1 or 2 spaces.
316-
let indent_style = s:Conf('clojure_indent_style')
314+
let indent_style = s:Conf('clojure_indent_style', s:clojure_indent_style)
317315
if indent_style !=# 'uniform' && ln_content[0] !=# ':'
318316
let pos = s:FirstFnArgPos(a:delim_pos)
319317
if pos != [0, 0] | return s:PosToCharCol(pos) - 1 | endif

0 commit comments

Comments
 (0)