We develop linear discretization of complex analysis, originally introduced by R. Isaacs, J. Ferrand, R. Duffin, and C. Mercat. We prove convergence of discrete period matrices and discrete Abelian integrals to their continuous counterparts. We also prove a discrete counterpart of the Riemann--Roch theorem. The proofs use energy estimates inspired by electrical networks.