Nine years living in hiding after a fatwa was issued against him may not sound like a particularly merry experience, but Sir Salman Rushdie has said his period in police protection felt at times like "a comedy routine".

On leaving a dinner at the London home of fellow novelist Hanif Kureishi, he recalled that "one of the police officers left his gun behind. And for Hanif of course this was like a transcendent moment of joy. He ran out into the street, holding the gun by the barrel, shouting, 'Here, you forgot your shooter!'"

On another occasion, Rushdie said, a trip to rural Ayrshire led to strife between the English and the Scottish special branch about who should take charge, resolved by officers from both squads turning up.

"We were in this rural cottage in remote Ayrshire and there was this arsenal of armoured Jaguars parked outside. The hard thing was not concealing me, it was concealing them … there was this police convention going on."

The author was speaking about his third-person-narrated memoir, Joseph Anton (his pseudonym under the fatwa, after the first names of Conrad and Chekhov), at the Edinburgh international book festival.

He had no premonition of the storm that would greet the publication of The Satanic Verses, he said, when Ayatollah Khomeini issued a fatwa of death against him in 1989 – an event that led to the killing of one of Rushdie's translators, the serious injury of another, and bombings of bookshops.

"International terrorism levelled against translators, publishers and writers wasn't something that we knew about. People who were conservative Muslim believers had not liked any of my books, so I expected them not to like it and my view was, 'So what?' In general if you don't want to read a book then don't: that's why there are all these books in bookstores for you to chose from. If you start reading a book and you don't like it you always have the option of shutting it. At this point it loses its capacity to offend you."

He added: "I do think one of the characteristics of our age is the growth of this culture of offendedness. It's got something to do with the rise of identity politics, where you are invited to define your identity quite narrowly … What's happened in this age is we are asked to define ourselves by hate."

The writer turned too to less solemn subjects. Aside from reminiscing about an incident in which he had seen the late novelist William Styron's testicles under a loose-fitting pair of shorts ("obviously it was his preferred form of dress"), he also recalled dining with the great American writer Thomas Pynchon. The latter's decades-long avoidance of public appearances and interviews, and his refusal to be filmed or photographed, has given him a reputation for almost mythic mysteriousness.

"Thomas Pynchon looks exactly like Thomas Pynchon should look," said Rushdie. "He is tall, he wears lumberjack shirts and blue jeans. He has Albert Einstein white hair and Bugs Bunny front teeth."

The evening "started a little stiltedly", he added, "and then he relaxed and became very chatty and there was a moment when it was 3am and my eyes were dropping when he said, 'I guess you guys are getting a little tired, huh?' And I was thinking, 'Yes! But it's Thomas Pynchon, so wake up!' And when this long, affable evening came to an end I thought now we are sort of friends, and every so often we will see each other. And he never called again, from that day to this."

Before the publication of his acclaimed novel Midnight's Children, Rushdie worked as an advertising copywriter. "I invented this campaign for Aero chocolate bars," he recalled.

"With bubble words: adorabubble, irresistibubble, delectabubble. Bus signs that said transportabubble. Shop signs that said availabubble. Trade ads that said profitabubble. I invented it because the guy I was working with had a stammer. We were sitting in a room trying to think of an idea and said, 'It's fucking impossibubble.' It was my one genuine lightbulb moment."