While I can’t speak to whether President Buchanan was a virgin, he did have at least one woman in his wife; he was engaged to marry Anne Caroline Coleman, but she died shortly after breaking off the engagement.
Now, a cynic who is inclined to believe that Buchanan was indeed gay may note that Ms. Coleman was the daughter of a very rich family which didn’t exactly approve of Buchanan (he was not allowed to attend her funeral), so his interest may have had more to do with personal ambition than love. And, in fact, he never did carry on any known relationship with any woman after he death.
Instead, his later affection does seem to be towards his male companion, Rufus King. And there is at least one quote from one letter (written after King left him to go to France) that does verify this love (although I am willing to be educated to the contrary; I do realize that male friendships back then did have a familiarity that would be unexpected today, and our own modern perspective may cause us to confuse societal norms of the 19th century).
[QUOTE=President James Buchanan]
I am now ‘solitary and alone’, having no companion in the house with me. I have gone a wooing to several gentlemen, but have not succeeded with any one of them. I feel that it is not good for man to be alone, and * should not be astonished to find myself married to some old maid who can nurse me when I am sick, provide good dinners for me when I am well, and not expect from me any very ardent or romantic affection.
[/QUOTE]
As for the OP’s question, I am among those who think that it will be possible for an openly gay person to be elected president, albeit in a few decades (after gay rights have been firmly established by the Supreme Court, and the panic over equality has died down). But, I do think it would have to be somebody who is in a long-term, committed relationship; bachelorhood would connote too many lurid thoughts among the more conservative voters and too much sexual innuendo from the press.
And as for Lindsay Graham, I hope he is gay, and I hope it comes out publicly. He has been a long-time opponent of gay rights, so I think being exposed as a self-hating hypocrite is a just result.