Monday, March 28, 2011

Re: Bug in the behavior of &diff when executing vimdiff?

On 2011-03-26, Bram Moolenaar wrote:
> Gary Johnson wrote:
>
> > > > I'm trying to configure Vim so that I can
> > > >
> > > > 1. choose which filetypes have syntax coloring enabled and
> > > >
> > > > 2. set syntax off when diffing files.
> > > >
> > > > Without the latter, some syntax foreground colors and diff
> > > > background colors are such that the text is impossible to read.
> > > >
> > > > I've discovered when diffing two files like this,
> > > >
> > > > $ vimdiff foo.xml bar.xml
> > > >
> > > > that the value of the 'diff' option, &diff, is true when the
> > > > ~/.vimrc is read, false when filetype pluging for the first file,
> > > > foo.xml, is read, and true again when the filetype plugin for the
> > > > second file, bar.xml, is read. That makes it difficult to determine
> > > > in the filetype plugin whether syntax coloring should be on or off.
> > > >
> > > > I think this is a bug.
> >
> > ...
> >
> > > > The behavior of &diff has like this for as long as I've been trying
> > > > to use it this way, early 7.2 if not before. The version I used for
> > > > this test was 7.3.138, a normal version built on a Fedora 11 system.
> > >
> > > How about this patch:
> >
> > Thanks very much, Bram! When I try that, though, I get these
> > errors from 'make':
> >
> > ...
> > gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -D_FORTIFY_SOURCE=1 -o objects/main.o main.c
> > main.c: In function 'edit_buffers':
> > main.c:2710: error: 'params' undeclared (first use in this function)
> > main.c:2710: error: (Each undeclared identifier is reported only once
> > main.c:2710: error: for each function it appears in.)
> > make[1]: *** [objects/main.o] Error 1
> > make[1]: Leaving directory `/home/gajohnso/src/vim-hg/vim/src'
> > make: *** [first] Error 2
> >
> > I thought maybe there was a conditional-compile problem, but there's
> > no sign of a declaration of params within main(). I didn't
> > investigate further.
>
> Small mistake in the patch:
>
> + if (params.diff_mode)
>
> should be:
>
> + if (parmp->diff_mode)

That worked to fix the build error but didn't work to fix the &diff
problem. When I run the same example as before but with this
patched vim I get the same results:

:echo diffdict
{'bar.xml': 0, 'foo.xml': 1, 'vimrc': 1}

Regards,
Gary

--
You received this message from the "vim_use" 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

No comments:

Post a Comment