I stumbled upon "on the spur of the moment" in wiktionary.com and
found that the meaning given is "on very short notice". The example
cited reinforces the meaning -"They kept their bags packed so they can
leave on the spur of the moment".
I thought the idiom referred to acting on impulse as in " I took that
decision on the spur of the moment and have regretted it ever since".