There's a controversial new app on the market, called Clean Reader, which removes naughty words from books printed in electronic form.

Confronted with the e-book of A Decent Ride, it would quickly collapse through overwork: the Edinburgh people who inhabit Irvine Welsh's new novel tend to machine-gun their sentences with the c-word (and no, it's not Corstorphine).

Whereas Welsh's previous work, The Sex Lives Of Siamese Twins, was set in sunny, upbeat, health-conscious Miami, A Decent Ride sees him returning to his cloudy, rainy home city. There are two main characters: 'Juice' Terry Lawson, a thrice-divorced, corkscrew-haired taxi-driver, drug dealer and Hibs diehard, who has appeared in earlier Welsh books; and Jonty MacKay, "a simple country lad fae Penicuik". Three, if you include Terry's outsized member 'Auld Faithful', the very core of his being.

Ronald Checker, a bratty American TV reality star and property developer, and Hurricane Bawbag, the December 2011 storm, also flit in and out of the pages. Golf and rare whisky both form part of the plot. Incest, necrophilia and the digging up of a grave feature too.

Sex is what keeps Terry going. Not only has he appeared in more than 20 "scud flicks" shot by his friend Sick Boy, but he's forever on the lookout for personable women ("check thehhht!" he commands a passenger on page eight; all the passenger sees is a rather ordinary woman on a pedestrian crossing). Elsewhere, he takes advantage of a seriously distraught woman (he thrives on damaged girls), sees funerals as a great way of pulling women and joins a sex-addiction group for entirely the wrong reason.

Irredeemably crass, he instinctively defines women by just one part of their anatomy. And yet: he has misgivings about prostitution, he's not without moments of decency, and he's not averse to reading some serious books. Edinburgh seems to him to be tawdry and second-rate, "crushed by its own ambition... unwilling to seize its larger destiny as a European capital".

It all reminds you of an observation that Welsh once made of James McAvoy's performance as a corrupt Edinburgh detective in Filth (adapted from another Welsh novel): "You really dislike his character but you feel for him too, you want to know what happens to him." When Terry is warned by a doctor that any sexual arousal could be fatal, and takes up golf as a substitute, you want to know what happens to him.

Sadder altogether is wee Jonty, whose partner Jinty Magdalen, unknown to him, works in a local sauna. Bad things happen to Jonty: in one particularly harrowing scene, he has sex with a corpse. This being Welsh, the scene is described in sharp but not excessive detail, nor with relish: you don't sense that it's there for its shock value. It's over in less than four pages but is probably the one thing you will remember from the book. It's no small tribute to Welsh's skill as a writer that, even as you read it, you somehow feel sorry for Jonty. The plight of his reduced circumstances is keenly felt.

A Decent Ride weaves disparate strands together: Checker's quest, Terry's ebullient pursuit of female flesh, Jonty's misadventures. Sick Boy puts in a cameo, as does a certain Cup Final, the very mention of which causes real-life Hibs fans to flinch. There is black comedy here and, as is common with Welsh's best work, moments of pathos. The humour - mostly from Terry - is occasionally very funny, as in the passage where, in a posh hotel and ever hopeful of more sex, he strips from the waist down and "does the auld trick ay callin room service n orderin a sandwich, then pretendin tae be asleep. Unfortunately," he adds, "it's a ------ gadge whae comes in." We even hear, once or twice, from Terry's member, the text deftly shaped so that we get an idea of Auld Faithful's proportions. Welsh's grasp of dialogue, chiefly that of Terry and Jonty, is as self-assured as ever, as is his ear for internal monologue.

A Decent Ride has already made the six-strong shortlist for the 2015 Bollinger Everyman Wodehouse prize for comic fiction, one judge asserting that Wodehouse would have been proud of "these astonishingly gifted writers". I'd love to know what PG, that quintessential Englishman, creator of Jeeves and Wooster, would have made of Juice Terry Lawson, the rampantly priapic Edinburgh cabbie - and, in a chapter headed Cold Comforts, that pungent, clammy scene of necrophilia.

Irvine Welsh takes part in Aye Right! on April 17