Ion emission from an electronically perturbed solid surface: A general formulation