How are partial molar Gibbs excess functions correctly defined? I think I've found a mistake in my thermodynamics textbook, Chemical Thermodynamics for Process Simulation, but as thermodynamics is hard and I'm a relative novice, I wanted to check here.

The textbook, in talking about partial molar Gibbs excess functions of species in solutions, writes that we can express the partial molar Gibbs free energy of a species $\bar{g_i}$ in solution, as the sum of the partial molar Gibbs free energy in an ideal solution, $\bar{g_i}^\mathrm{id}$, and an excess function, $\bar{g_{i}}^\mathrm{ex}$:

$$\bar{g}_i = \bar{g}_i^\mathrm{id}+\bar{g}_i^\mathrm{ex}.$$

It doesn't specify whether we are thinking of evaluating $\bar{g}_i^\mathrm{id}$ at the system pressure or at a reference pressure, but immediately after it 'expands' the above expression into the form:

$$\bar{g}_i(T,P) = \Big(\bar{g}_i^\mathrm{pure}(T,P_0) + \mathcal{R}T\ln x_i\Big) + \left(\mathcal{R}T\ln \frac{f_i}{x_if_i^0}\right)$$

Clearly we're comparing $\bar{g}_i$ to the ideal value, $\bar{g}_i^\mathrm{id}$, at standard pressure $P_0$. However, they then go on to define the activity $a_i=f_i/f_i^0$ and the activity coefficient $\gamma_i = a_i/x_i$ and substitute these in to get

$$\bar{g}_i(T,P) = \bar{g}_i^\mathrm{pure}(T,P_0) + \mathcal{R}T\ln x_i  +  \mathcal{R}T\ln \gamma_i.$$

Now, I'm all fine up to here. The first part, $\bar{g}_i^\mathrm{pure}(T,P_0) + \mathcal{R}T\ln x_i $, is the ideal solution Gibbs free energy at standard pressure, and the final term, $\mathcal{R}T\ln \gamma_i,$ is a correction in two ways: It corrects for the non-ideality of the solution, and it corrects for the fact that we may be at a different pressure $P$. 

But the book then says: 


  For an ideal mixture the excess part is equal to zero, since the activity coefficient is $\gamma_i=1$.


I think this is ridiculous: we can only make this conclusion if we have an ideal solution at $P=P_0$. 

Is this an error in the textbook? Also, I can see two possible routes to an error: Either $\bar{g}_i^\mathrm{id}$ is actually to be evaluated at system pressure, in which case their last statement is correct but the formula they give is wrong, or else their definition of excess functions is the standard one (actual value minus ideal value at ref. pressure) but they made a mistake in concluding $\gamma_i=1$ for all ideal solutions, independent of the pressure.
The confusion is perhaps not uncommon. However, whichever book it is has jumped from discussing the free energy of pure materials, and their variation with various things (T, P, V, ...), to discussing mixtures.  In this case, all variation of the 'pure' substances is present in the ideal terms - that is because those variation exist without regard for any mixing terms.  What you are focused on here are the impacts of making a solution (or binary alloy, ...).

So, to make the mixture, you take a certain amount of substance A, and a certain amount of substance B, and mix them together. Before mixing, the total free energy of the system is $x_A G_{A} + x_B G_{B}$ where $G_{A,B}$ are the Gibbs free energies of those substances at whatever the conditions you specify before mixing. So, what does mixing do? Well, at the very least you get the increase in entropy, $RT(x_{A}\ln{x_{A}} +x_{B}\ln{x_{B}}$. If there is any interaction between A and B, you now have non-ideal terms which can be represented in any number of different ways. However, the point is that they are "all the rest that happens" during the mixing, and those things may be functions of concentration, temperature, pressure, ...

But, to come back to your question - no, this is not an error in the textbook (whichever it is). But, the did not make it clear that they were leaving behind the explicit dependencies of free energy on the various parameters - they figured you had that part down.

I would also note that, when one calculates a phase diagram (ultimately one hopes the book might get to that, and miscibility gaps and whatnot), you are free to choose the reference points or phases of A and B yourself - that choice makes no difference in the phase boundaries and tie lines. And, this comes back to just what $G_{A,B}$ means.