James Erskine, Lord Grange — Scottish advocate, judge and politician