In a medium cast-iron skillet, cook the bacon over moderate heat, stirring occasionally, until crisp, 6 to 7 minutes. Using a slotted spoon, transfer the bacon to a plate. Pour off all but 2 tablespoons of the bacon fat. Add the onion to the skillet and cook over moderately low heat, stirring occasionally, until soft and golden, about 25 minutes. Add the sugar and cook until the sugar is dissolved and the onions are glazed, about 2 minutes. Return the bacon to the skillet; season with cayenne pepper, salt and black pepper. Keep the bacon marmalade warm.