Preparation of functional benzofurans, benzothiophenes, and indoles using ester, thioester, and amide via intramolecular Wittig reactions.