On 02/11/13 14:26, Marius Gedminas wrote:
> On Fri, Nov 01, 2013 at 07:50:58AM -0700, ZyX wrote:
>>> I recompiled vim with a DB_COUNT of 5, and that successfully worked to
>>> diff five files. I suspect that the DB_COUNT limit can be raised
>>> without difficulty. I suspect that with a bit of coding that the
>>> DB_COUNT could be made arbitrary (ie. dependent upon how many files are
>>> being requested for simultaneous diffing).
>>
>> Absence of limit makes sense. Both 9 and 4 look like some magic
>> number. 4 was questioned by OP, I just added a question for 9.
>>
>> I do not think though somebody is going to bother with memory
>> (de)allocation implied by removing the limit. But before increasing
>> limit to 9, 99 or INT_MAX one has to answer why. I do not see much
>> difference between 4 and 9: I never actually needed more then 3; and
>> even 3 diffed buffers are a bit confusing. Thus I would like to hear a
>> use-case that resulted in request to increase the limit.
>
> I've once needed to diff five[*] very similar files[**]. I had to
> rebuild vim after increasing that arbitrary limit, and then vimdiff
> worked just fine.
>
> [*] probably five, I don't remember the exact number, only that it was
> more than vim's default limit
> [**] they contained names of installed Debian packages from five
> different computers, one per line
>
> Marius Gedminas
>
Two is extremely common. Three or four (with common ancestor and/or
common descendant) are not unheard of. You showed a usecase for five,
and by analysing that usecase, it may be inferred that six or seven
should be possible, but that 100 would be too many to be expected in
practice. I suppose that exactly where to fix the limit leaves some room
for appreciation. Maybe it could be made into a compile-time option,
either hidden in src/feature.h (that would be a simple matter, moving
its define line from line 1731 of src/structs.h to some place in
src/feature.h where FEAT_DIFF is known to be defined, maybe between
lines 474 and 475; feature.h would then need to be #include'd in
structs.h (where it isn't; diff.c includes it via vim.h); or it could
even be added as a new configure argument, maybe something like
--with-diff-count=7 (the default remaining 4, I suppose) (but that would
mean delving into the configure scripts, which is something beyond my ken)..
Of course the maximum number should be "safely lower" than the maximum
number of file handles on the system where Vim is running, and by safely
I mean: so that neither Vim nor other programs running in parallel would
be made to run out of file handles.
My Mercurial configuration contains settings for quite a number of
external merge tools; I'm not sure where they all came from. Those for
Vim (unsurprisingly, I suppose) set four arguments but immediately
closes the last two buffers. I attached the relevant lines from the
output of "hg showconfig", after sorting, and with the Vim lines
repeated at the end. As you can see, none of the examples are for more
than 4 files. (By comparison to hgrc files, the part until the first dot
is the [section] name.)
But of course the capabilities of vimdiff must not be kept down to what
existing version-control software is known to require.
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
39. You move into a new house and decide to Netscape before you landscape.