Skip to content

Commit

Permalink
Catch E118 for set{qf,loc}list for old versions
Browse files Browse the repository at this point in the history
References #44.
  • Loading branch information
mhinz committed Oct 4, 2016
1 parent ea23c84 commit 229d3c6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions autoload/grepper.vim
Original file line number Diff line number Diff line change
Expand Up @@ -437,20 +437,23 @@ function! s:restore_mapping(mapping)
endfunction

" s:finish_up() {{{1
function! s:finish_up(flags) abort
function! s:finish_up(flags)

This comment has been minimized.

Copy link
@blueyed

blueyed Oct 5, 2016

Contributor

Removed on purpose?

This comment has been minimized.

Copy link
@mhinz

mhinz Oct 5, 2016

Author Owner

Yea, try doesn't work in combination with abort. :-)

(Hint: It will throw an error nevertheless in that case.)

This comment has been minimized.

Copy link
@blueyed

blueyed Oct 5, 2016

Contributor

Oh.. wow?!

let qf = a:flags.quickfix
let qlist = getqflist()
let llist = getloclist(0)
let size = len(qf ? qlist : llist)

call s:restore_errorformat()

let title = has('nvim') ? s:cmdline : {'title': s:cmdline}
if qf
call setqflist(qlist, 'r', title)
else
call setloclist(0, llist, 'r', title)
endif
try
let title = has('nvim') ? s:cmdline : {'title': s:cmdline}
if qf
call setqflist(qlist, 'r', title)
else
call setloclist(0, llist, 'r', title)
endif
catch /E118/
endtry

if size == 0
execute (qf ? 'cclose' : 'lclose')
Expand Down

0 comments on commit 229d3c6

Please sign in to comment.