It could be because I grew up beside the brewery in Belhaven, but I’ve always liked pubs. The smell of roasting hops would fill the air at midday, and the malty scent of an open pub door is forever the smell of childhood. Though one sip of beer was enough to last me a lifetime, had I formed an early taste for Belhaven Best there was plenty of opportunity up the road in Dunbar where, according to the first-ever history of drinking in Scotland, in 1792 there were 46 pubs for a population of under 4000. The town was not much bigger in the late 1960s when my brother conducted a scientific survey with his school friends, and found a mere 37.

Given the substantial place drink has in our culture and history, it is astonishing that no-one before now has written a book devoted to it. In his introduction to A History of Drinking: The Scottish Pub Since 1700 (EUP, £80/£19.99), Anthony Cooke reflects that “many Scottish historians have exercised a kind of self-censorship” on the subject. It is a lamentable oversight, especially given the colour of the material to draw on, and Cooke describes ale houses, pubs, hostelries, shabeens, lounge bars, howffs, landlords and ‘luckies’ with a verve that matches the stories he finds.

Inevitably, this is a preliminary work, which might encourage others. And while it has some omissions – no mention for instance of the roaring trade in smuggled liquor in the early 18th century – it is an enthralling and oddly sobering piece of work. The country he depicts has been pickled for centuries, a tendency that no doubt predates written records, given the gusto with which the first scribes made fortified wine and ale.

Novelists make an appearance throughout, as if they were unofficial chroniclers of the nation’s bibulous habits. Allan Ramsay’s poem, Lucky Spence’s Last Advice, is a graphic and ugly depiction of a landlady whose bar served also as a brothel, as was common, advising her girls from her deathbed on how best to wring money out of their clients. Rendering them unconscious with spirits was by far the quickest and most reliable way. Cooke also goes behind the scenes of Burns’s The Jolly Beggars to show a decidedly darker side of pub culture. Meanwhile, the temperance movement and those horrified by the effect of excessive drink had their champions in such writers as David Pae, whose novel Mary Paterson, or the Fatal Error (1865) depicted the ruin that drink brought upon this poor woman, who ended up as one of Burke and Hare’s victims.

Paying tribute to modern writers such as Willie McIlvanney and Irvine Welsh, whose works evoke the macho drinking culture that disfigured countless lives, he lauds Ian Rankin as laureate of today’s pubs, his Rebus novels offering atmospheric portraits of Edinburgh’s bar life for which historians of the future will no doubt be grateful.

What is striking is for how brief a period pubs were the haunts of Scotland’s best-known writers, a place where they would gather to talk and debate, making a dram last forever, unless someone else was paying. There was a time, I am told, when in Edinburgh one could drop by Milne’s Bar or the Abbotsford, or Sandy Bell’s, in the certainty of finding one of the country’s bards, be it Hugh MacDiarmid, Tom Scott, or Norman MacCaig. So well defined were these haunts that it was easy for rivals rarely to meet, though in his memoir Poets, Pubs, Polls and Pillar Boxes, John Herdman recalls more than a few bust-ups. In one such, in the entrance of the New Town Hotel, he recalls Hamish Henderson slipping his jacket off his shoulders and challenging Trevor Royle, “the Scottish Arts Council’s charming and articulate Literature Director”, to a duel.

Today, though, pubs and hotels are fuller of tourists than writers, and those territorial, barfly days are fast disappearing. This is not to repine – how many potentially good poems or novels have been drowned in the dregs of a bottle of wine, or fallen victim to a hangover? But, though authors’ livers might be in better condition as a result, I suspect as many ideas are postponed, forgotten or fatally interrupted thanks to the tyranny of Twitter.