Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce verbose option #241

Merged
merged 6 commits into from Jan 17, 2016
Merged

Introduce verbose option #241

merged 6 commits into from Jan 17, 2016

Conversation

somini
Copy link
Contributor

@somini somini commented Aug 7, 2015

Provide a way to silence nagging messages, more appropriate for a debug
situation.
You can define let g:EasyMotion_verbose = 0 to quiet most messages. By default, the variable is set to 1 to maintain the current behaviour.

This is similar to PR #239, but more aggressive, silences a lot more stuff by going directly to the source.

@@ -399,7 +405,11 @@ function! s:Prompt(message) " {{{
echohl None
endfunction " }}}
function! s:Throw(message) "{{{
throw 'EasyMotion: ' . a:message
if g:EasyMotion_verbose
Copy link
Member

Choose a reason for hiding this comment

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

Even if &verbose == 0, Vim throws exceptions, so I don't want to suppress the error message.
It makes it hard to debug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, I just wanted to stop messages like 'EasyMotion: Cancelled'. Turns out there's a dead variable to do the same, I changed it to global verbose.

@haya14busa
Copy link
Member

Thanks, I looks better than #239.
In addition to my comment, could you please writing test and document?

@somini
Copy link
Contributor Author

somini commented Aug 8, 2015

I can write the documentation, but as for tests, how can I test for messages printed with echo?

@@ -53,7 +53,6 @@ function! EasyMotion#init()
let s:EasyMotion_is_cancelled = 0
" 0 -> Success
" 1 -> Cancel
let g:EasyMotion_ignore_exception = 0
Copy link
Member

Choose a reason for hiding this comment

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

It's my fault because I didn't write documentation for this variable, but this variable is used by https://github.com/haya14busa/vim-easyoperator-line.
Could you please reverting this line and check this var when printing exception?
If the verbose option is set, it's ok to suppress the exception regardless of this variable.

@haya14busa
Copy link
Member

I can write the documentation, but as for tests, how can I test for messages printed with echo?

Thanks for the documentation. As for the test, only checking the global option is fine.
I guess we can write test for messages printed with echo using redir or something, but it's difficult to write.

@somini
Copy link
Contributor Author

somini commented Aug 8, 2015

Sorry about that, that variable seemed to perform the same function. I did a git grep, but nothing came up, so I overwrote it. It's fixed now.

As for testing, I pushed my first stab at it. Still have to find how reliable verbosefile is.
How can I debug tests, can't I just echo some things to the rake execution?

Provide a way to silence nagging messages, more appropriate for a debug
situation.
I did a grep for more instances, but I think that's the only place where
it calls echo directly.
Make sure the exception is thrown, to clean up and do other things, but
show the message only if the verbose option is set.
@somini
Copy link
Contributor Author

somini commented Nov 16, 2015

Rebased this to the latest master, it was only a documentation update.

@haya14busa
Copy link
Member

I'm reaslly sorry for the late reply. It looks good to me. Thank you for the PR 👍

haya14busa added a commit that referenced this pull request Jan 17, 2016
Introduce verbose option
@haya14busa haya14busa merged commit c9cc9ec into easymotion:master Jan 17, 2016
@somini
Copy link
Contributor Author

somini commented Jan 17, 2016

Thanks! 👍

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.

None yet

2 participants