Semilocal density functionals for the exchange-correlation energy are needed for large electronic systems. The Tao-Perdew-Staroverov-Scuseria (TPSS) meta-generalized gradient approximation (meta-GGA) is semilocal and usefully accurate, but predicts too-long lattice constants. Recent GGAs for solids yield good lattice constants but poor atomization energies of molecules. We show that the construction principle for one of them (restoring the density gradient expansion for exchange over a wide range of densities) can be used to construct a revised TPSS meta-GGA with accurate lattice constants, surface energies, and atomization energies for ordinary matter.