Slice up onions.
Chop up garlic
Melt butter in a heavy-bottomed pan over high heat.
Add onions and garlic, and stir well to coat with butter. Then add sugar, oregano, cinnamon and some salt and pepper.
Reduce heat and cook uncovered for 10 minutes.
When onions are soft enough to break when pressed against the side of the pan with a spatula, pour in the sherry vinegar.
Simmer everything, uncovered, over high heat, to reduce the liquid. You must stir frequently to avoid burning. This process may take about 10-15 minutes.
Once the onions are a deep brown colour and sticky and syrupy, draw a spoon across the bottom of the pan. If this clears a path that fills rapidly with syrupy juice, your onion jam is ready.
Leave to cool in the pan, then scoop into sterilised jars and seal. This can be eaten straight away or kept in the refrigerator for up to 3 months.