Drain the peaches well and chop, saving the juice. Add the onion, sugar, vinegar, juice from the peaches, chopped raisins (or washed and squeezed dry currants, if using), ginger, spices, and pepper.
Cook slowly until thick, about 1 hour, and seal in sterile jars.