If you replace outdoor crops with forests, they'll sequester much more CO2.
In principle you can replace many acres of outdoor crops with one acre of greenhouse crops: with electric illumination you can make plants grow during nighttime, and with controlled temperature you they can also grow during the winter.
Irrigation also needs much less water in a greenhouse (because plants lose a lot of water via transpiration, and in a humid environment they transpire less). Not to mention that you can recycle the water in a greenhouse.
Irrigation is a big component of the energy expenditure of crops, but not the only one. All other components will decrease. Fertilizer, pesticides, tilling: you just don't need huge tractors to go miles and miles to the fields. You can have much smaller machines doing the job on the spot.
I'm not saying greenhouses are the solution to all the world's problems, but they shouldn't just be discarded outright.
For example think of Sudan. Most of the current supplies need to be shipped by ship and then expensively transported inland.
But Sudan has lots of sunlight.
But on the other hand there is lots of sunlight for solar.
Plants also don't use the light while they are just sprouting. Plants don't use light after you harvest them. And most importantly, plants don't use light where they are not.
If you have vast areas of desert, you can mount lots of solar panels. Lots of places are somewhat between pure Dunes-type desert and Ukrainian-type super fertile chernozem. In a semi-desert place, you might be better off just installing solar panels and building indoor farms. Think of places like Arizona, or Nevada, or, why not, Sudan.
[1] https://bioslighting.com/grow-light-spectrum-led-plants/grow...
I can't imagine the production being more energy efficient than a regular field, but it sure saves space. I can imagine places like Singapore would benefit greatly since it could produce food locally.
I personally think grains will not be economical indoors this decade, or maybe even next, but in some not very distant future, the majority of the agricultural products will be produced indoors, just like chickens are now. Of course, when that time will come, indoor farming will be perceived as bad, horrendous, anti-nature, etc, just like people perceive the industrialized chicken farms now.