This being the 30th anniversary of the Edinburgh International Book Festival, there has been much looking back over the last three decades.

But, with the referendum in sight, the future of Scotland has been a recurring theme too.

Former bishop Richard Holloway has seen "the emancipatory aspect of secular culture" lure people away from churches. Referring to the appetite he saw around him for serious debate and honest exchange of views, he said an event like the Book Festival "is like coming to the right kind of church".

Tam Dalyell understood where Holloway was coming from. "I suspect part of the reason is that people don't want to be harangued. They want genuine questions and answers." Speaking up for the House of Lords and making stinging criticisms of Tony Blair, the forthright opponent of independence has softened his stance not a whit. "I'm unashamedly for the ending of the Scottish Parliament," he said to a mixture of boos and "hear hears". "I'm a great believer in local authorities. My constituency was never better served than it was by Lothian Region."

Having added his weight to the Yes campaign, a dapper William McIlvanney brought in Alex Salmond to read an extract from McIlvanney's landmark novel Laidlaw and answer questions from the floor. Ticket-holders who objected to the session becoming an independence debate steered it back on track, but McIlvanney's jest that Scotland's motto shouldn't be "Wha daur meddle wi me" but "Wait a minute, that's no fair" was a good one.

Robert Crawford left the national debate to one side and spoke entertainingly of the eternal rivalry between Edinburgh and Glasgow. He concluded that Glasgow's brash attitude towards demolition has helped bring about a vigorous transformation, while "the coming of the Parliament has given Edinburgh a point and purpose which it didn't really have when I was growing up".

James Robertson's concerns were more serious, but still rooted in the Scottish experience. His new novel, The Professor Of Truth, is about a fictional disaster modelled on the Lockerbie bombing, bringing to the fore another theme running through the Book Festival this year: examining truth through fiction.

Melvyn Bragg has been doing the same thing, on a more personal level. He had stopped writing fiction, "because I found I wasn't disturbed by it", until a dream inspired him to write about his grandmother and how the stigma of illegitimacy had affected his family.

Bragg rejected the idea of a family memoir to write a novel, based on his conviction that history inspires the reaction "that's right", but fiction makes us say "that's true".

That's a principle well understood by Colm Toibin. Instead of slavishly following the Gospels in his new book about the Virgin Mary, he was guided by his instincts as a novelist as, in his view, that's what the Gospel writers were. His suggestion that John's Gospel may have been influenced by Greek drama was one of many interesting speculations.

Bosendorfer pianos are simply not what they were 50 years ago. That's from a man who should know, celebrated pianist Alfred Brendel. Mainly reading from his new A Pianist's A to Z, he passed on insightful nuggets of musical wisdom, but, sadly, arthritis has stopped him playing. "I have the pieces in my mind, and I work through them in my mind - some of them I play better than before - but I don't sit at the piano any more."

Appearing with her son, Matthew, for the first time, Jackie Kay beamed with such pride she probably would have let him talk about his West Bank documentary for the full hour. But then the audience would have been deprived of her refugee-inspired poems, and her ecstatically received "Maw Broon's Bedroom Tax" monologue.

The living embodiment of "louche", Rupert Everett, was reliably entertaining and indiscreet, even if the best bit was the momentary confusion and hilarity over how the hard-working signer for the deaf would translate "cunnilingus".

But DBC Pierre had the edge, pulling out a bottle of a Mexican beverage called Sotol, which predates tequila by 8000 years. "I agree with Islam entirely that we are decadent," he said, serving it up in shot glasses to audience members. His new miscellany, Petit Mal, rages against the dying of the printed book.

And on to the burning question: how would Edinburgh's favourite detective vote in the referendum? "Rebus would vote No, Siobhan would vote Yes, and I'm somewhere in the middle," declared Ian Rankin.

Rankin also admitted to having late-onset OCD. "In the kitchen cupboard, all the tins have to be facing the front. It drives my wife mental." And he announced there would be no new book from the "knackered" author next year.

In reference to the late Iain Banks, he added, "Friends of mine are dropping dead. I don't want to die slumped over my desk."