Saturday, March 26, 2011

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

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)

--
God made machine language; all the rest is the work of man.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
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