Church of Scotland minister and a founder and first principal of United College, St Andrews University