On 31/05/13 15:31, A. S. Budden wrote:
Forwarding to vim-dev as requested... any cscope/vim experts here?

Al

---------- Forwarded message ----------
From: Bram Moolenaar
Date: 22 May 2013 22:02
Subject: Re: Bug: cscope interface should use absolute paths
To: A. S. Budden

Al -

When using cscope, the path as provided to the "cs add" command is
used.  If the working directory changes, this is potentially no longer
valid.  This causes me a problem as I have a plugin that tries to
pause cscope and restart it (so it can regenerate cscope.out without
access conflicts).  It does this by parsing "cs show" to get the file
name(s) and then doing "cs kill" to pause and "cs add" to restart.  If
the working directory has changed, "cs add" fails.

IIUC, the solution to this is to provide as an optional argument to the ":cs add" command the path from which cscope.out was generated, e.g. as follows:

" remember where I keep my sources:
" this means the parent of src/ runtime/ etc.
if 1
        let $VIMSRC = '/root/.build/vim/vim-hg/vim'
endif

if has('cscope')
        set cst

        if has('quickfix')
                set csqf=s-,c-,d-,i-,t-,e-
        endif

        if version < 700
                cnoreabbrev csa cs add
                cnoreabbrev csf cs find
                cnoreabbrev csk cs kill
                cnoreabbrev css cs show
                cnoreabbrev csh cs help
        else
cnoreabbrev <expr> csa ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs add' : 'csa') cnoreabbrev <expr> csf ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs find' : 'csf') cnoreabbrev <expr> csk ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs kill' : 'csk') cnoreabbrev <expr> css ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs show' : 'css') cnoreabbrev <expr> csh ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs help' : 'csh')
        endif

        command -bar Cscope cs add $VIMSRC/src/cscope.out $VIMSRC/src

        set csverb
endif


The ":if 1" is to avoid an error in a minimal-features Vim compiled with no expression evaluation.


Best regards,
Tony.
--
THEOREM: VI is perfect.
PROOF: VI in roman numerals is 6. The natural numbers < 6 which divide 6 are 1, 2, and 3. 1+2+3 = 6. So 6 is a perfect number. Therefore, VI is perfect.
QED
                                                    -- Arthur Tateishi

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui