Local food has genuine advantages. Since the customers are so much closer, the distance food has to travel is much smaller. This reduces how much CO2 and other pollutants are emitted. And it becomes possible to choose cultivars that taste good and are harvested ripe instead of strains that are only good at travelling (unripe). These are the motivations for urban farms.
There is another acception for "local": fewer intermediaries (for instance buying directly from a farmer on a farmer's market). This makes it possible to know where the food comes from (and perhaps how it was grown). And it cuts intermediaries (and their mark-ups).
The argument for local food is particularly potent when you buy apples that were grown 50 km from where you live but had to travel 1 000 km to reach you. Or when you buy carrots imported from far away despite a sufficient local production. In such cases, the long-distance transportation could probably be avoided.
On the other hand, there can be good reasons why certain plants are grown in certain places and not others. The Aral Sea is now nearly completely gone because thirsty cotton was grown in an arid area with the help of massive irrigation. In cold places, greenhouses must be heated, which increases both the cost and the environmental impact of the food.
One should then wonder whether it is better to grow tomatoes in a remote warm place in unheated greenhouses and transport them to a colder area or grow them in heated greenhouses and not transport them. The answer will probably vary case by case.
The case of electricity is rather more complex. At one extreme is off-grid life — complete autarchy with autonomous production and storage of electricity. At the other extreme is centralized production. These two extremes for instance exist with solar electricity: small-scale rooftop photovoltaic (PV) panels against solar farms (be they PV or concentration).
Each has advantages. Local means no grid, i.e. no grid failure (and none of the ugliness), and no massive investment in a smart grid to integrate wide-spread renewable energy. But more autonomy (less reliance on the grid) also means more overproduction (producing enough at any time means producing too much on average) or more storage (but storage works well only for short times, not when peak production is in summer and peak consumption in winter, as is the case of solar power in Europe). And of course, large-scale production has economies of scale.
A large power plant can be located where it will be most efficient, whereas rooftop solar panels have to be wherever it is you live, even if it is not a sunny place. The case of wind power is even clearer: a few big wind turbines clustered in a windy location can produce a lot more than a lot of scattered small ones.
A grid also means that you can harness sunlight from far away when it is raining where you live. The situation is rather similar to investing in stocks. Should you invest in the stock that will on average return the most (one massive solar farm in the sunniest location)? Or are you better off with a portfolio of stocks, so that even if one does not do well others will compensate (solar panels scattered geographically)?
It depends on how much more the top performer beats the rest of the crowd. In very sunny parts of the world (such as deserts in North Africa, the Middle East, the southwest of the US, etc.), local production of solar electricity is easy and efficient. (So much so that it would makes lots of sense for them to export some; after all why struggle with solar panels in Germany when Andalusia is so sunny?)
To carry on with the conceit, one may say that sun and wind are two different asset classes (like stocks and bonds, or stocks and real estate): one may zig when the other zags. Two solar panels 50 km are more like two stocks: they behave only somewhat differently. To reduce the volatility of a portfolio, it is best to have a lot of different stocks, as well as bonds, real estate, etc. — uncertainty minimization through diversification. It thus seems that, to minimize the uncertainty in power production, it would be best to have both wind and solar and both scattered across space.
Certain countries have a clear competitive advantage when it comes to producing solar power, wind power or bananas. If transportation were heavily taxed (e.g. through a tax on fuel or on carbon), bananas would still be imported from the tropics, but the locally produced apples would no longer travel 1 000 km to reach you. Likewise, if power lines were made expensive, it would still make sense to have solar panels in sunny places (but not to have one huge solar power plant in a marginally sunnier area).
There are clear advantages to a move toward more local production, especially keeping local what has no business coming from far away. But it could certainly go too far — it can become an article of faith, and "local" a minor deity to be worshipped (locally).