Let me explain the pH thing better, now that I've had a think. Soil has a cation exchange capacity (CEC). Some soils have higher capacity then others. Think if it like a numeric count of all the molecular points where a cation could ionically bond. On each of those points, either you have a hydrogen (which makes it acidic) or another cation (which generally makes it alkaline). Those are calcium, magnesium, potassium, sodium, but also a few others in minute quantities even lead (Pb+2). Ammonium is a cation too.
When adding something, it adds more CEC attachment points, but also more cations and more hydrogen.
Within just the coffee grounds, many of the CEC points are occupied by hydrogen, so it is acidic. But when you compare the number of CEC points to that in the soil, the amount in your soil overwhelms. The good cations in your soil wont be affected much until you have enormous levels of coffee grounds (like >10% or something, I'd have to calculate it and I haven't).
And of course you can always just measure the pH and add cations which will displace the hydrogen (it will bond with the anion). Calcium is cheapest which is why people use agricultural lime. Dolomite will give you some magnesium which will probably produce healthier veggies. Potassium is important but too much will just bulk up the veggies rather than letting them develop more healthfully. Sodium is almost never useful.