Put the damsons into a pan and simmer in their own juice until soft, then take out the stones. Peel, core and chop the apples, and chop the onions. Put all the ingredients into a pan and simmer for 2 hours until soft and thick. Stir occasionally to prevent sticking. Put into hot jars, cover and seal.