beloglazov / vim-online-thesaurus

A Vim plugin for looking up words in an online thesaurus
Apache License 2.0
247 stars 21 forks source link

E94: No matching buffer for ^thesaurus$ #25

Closed jalvesaq closed 9 years ago

jalvesaq commented 9 years ago

When I run :OnlineThesaurusCurrentWord I get this error message:

Error detected while processing function <SNR>19_Lookup:
line    1:
E94: No matching buffer for ^thesaurus$

To reproduce the bug, you have to put in your vimrc:

set debug=msg,throw

I think that this is a Vim bug because the function bufwinnr() should return -1 without error if the buffer does not exist, but you can avoid it with the following code:

    if bufexists('^thesaurus$')
        let l:thesaurus_window = bufwinnr('^thesaurus$')
    else
        let l:thesaurus_window = -1
    endif
annagrram commented 9 years ago

Weird. There is a test that checks whether the value is above -1. Silly me believed the documentation. Can you open a PR replacing the old if with yours? (no need for the local variable in this case either).

Don't know why it throws the error, because the return values are correct. Thanks for the bug!

EDIT: I tested this solution and read a bit of documentation and it doesn't really solve the issue. bufexists() returns 1 after the thesaurus window has opened once, even if it is closed.

May I ask why are you setting these debug options in your normal work?

EDIT2: I've found a working solution. I will open a PR soon. Thanks again!

jalvesaq commented 9 years ago

Sorry, I did see your edits your comment above. Please, ignore my PR and go ahead fixing the issue.

annagrram commented 9 years ago

I guess you only read the email. I should have probably write the updates in a new comment so you would get them by email too.

I really appreciate you took the time making the PR :+1: You can take a look at mine (#26).

beloglazov commented 9 years ago

Fixed in #26