tomtom / quickfixsigns_vim

Mark quickfix & location list items with signs
http://www.vim.org/scripts/script.php?script_id=2584
GNU General Public License v3.0
131 stars 13 forks source link

Error when running from terminal #11

Closed chazy closed 13 years ago

chazy commented 13 years ago

I get this error when compiling a standard program from a non-gui vim:

Error detected while processing function QuickfixsignsSet..56_PlaceSign..56_SetItemId..56_SignExistsAt..56_BufferSigns: line 1: E121: Undefined variable: signss Error detected while processing function QuickfixsignsSet: line 53: E171: Missing :endif

Any ideas?

chazy commented 13 years ago

The output from the make command that gives the error is this:

[ARM-CC] orientd.c... [ARM-ASM] crtbegin_dynamic.S... [ARM-ASM] crtend.S... [ARM-LD] orientd

tomtom commented 13 years ago

Which version of quickfixsigns do you use? This problem sometimes occurred in earlier versions but it shouldn't happen with the current version from github.

chazy commented 13 years ago

I use the version from this commit: 1cc5371f7b83219e64546639789da67da7bd7c0e

The commit is from June 7th.

Thanks for getting back to me.

tomtom commented 13 years ago

I added a check in 53fd55edd7 to make sure the variable was defined.

chazy commented 13 years ago

Thanks for your response. Now I just get:

Error detected while processing function QuickfixsignsSet..54_PlaceSign..54_SetItemId..54_SignExistsAt..54_BufferSigns: line 4: E121: Undefined variable: l:signss

tomtom commented 13 years ago

It's interesting this error is caused by line 4. Which version of vim do you use? (See :version)

Maybe it would help to define the variable beforehand:

function! s:BufferSigns(bufnr) "{{{3
    if a:bufnr == -1
        return []
    endif
    let l:signss = ''
    redir => l:signss

Could you please insert the line

 let l:signss = ""

and check if it solves the problem but still fills the variable when there is an error during compilation?

Thanks.

chazy commented 13 years ago

that gives me:

Error detected while processing function QuickfixsignsSet..54_PlaceSign..54_SetItemId..54_SignExistsAt..54_BufferSigns: line 6: E158: Invalid buffer name:

tomtom commented 13 years ago

Hi,

Thanks for trying. May I kindle ask you if you could replace s:BufferSigns with this one:

function! s:BufferSigns(bufnr) "{{{3
    echom "DBG QFS: s:BufferSigns" a:bufnr bufnr(a:bufnr)
    if bufnr(a:bufnr) == -1
        return []
    endif
    let l:signss = ''
    redir => l:signss
    exec 'silent sign place buffer='. a:bufnr
    redir END
    if exists('l:signss')
        let signs = split(l:signss, '\n')
        if len(signs) > 2
            call remove(signs, 0, 1)
        endif
    else
        echohl WarningMsg
        echom "DEBUG quickfixsigns: BufferSigns:" a:bufnr
        echohl NONE
        let signs = []
    endif
    return signs
endf

This will also print a debug message that can be reviewed via the :messages command.

The actual problem is in QuickfixsignsSet() though I suppose. I'd appreciate if you could also insert the following line:

function! QuickfixsignsSet(event, ...) "{{{3
    echom "DBG QuickfixsignsSet" string(a:000)

I'd apprectiate if you could compile your file and then execute:

redir @+
silent messages
redir END

and the paste the relevant lines of the clipboard's contents here.

Thanks for your patience.

chazy commented 13 years ago

Hi.

Sorry about the delay.

It sems to behave nucer with the above function. Below is the debug output:

DBG QuickfixsignsSet [[], 'orientd.c']
DBG QuickfixsignsSet [[], 'orientd.c']
DBG QuickfixsignsSet [[], 'orientd.c']
DBG QuickfixsignsSet [[], 'orientd.c']
DBG QuickfixsignsSet [[], 'orientd.c']
DBG QuickfixsignsSet [[], 'orientd.c']
DBG QuickfixsignsSet [[], 'orientd.c']
DBG QFS: s:BufferSigns 0 -1
(1 of 2): [ARM-CC] orientd.c...
DBG QuickfixsignsSet [[], 'orientd.c']
DBG QFS: s:BufferSigns 0 -1

Thanks.

tomtom commented 13 years ago

Hi,

Does it work now or does the problem persist?

Regard

chazy commented 13 years ago

it works with the latest fix you sent. Thanks!