[cfe-commits] [PATCH] New clang-check vim integration script

Alexander Kornienko alexfh at google.com
Wed Sep 5 05:11:16 PDT 2012


On Tue, Sep 4, 2012 at 7:35 PM, Nico Weber <thakis at chromium.org> wrote:

> On Tue, Sep 4, 2012 at 9:23 AM, Alexander Kornienko <alexfh at google.com>wrote:
>
>> On Tue, Sep 4, 2012 at 5:05 PM, Nico Weber <thakis at chromium.org> wrote:
>>
>>> On Tue, Sep 4, 2012 at 8:01 AM, Alexander Kornienko <alexfh at google.com>wrote:
>>>
>>>> On Tue, Sep 4, 2012 at 4:38 PM, Nico Weber <thakis at chromium.org> wrote:
>>>>
>>>>> ...
>>>>> Remove.
>>>>>
>>>>>
>>>>>>  +  let l:output = system(a:cmd)
>>>>>> +  cexpr l:output
>>>>>> +  cwindow
>>>>>>
>>>>> +  let w:quickfix_title = a:cmd
>>>>>> +  if v:shell_error != 0
>>>>>> +    cc
>>>>>> +  endif
>>>>>>
>>>>>
>>>>> Replace all that with
>>>>>
>>>>>   let l:oldmakepgr = &makeprg
>>>>>   let &makeprg = a:cmd
>>>>>   silent make | cwindow
>>>>>   let &makeprg = l:oldmakepgr
>>>>>
>>>>> (Gives you a warning when trying to compile a modified buffer too)
>>>>>
>>>> Doesn't work for me: after running your code vim (7.3, if this matters)
>>>> doesn't repaint it's window, and I end up having a blank screen until I
>>>> make vim repaint everything.
>>>
>>>
>>> If you don't use gvim, you might need a
>>>
>>>   if !has('gui') redraw! endif
>>>
>> 1. Have you tried to use your snippet?
>>  2. If yes, what version of vim do you use?
>>
>
> Yes, it's what we use in some vim helper script some chromium folks use. I
> use it with 7.3. (
> http://git.chromium.org/gitweb/?p=chromium/src.git;a=blob;f=tools/vim/ninja-build.vim#l80)
>
>
>> As for this line, my vim understands it only after I add delimiters: if
>> !has('gui') | redraw! | endif
>> But the problem is not with it, it's with :make also not giving a warning
>> when trying to compile a modified buffer. And even if it did complain about
>> _current_ buffer being modified, we probably need it to display warning
>> _any_ buffer is modified (it's the most consistent way to avoid stale files
>> being compiled, I think).
>>
>> So, currently, I don't see any advantages of your version.
>>
>
> It has the advantage that it does the things documented at `:help :make`.
> It's also a bit shorter.
>
As you suggest using :make for implementation rather than as an interface,
the only advantage I see is the auto-save feature if the autowrite option
is set. This is just one line of code, that I've already added. "A bit
shorter" argument here is no more important than consistency and
convenience of usage, so I would stick with a solution which is 4 lines of
code more, but is easier customizable. If you see any other things in
functionality we could improve, suggestions are welcome.


-- 
Regards,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120905/e7963dbf/attachment.html>


More information about the cfe-commits mailing list