You also have to take into consideration how the word sounds. You say AN honor, not A honor because the word sounds more like it starts with an O, a vowel, instead of an H. You say A house, not AN house because house sounds like it starts with an H which is a consonant!
It should be:
a history a house a uniform (it does sound like it stars with a Y - "yu- ni-form")
an organ an hour (sounds like it starts with an A -- "ah-war" ) an e-mail
Most computer spell checker programs cannot discern how words are pronounced so they just go with the general vowel/consonant rules without regard to pronunciations.
Didn't you notice that even politicians and TV news reporters often make mistakes about this too?