I was in Edinburgh the other day looking at Selkirkshire Sheriff Court papers. Obviously it could be a bit of a blow if you discover your ancestor committed a terrible crime, however, in Selkirkshire it could be softened by the fact that Sir Walter Scott could have signed some of the papers!
Graham is working on indexing the Selkirk Prison registers now, so if you see they were tried at the Sheriff Court it would be worth looking at the trial papers, you never know what you might find!