> A.J.Mechelynck wrote:
>
> Michael Wookey wrote:
> > Hello vimmers,
> >
> > I am running 7.1a.001 on OSX and have just noticed the following
from
> > console vim (running in Terminal.app and also occurs in iTerm.app).
> >
> > If I change the colour scheme I receive a lot of error output. For
> > example:
> >
> > :colorscheme desert
> >
> > Results in:
> >
> > Error detected while processing
> >
>
/Applications/Vim.app/Contents/Resources/vim/runtime/colors/desert.vim:
> > line 27:
> > E254: Cannot allocate color khaki
> > E254: Cannot allocate color slategrey
> > line 36:
> > E254: Cannot allocate color gold
> > line 37:
> > E254: Cannot allocate color tan
> > ...
> >
> > Other colour schemes produce similar output. The error messages
have
> > only appeared for me in console vim on OSX (10.4.9 PPC). They have
> not
> > appeared in the linux or win32 console vims of 7.1a.001. GVim's on
> each
> > of the platforms (OSX, linux, Win32) have worked fine.
> >
> > My console vim is symlinked as follows:
> >
> > $ ls -l `which vim`
> > lrwxr-xr-x 1 root wheel 40 Feb 28 14:33 /usr/bin/vim ->
> > /Applications/Vim.app/Contents/MacOS/Vim
> >
> > These errors did not occur before 7.1a.001 and occurs on builds from
> CVS
> > and SVN. The errors still occur even with starting vim with:
> >
> > vim -u NONE
> >
> > Has anyone else noticed this?
> >
> >
>
> These color names should be used only in the GUI. In the "desert"
> colorscheme
> I have (v1.1, 2004/06/13 19:30:30) they are only present in "guibg="
> and
> "guifg=" arguments to the ":hi" command, which is normal.
>
> If you want to debug that problem, you may want to vimgrep your
sources
> for
> the "highlight" command, then inspect the source to see if (as it
> should) it
> does ignore guibg= guifg= and gui= when setting highlights in Console
> Vim.
>
> You may restrict yourself to the modules which were actually compiled
> for your
> configure options, as shown e.g. by the contents of the objects folder
> (src/objects or whatever).
I think I've found it..
The OSX Vim is built with FEAT_GUI_MAC always defined. This in turn
forces FEAT_GUI to be defined. This is from around lines 66-102 of
src/vim.h.
In src/syntax.c:do_highlight() there are checks for FEAT_GUI to be
defined. Items like "guifg" and "guibg" etc are conditionally compiled
to only take effect if FEAT_GUI is defined (which it is in the OSX
case). The call chain eventually looks like:
do_highlight()
color_name2handle()
gui_get_color() <- E254: Cannot allocate color
So because FEAT_GUI is always defined on OSX, vim gets these errors for
console vim. I still don't quite understand why this is causing an
error when it doesn't on linux. The console linux version reports:
VIM - Vi IMproved 7.1a BETA (2007 May 5, compiled May 8 2007
00:27:42)
Included patches: 1
Huge version with GTK2 GUI. Features included (+) or not (-):
...
While the console OSX version reports:
VIM - Vi IMproved 7.1a BETA (2007 May 5, compiled May 9 2007
11:33:38)
MacOS X (unix) version
Included patches: 1
Huge version with Carbon GUI. Features included (+) or not (-):
...
So both have the GUI built in yet only the OSX version complains about
the colour scheme being set.