Skip to content

Conversation

@sutehachi
Copy link

I think this may fix the #171

@alerque
Copy link
Member

alerque commented Jan 1, 2026

I'm sorry but this 'fix' doesn't make any sense to me yet and I can't confirm the initial problem.

We already have this in the init function:

if !exists('b:ledger_bin')
    let b:ledger_bin = get(g:, 'ledger_bin', 0)
endif

The completion function should be running in an environment where the init function has already run, so the value should never not exist at all. If the user hasn't set any global preference and we haven't discovered anything useful we will at least set the buffer local value to 0.

@alerque
Copy link
Member

alerque commented Jan 1, 2026

Gah, I just re-read your comment in the issue which I've ready before but somehow it didn't all click.

I think the extra layer on this issues is that we are setting a value all the time, so the test for exists() will actually fail the other direction for people with the opposite problem as you.

let transactions = ledger#transactions()
let cache = {'descriptions': [], 'tags': {}, 'accounts': {}, 'flat_accounts': []}
if b:ledger_bin
if exists('b:ledger_bin')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be either a test for not being 0 or being a string or something, but this is always going to exist, the trouble is that both our falsy value 0 and real values strings are testing as falsey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants