Brain is kind of foggy today as you no doubt can tell.
I think trying to regain Gibraltar was the main reason why Spain came into the War for American Independence. France had pledged not to make peace with Britain before Spain did which could have created a problem for the US because we were pledged not to make a separate peace (the preliminary peace treaty of 1782 would not take effect until France also made peace) but eventually the Spanish recognized reality and agreed to make peace.