dkprice / vim-easygrep

Fast and Easy Find and Replace Across Multiple Files
The Unlicense
325 stars 47 forks source link

Question about code #58

Closed jpmv27 closed 7 years ago

jpmv27 commented 7 years ago

I have a question about this code in DoGrep(). It masks almost all exceptions and makes it look like the search found nothing. Was this the intent? It makes it very hard to spot problems that manifest as exceptions. My guess is that the intent was to say something like if v:exception == 'E480'

    catch
        if v:exception != 'E480'
            call s:WarnNoMatches(a:pattern)
            try
                " go to the last error list on no matches
                if g:EasyGrepWindow == 0
                    silent colder
                else
                    silent lolder
                endif
            catch
            endtry
        else
            call EasyGrep#Error("FIXME: exception not caught ".v:exception)
        endif
        let failed = 1
    endtry
dkprice commented 7 years ago

I don't really remember what the intent was there -- I'm guessing I just implemented a WAR (poorly) for an issue I was seeing at the time. Your fix is more robust than the previous code.